UNIXETC

SSL安全优化

先贴出本站的SSL安全评级,测试地址为https://www.ssllabs.com/ssltest/analyze.html?d=alair.cn

“SSL安全评级”

以下是本站Nginx配置中关于SSL部分

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
	listen 443 ssl http2;
	
	ssl_certificate /etc/letsencrypt/live/alair.cn/fullchain.pem;  
	ssl_certificate_key /etc/letsencrypt/live/alair.cn/privkey.pem; 
	
	ssl_session_timeout 60m;
	ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
	ssl_ciphers ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:RC4-SHA:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!DSS:!PKS;
	
	ssl_prefer_server_ciphers on;
	ssl_session_cache builtin:1000 shared:SSL:10m;
	ssl_dhparam /etc/ssl/certs/dhparam.pem;
	ssl_stapling on;
	ssl_stapling_verify on;
	
	add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
	add_header X-Frame-Options "DENY";

说明:

dhparam.pem可以使用openssl dhparam -out dhparam.pem 4096命令生成,这个命令会执行很长时间,也可以将字节数改为2048