Nginx 1.15.10 – TLSv1.3 Configuration Not Applied

firefoxhstsnginxsslssl-certificate

nginx -V
nginx version: nginx/1.15.10
built by gcc 6.3.0 20170516 (Debian 6.3.0-18+deb9u1) 
built with OpenSSL 1.1.0j  20 Nov 2018 (running with OpenSSL 1.1.1b  26 Feb 2019)
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-g -O2 -fdebug-prefix-map=/data/builder/debuild/nginx-1.15.10/debian/debuild-base/nginx-1.15.10=. -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'

I'm trying to enable TLSv1.3 on Debian Stretch with nginx from official repo of the developers. So far, no dice – Firefox 65 and ssllabs' test don't show it as supporting TLSv1.3, and when I remove the TLSv1.2 support, I get weird "SSL_ERROR_INTERNAL_ERROR_ALERT" fatal error in Firefox. Googling shows no promising leads, and "it works" for everyone (what a shocker!).

Here's the relevant config snippets, all related to SSL/TLS:

listen [::]:443 ssl http2 ipv6only=on;
listen 443 ssl http2;
server_name mysite.intra;

# Use Mozilla's guidelines for SSL/TLS settings
# https://mozilla.github.io/server-side-tls/ssl-config-generator/
# NOTE: some settings below might be redundant
#ssl on;
ssl_certificate /[hidden];
ssl_certificate_key /[hidden];

ssl_session_cache shared:SSL:50m;
ssl_session_timeout 1d;
ssl_session_tickets off;
ssl_prefer_server_ciphers on;
#ssl_protocols TLSv1.3;
ssl_protocols TLSv1.3 TLSv1.2;
ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA512:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:ECDH+AESGCM:ECDH+AES256:DH+AESGCM:DH+AES256:RSA+AESGCM:!aNULL:!eNULL:!LOW:!RC4:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS;
ssl_stapling on;
ssl_stapling_verify on;
resolver 8.8.4.4 1.1.1.1 1.0.0.1 8.8.8.8;

And here's the recursive search of configs dir for any mentions of TLS:

Searching 21 files for "TLS"
/mnt/sshfs/mysite/etc/nginx/nginx.conf:
   24      default_type  application/octet-stream;
   25  
   26:     #ssl_protocols TLSv1.2 TLSv1.3;
   27      #ssl_prefer_server_ciphers on;
   28  

/mnt/sshfs/mysite/etc/nginx/sites-available/default:
   21   access_log /var/log/nginx/mysite-access.log combined;
   22  
   23:     # Use Mozilla's guidelines for SSL/TLS settings
   24:     # https://mozilla.github.io/server-side-tls/ssl-config-generator/
   25      # NOTE: some settings below might be redundant
   26   #ssl on;
   ..
   32   ssl_session_tickets off;
   33   ssl_prefer_server_ciphers on;
   34:  ssl_protocols TLSv1.3 TLSv1.2;
   35   ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA512:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:ECDH+AESGCM:ECDH+AES256:DH+AESGCM:DH+AES256:RSA+AESGCM:!aNULL:!eNULL:!LOW:!RC4:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS;
   36   ssl_stapling on;

/mnt/sshfs/mysite/etc/nginx/sites-enabled/default:
   21   access_log /var/log/nginx/mysite-access.log combined;
   22  
   23:     # Use Mozilla's guidelines for SSL/TLS settings
   24:     # https://mozilla.github.io/server-side-tls/ssl-config-generator/
   25      # NOTE: some settings below might be redundant
   26   #ssl on;
   ..
   32   ssl_session_tickets off;
   33   ssl_prefer_server_ciphers on;
   34:  ssl_protocols TLSv1.3 TLSv1.2;
   35   ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA512:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:ECDH+AESGCM:ECDH+AES256:DH+AESGCM:DH+AES256:RSA+AESGCM:!aNULL:!eNULL:!LOW:!RC4:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS;
   36   ssl_stapling on;

10 matches across 3 files

Can anybody please shed the light on what's happenning here?

Best Answer

built with OpenSSL 1.1.0j 20 Nov 2018 (running with OpenSSL 1.1.1b 26 Feb 2019)

nginx was build against OpenSSL 1.1.0. TLS 1.3 is only implemented with OpenSSL 1.1.1.

It is not sufficient to just replace the existing libraries on the system since enabling TLS 1.3 requires an API which is only available with OpenSSL 1.1.1. Since your nginx was not build against OpenSSL 1.1.1 it was not build to use this API and thus cannot enable TLS 1.3. I would expect that you have some messages in the error log pointing this out as configuration problem.

To fix the problem you need to rebuild nginx against OpenSSL 1.1.1. See Debian 9 Stretch Nginx with OpenSSL 1.1.1 & TLSv1.3 for help on doing this.