OpenSSL-在Lighttpd中禁用TLS1.0和1.1,仅开启1.2的方法

在Lighttpd.conf中配置如下:

ssl.engine="enable"
ssl.pemfile="certandkey.pem"     #证书文件     
ssl.ca-file="CA_cert.pem"			#证书文件
ssl.verifyclient.activate="enable"
ssl.cipher-list = "TLSv1.2"			#配置为1.2

配置完后要重启Lighttpd服务

/etc/init.d/lighttpd restart

此时通过TLS1.0\1.1发送请求就会失败
如下:
1、TLS1.0请求

Note: Unnecessary use of -X or --request, GET is already inferred.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* TLSv1.0 (OUT), TLS header, Certificate Status (22):
} [5 bytes data]
* TLSv1.0 (OUT), TLS handshake, Client hello (1):
} [166 bytes data]
* TLSv1.0 (IN), TLS header, Unknown (21):
{ [5 bytes data]
* TLSv1.0 (IN), TLS alert, Server hello (2):
{ [2 bytes data]
* error:14077410:lib(20):func(119):reason(1040)
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (35) error:14077410:lib(20):func(119):reason(1040)

2、TLS1.1请求

Note: Unnecessary use of -X or --request, GET is already inferred.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* TLSv1.1 (OUT), TLS header, Certificate Status (22):
} [5 bytes data]
* TLSv1.1 (OUT), TLS handshake, Client hello (1):
} [166 bytes data]
* TLSv1.1 (IN), TLS header, Unknown (21):
{ [5 bytes data]
* TLSv1.1 (IN), TLS alert, Server hello (2):
{ [2 bytes data]
* error:14077410:lib(20):func(119):reason(1040)
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (35) error:14077410:lib(20):func(119):reason(1040)

可以看到上面的都失败了,返回error,握手失败,下面看1.2
3、TLS1.2请求

Note: Unnecessary use of -X or --request, GET is already inferred.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* TLSv1.2 (OUT), TLS header, Certificate Status (22):
} [5 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.2 (IN), TLS handshake, Server hello (2):
{ [94 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [1371 bytes data]
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
{ [333 bytes data]
* TLSv1.2 (IN), TLS handshake, Request CERT (13):
{ [66 bytes data]
* TLSv1.2 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.2 (OUT), TLS handshake, Certificate (11):
} [1370 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
} [70 bytes data]
* TLSv1.2 (OUT), TLS handshake, CERT verify (15):
} [264 bytes data]
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* TLSv1.2 (IN), TLS change cipher, Client hello (1):
{ [1 bytes data]
* TLSv1.2 (IN), TLS handshake, Finished (20):
{ [16 bytes data]
> GET /api/v1/wireless/aps HTTP/1.1
> Host: 192.168.200.254:8190
> User-Agent: curl/7.57.0
> Accept: */*
> Content-type:application/json
> 
  0     0    0     0    0     0      0      0 --:--:--  0:00:02 --:--:--     0{ [5 bytes data]
< HTTP/1.1 200 OK
< Content-type: application/json
< Content-Length: 466
< Date: Wed, 15 May 2019 03:32:00 GMT
< Server: lighttpd/1.4.45

可以看到握手成功的信息,并没有error。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值