如何在Nginx中禁用TLSv1.0和TLSv1.1

我想弄清楚如何禁用TLSv1和1.1 Nginx,并且只允许1.2上的连接。 这是为了testing的原因,而不是在生产中使用,对于我的生活,我不明白为什么Nginx不会让我这样做。

Nginx SSLconfiguration

ssl on; ssl_protocols TLSv1.2; ssl_prefer_server_ciphers on; ssl_ciphers ECDH+AESGCM256:DH+AESGCM256:ECDH+AES256:!aNULL:!MD5:!kEDH; ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; add_header Strict-Transport-Security "max-age=262974383; includeSubdomains;"; add_header X-Frame-Options DENY; add_header X-Content-Type-Options nosniff; ssl_stapling on; ssl_stapling_verify on; resolver 8.8.8.8 8.8.4.4 valid=300s; 

但由于某种原因,Nginx仍然在谈判1.0和1.1的连接。 难道我做错了什么? 我在OpenSSL 1.0.1f的Ubuntu Server 14.04LTS上使用Nginx 1.7.10。

ssl_protocols指令的nginx文档 :

TLSv1.1和TLSv1.2参数从版本1.1.13和1.0.12开始支持,所以当旧版本的nginx使用OpenSSL版本1.0.1或更高版本时,这些协议工作,但是不能被禁用。

在较新的版本中,可以通过使用openssl命令来validation,如下所示:

  • validation是否支持TLS v1.2: openssl s_client -tls1_2 -connect example.org:443 < /dev/null
  • validationTLS v1.1不受支持: openssl s_client -tls1_1 -connect example.org:443 < /dev/null
  • validation支持TLS v1.0: openssl s_client -tls1 -connect example.org:443 < /dev/null

如果nginxconfiguration只包含ssl_protocols TLSv1.2指令,那么只支持TLSv1.2。 如果configuration了ssl_protocols TLSv1.1 and TLSv1.2 ,则只支持TLSv1.1和TLSv1.2。 用openssl 1.0.1enginx 1.6.2testing。