SSL Best config#
All tests are made with https://www.ssllabs.com/ssltest/
By default, the SSl configuration is not secure. We will see how to improve the security of our web services.
Nginx#
- Default configuration:
- Config:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
server { listen 443 http2 ssl; server_name test.sile.tech; ssl_certificate /etc/nginx/ssl/test.sile.tech_cert.crt; ssl_certificate_key /etc/nginx/ssl/test.sile.tech_privkey.crt; location / { root /usr/share/nginx/html; index index.html index.htm; } location = /50x.html { root /usr/share/nginx/html; } } - Note: B
- Config:
- New configuration:
- Config:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
server { listen 443 http2 ssl; server_name test.sile.tech; ssl_certificate /etc/nginx/ssl/test.sile.tech_fullchain.crt; ssl_certificate_key /etc/nginx/ssl/test.sile.tech_privkey.crt; ssl_dhparam /etc/nginx/ssl/dhparam.pem; # SSL Settings ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-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; ssl_session_timeout 1d; ssl_session_cache shared:SSL:10m; ssl_session_tickets off; # OCSP stapling ssl_stapling on; ssl_stapling_verify on; ssl_trusted_certificate /etc/nginx/ssl/test.sile.tech_chain.crt; resolver 1.1.1.1 208.67.222.222; add_header Strict-Transport-Security "max-age=63072000" always; location / { root /usr/share/nginx/html; index index.html index.htm; } location = /50x.html { root /usr/share/nginx/html; } } - Note: A+
- Config:
HAProxy#
- Default configuration:
- Config:
1 2 3 4 5 6 7
global default-path config zero-warning user haproxy group haproxy hard-stop-after 5m log stdout format raw local0 info - Note: A
- Config:
- New configuration:
- Config:
1 2 3 4 5 6 7 8 9 10 11
global default-path config zero-warning user haproxy group haproxy hard-stop-after 5m log stdout format raw local0 info ssl-default-bind-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-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-default-bind-options no-sslv3 no-tlsv10 no-tlsv11 ssl-default-server-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-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-default-server-options no-sslv3 no-tlsv10 no-tlsv11 - add this line to each https frontend:
1http-response set-header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload;" - Note: A+
- Config: