我在这里发疯了,想弄清楚如何在我的 nginx 服务器上启用 TLSv1.3。
根据我的研究,我的设置应该支持它:
# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
# uname -a
Linux server 5.3.0-28-generic #30~18.04.1-Ubuntu SMP Fri Jan 17 06:14:09 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
# nginx -V
nginx version: nginx/1.14.0 (Ubuntu)
built with OpenSSL 1.1.1 11 Sep 2018
TLS SNI support enabled
...
# openssl version
OpenSSL 1.1.1 11 Sep 2018
# dpkg -s openssl | grep Version
Version: 1.1.1-1ubuntu2.1~18.04.5
我已经包含了 TLSv1.3 协议,甚至(尽管我理解它是可选的)在我的 nginx 配置中特别列出了 TLSv1.3 密码:
...
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384:TLS_AES_128_GCM_SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256;
ssl_ecdh_curve X25519:secp384r1;
...
但是我无法使用 TLSv1.3 连接到服务器,无论是通过浏览器(可以通过 TLSv1.3 连接到其他网站)还是curl
:
# curl -I -v --tlsv1.3 --tls-max 1.3 https://mydomain.com
* Rebuilt URL to: https://mydomain.com/
* Trying xxx.xxx.xxx.xxx...
* TCP_NODELAY set
* Connected to mydomain.com (xxx.xxx.xxx.xxx) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS alert, Server hello (2):
* error:1409442E:SSL routines:ssl3_read_bytes:tlsv1 alert protocol version
* stopped the pause stream!
* Closing connection 0
curl: (35) error:1409442E:SSL routines:ssl3_read_bytes:tlsv1 alert protocol version
TLSv1.2 工作正常。
请问我错过了什么?!
编辑
一些额外的故障排除信息:
# openssl s_client -tls1_3 -connect mydomain.com:443
CONNECTED(00000005)
140179247497664:error:1409442E:SSL routines:ssl3_read_bytes:tlsv1 alert protocol version:../ssl/record/rec_layer_s3.c:1528:SSL alert number 70
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 7 bytes and written 244 bytes
Verification: OK
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 0 (ok)
---
同样,使用 TLSv1.2 作为选项运行它时我没有问题。