Better SSL: Get an A+ rating on your server’s SSL security
Google started ranking sites with HTTPS higher, so it’s a must. My server, a Linode instance, is running Nginx and has basic HTTPS from Letsencrypt - it’s working great. But I only get a B rating at Qualys’ SSL Labs ( https://www.ssllabs.com/ssltest ) with the nearly out of the box configuration that I am using. Let’s make that better.
First we need to generate a strong Diffie-Hellman group like so:
sudo openssl dhparam -out dhparam.pem 4096
Even on a blazing fast Linode this took a while. A long while. You might want to run this before lunch or something.
Next modify your nginx config file with:
ssl_prefer_server_ciphers on; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA'; ssl_dhparam /etc/ssl/certs/dhparam.pem; ssl_session_cache shared:SSL:32m; ssl_buffer_size 8k; ssl_session_timeout 15m; }
And make sure you have a 301 redirect to the https url.
Next uncomment the line:
config.force_ssl = true
Restart nginx and unicorn/puma/thin and retest the site. Boom, A+ rating!
Tyler (Ty) Kinnison is a programmer with 34 years of experience. He lives with his wife Julie in Portland, Oregon.
Currently he is working on: Ethereum DAPPS, Bitcoin, NetSec, 3DPrinting, Robotics and OpenCV, Ruby on Rails, Machine Learning