AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1210619
Accepted
Greelan
Greelan
Asked: 2020-02-15 19:32:00 +0800 CST2020-02-15 19:32:00 +0800 CST 2020-02-15 19:32:00 +0800 CST

无法让 TLSv1.3 在 Ubuntu 18.04.4 上与 nginx 1.14.0 和 OpenSSL 1.1.1 一起使用

  • 772

我在这里发疯了,想弄清楚如何在我的 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 作为选项运行它时我没有问题。

nginx openssl tls
  • 2 2 个回答
  • 2430 Views

2 个回答

  • Voted
  1. Best Answer
    Greelan
    2020-02-22T03:15:48+08:002020-02-22T03:15:48+08:00

    我已经解决了我的问题。我还有一个 default_server 配置/etc/nginx/sites-enabled/,它在 ssl_protocols 参数中没有 TLSv1.3 标志(事实上,它根本没有 ssl_protocols 参数)。这显然导致了失败,即使我的测试是在由不同服务器块提供服务的主机名上运行的。去搞清楚!

    • 2
  2. KevDog
    2020-02-20T08:19:07+08:002020-02-20T08:19:07+08:00

    嗨,我尝试在其他线程上回答,但无论出于何种原因我都无法回答。

    我在我自己的服务器上尝试了你的测试,但是我得到了这个:

    curl -I -v --tlsv1.3 --tls-max 1.3 https://bw.domain.com
    *   Trying 10.0.1.86:443...
    * TCP_NODELAY set
    * Connected to bw.domain.com (10.0.1.86) port 443 (#0)
    * ALPN, offering http/1.1
    * successfully set certificate verify locations:
    *   CAfile: /opt/local/share/curl/curl-ca-bundle.crt
      CApath: none
    * TLSv1.3 (OUT), TLS handshake, Client hello (1):
    * TLSv1.3 (IN), TLS handshake, Server hello (2):
    * TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
    * TLSv1.3 (IN), TLS handshake, Certificate (11):
    * TLSv1.3 (IN), TLS handshake, CERT verify (15):
    * TLSv1.3 (IN), TLS handshake, Finished (20):
    * TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
    * TLSv1.3 (OUT), TLS handshake, Finished (20):
    * SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
    * ALPN, server accepted to use http/1.1
    * Server certificate:
    *  subject: CN=bw.domain.com
    *  start date: Feb  3 16:54:01 2020 GMT
    *  expire date: May  3 16:54:01 2020 GMT
    *  subjectAltName: host "bw.domain.com" matched cert's "bw.domain.com"
    *  issuer: C=US; O=Let's Encrypt; CN=Let's Encrypt Authority X3
    *  SSL certificate verify ok.
    > HEAD / HTTP/1.1
    > Host: bw.domain.com
    > User-Agent: curl/7.68.0
    > Accept: */*
    >
    * TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
    * TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
    * old SSL session ID is stale, removing
    * Mark bundle as not supporting multiuse
    < HTTP/1.1 200 OK
    HTTP/1.1 200 OK
    < Server: nginx/1.16.1
    Server: nginx/1.16.1
    < Date: Wed, 19 Feb 2020 15:23:50 GMT
    Date: Wed, 19 Feb 2020 15:23:50 GMT
    < Content-Type: text/html; charset=utf-8
    Content-Type: text/html; charset=utf-8
    < Content-Length: 1373
    Content-Length: 1373
    < Connection: keep-alive
    Connection: keep-alive
    < Cache-Control: public, max-age=600
    Cache-Control: public, max-age=600
    < Feature-Policy: accelerometer 'none'; ambient-light-sensor 'none'; autoplay 'none'; camera 'none'; encrypted-media 'none'; fullscreen 'none'; geolocation 'none'; gyroscope 'none'; magnetometer 'none'; microphone 'none'; midi 'none'; payment 'none'; picture-in-picture 'none'; sync-xhr 'self' https://haveibeenpwned.com https://twofactorauth.org; usb 'none'; vr 'none'
    Feature-Policy: accelerometer 'none'; ambient-light-sensor 'none'; autoplay 'none'; camera 'none'; encrypted-media 'none'; fullscreen 'none'; geolocation 'none'; gyroscope 'none'; magnetometer 'none'; microphone 'none'; midi 'none'; payment 'none'; picture-in-picture 'none'; sync-xhr 'self' https://haveibeenpwned.com https://twofactorauth.org; usb 'none'; vr 'none'
    < Referrer-Policy: same-origin
    Referrer-Policy: same-origin
    < X-Frame-Options: SAMEORIGIN
    X-Frame-Options: SAMEORIGIN
    < X-Content-Type-Options: nosniff
    X-Content-Type-Options: nosniff
    < X-XSS-Protection: 1; mode=block
    X-XSS-Protection: 1; mode=block
    < Content-Security-Policy: frame-ancestors 'self' chrome-extension://nngceckbapebfimnlniiiahkandclblb moz-extension://* ;
    Content-Security-Policy: frame-ancestors 'self' chrome-extension://nngceckbapebfimnlniiiahkandclblb moz-extension://* ;
    < Access-Control-Allow-Origin:
    Access-Control-Allow-Origin:
    
    <
    * Connection #0 to host bw.domain.com left intact
    

    我的反向代理是 nginx,但它配置了 Mozilla 中间代理。尽管有中间 ssl-params,TLS1.3 握手看起来已经建立。

    # openssl version                      
    OpenSSL 1.1.1d  10 Sep 2019
    
    # nginx -V                             
    nginx version: nginx/1.16.1
    built with OpenSSL 1.1.1d  10 Sep 2019
    TLS SNI support enabled
    
    # uname -a
    Linux 5.4.15-arch1-1 
    

    我正在使用以下 nginx-ssl 参数

    ssl_session_timeout 1d;
    ssl_session_cache shared:MozSSL:10m;  # about 40000 sessions
    ssl_session_tickets off;
    
    # curl https://ssl-config.mozilla.org/ffdhe2048.txt > /path/to/dhparam.pem
    ssl_dhparam /etc/ssl/dhparam.pem;
    
    # intermediate configuration
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECD
    SA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:
    ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
    ;
    ssl_prefer_server_ciphers off;
    
    # HSTS (ngx_http_headers_module is required) (63072000 seconds)
    #add_header Strict-Transport-Security "max-age=63072000" always;
    
    # OCSP stapling
    #ssl_stapling on;
    #ssl_stapling_verify on;
    
    resolver 10.0.1.1;
    
    
    • 0

相关问题

  • php 不使用 nginx & phpfm 解析

  • 启动时加载守护进程

  • 我应该在 Web 根目录上设置什么文件权限?

  • 如何使用 Nginx、APC 和 PostgreSQL 设置 PHP?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve