我在github.com/ioerror/duraconf中发现了一些强化的SSL设置。
这是来自config的头文件:
这是一个高度安全的,兼容SSLv3和TLSv1的HTTPS代理服务器的例子。 服务器只允许提供完美的前向保密的模式; 没有其他模式提供。 匿名密码模式被禁用。 此configuration不包括HSTS标头,以确保用户第一次访问后不会意外连接到不安全的HTTP服务。
它只支持PFS模式下的强密码:
ssl_prefer_server_ciphers on; ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; # Only strong ciphers in PFS mode ssl_ciphers ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA; ssl_protocols SSLv3 TLSv1;
如果我们在我们的网站上使用这些设置,那么“有点兼容”是什么意思? 比如说IE6还能连接吗?
Windows XP(即6,7和8)上的Internet Explorer无法连接,因为它们不支持正向保密。 你可以在SSLLabs上自己testing这样的东西。
除此之外,一切都应该工作,但可能有旧移动客户端无法连接。 这将需要进一步的testing。
我个人认为这种configuration不适合现实世界的网站。 AES256是一个假的,只增加连接时间。 AES128对于普通网站来说已经不够了,看看希捷的这个文档 。 除非你打算部署一个银行网站,或者一个吹口哨的东西去与AES128和免除你的服务器的计算开销。
我对nginx的个人configuration如下(完整的nginxconfiguration可以在我的一个仓库中find )。
# Content Security Policy # # LINK: http://www.w3.org/TR/CSP/ add_header X-WebKit-CSP "default-src 'self' *.example.com;"; add_header X-Content-Security-Policy "default-src 'self' *.example.com;"; add_header Content-Security-Policy "default-src 'self' *.example.com;"; # Do not allow embeding of our website in iframes. # # LINK: http://tools.ietf.org/html/rfc7034 # LINK: http://tools.ietf.org/html/draft-ietf-websec-frame-options-00 add_header X-Frame-Options "DENY"; add_header Frame-Options "DENY"; # Only communicate view encrypted connections on all domains, forever! # # LINK: https://tools.ietf.org/html/rfc6797 add_header Strict-Transport-Security "max-age=262974383; includeSubdomains;"; # (Re)Enable web browser XSS filter protection (IE+Chrome). # # LINK: http://blogs.msdn.com/b/ie/archive/2008/07/02/ie8-security-part-iv-the-xss-filter.aspx add_header X-XSS-Protection "1; mode=block"; # Use a public DNS to resolve OCSP responder hostnames. The answer stays valid for a complete day. # # LINK: http://pcsupport.about.com/od/tipstricks/a/free-public-dns-servers.htm resolver 209.244.0.3 209.244.0.4 valid=86400; # We only support AES128 and Elliptic curve Diffie–Hellman (ECDH) plus Diffie–Hellman (DH) in order to enable Forward # Secrecy. This configuration ensures highest compatibility, best performance while still being extremely secure. Please # note that using AES128 isn't really less secure than any other AES implementation. # # LINK: http://www.scribd.com/doc/29872766/128-Bit-vs-256-Bit-AES-Encryption ssl_ciphers "EECDH+AESGCM EDH+AESGCM EECDH -RC4 EDH -CAMELLIA -SEED !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !RC4 !AES256"; ssl_ecdh_curve secp384r1; # Prefer our configured ciphers over the client specified ones. ssl_prefer_server_ciphers on; # Only support newest protocols, unfortunately we have to support TLS 1.0 and 1.1, otherwise 99% of the internet can't # connect to our server. ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Use a shared (among all nginx worker threads) cache for SSL sessions; one megabyte can store about 4000 sessions. # # LINK: http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_session_cache ssl_session_cache shared:SSL:100m; # Number of seconds before an SSL session expires in the session cache. Should match the keepalive value. # # LINK: http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_session_timeout # LINK: http://httpd.apache.org/docs/2.2/mod/mod_ssl.html#sslsessioncachetimeout ssl_session_timeout 60; # Enable OCSP stapling. # # LINK: http://tools.ietf.org/html/rfc4366#section-3.6 # LINK: http://tools.ietf.org/html/rfc6066 ssl_stapling on; ssl_stapling_verify on; # The certificate of our authority for OCSP verification. ssl_trusted_certificate ssl/ca-bundle.pem;
我也使用一个自定义的init.d脚本启动nginx并直接获取OSCP响应,这确保了所有的客户端都可以validation它。 你可以在我的仓库find它。
SSL中的“硬化”是什么意思?
第一手使用哪个cipher_suites取决于服务器上可用的cipher_suites,然后是server_suggestions,然后是客户端能够说的。 与那些cipher_suites你有ECDHE和DHEconfiguration这是不错的,当你想使用PFS,但由于只有TLSv1 ist启用,我不认为你可以使用ECDHE无论如何,所以你会坚持DHE,这可能会用于大多数浏览器。 一些非常传统的客户端(IIRC IE <= 9)可能无法使用PFS,因此您可以使用此configuration保留它们。
如果你要浏览器testing给出的cipher_suites:
openssl ciphers来检查您的服务器上可用的openssl ciphers 从第三方获取cipher_suggestions的问题:
你可能会在这里find更多关于nginx + ssl的信息: Nginx + SSL + SPDY指南
有些事情我不喜欢你链接到的nginx-config:
~~~
ssl_protocols SSLv3 TLSv1; # -> no tlsv1.2/tlsv1.2??? this is NOT high security # as mentioned in the header proxy_cache_valid any 1h; # REALLY???
~~~
我最好的猜测是“有点兼容”是用来expression“不完全兼容”的一种方式。
该密码列表不支持IE6,因为IE6没有可用的FPS密码。
你也可以find这篇文章的使用。