Simply installing a certificate is not enough. To be truly secure, you must configure your server to refuse any connection that doesn't meet a high security threshold. This process involves stripping away legacy support and forcing the client to adopt the strongest possible settings.
Hardening starts with a whitelist approach. Instead of 'disabling bad ciphers', you define a short list of 'known good' ciphers. For TLS 1.2, this means only allowing GCM or Poly1305 and requiring ECDHE for key exchange.
๐ก Pro-tip: Use the Mozilla SSL Configuration Generator. It is the industry standard for creating secure Nginx, Apache, and HAProxy configs.
# Example Nginx Hardened Config
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305';
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:10m;By setting `ssl_prefer_server_ciphers on`, you ensure the server's security preference takes precedence over the client's, preventing the client from requesting a weaker cipher it might support.
HTTP Strict Transport Security (HSTS) is a header that tells the browser: 'For the next X months, never even attempt to connect to me via HTTP. Automatically convert all requests to HTTPS.' This prevents 'SSL Stripping' attacks where a MitM forces a user to an unencrypted version of the site.
โ ๏ธ Warning: If you enable HSTS and then your certificate expires or breaks, your users will be COMPLETELY blocked from the site. There is no 'Proceed anyway' button in HSTS mode.
| Mechanism | Protects Against | Implementation | Risk |
|---|---|---|---|
| HSTS | SSL Stripping | HTTP Header | Lock-out if Cert fails |
| Cipher Whitelist | Downgrade Attacks | Server Config | Legacy Client Incompatibility |
| OCSP Stapling | Revoked Certs | Server Logic | Staple Refresh Failure |
| Forward Secrecy | Retroactive Decryption | ECDHE Key Ex | Slight CPU overhead |
HTTP Public Key Pinning (HPKP) allowed a site to tell the browser: 'Only trust certificates that use these specific public keys.' While powerful, it was too dangerous (a single mistake could brick a site for all users), and it has been deprecated. It was replaced by Certificate Transparency (CT) and CAA records.
Never use 'Null' or 'Export' ciphers for debugging on a production server. One accidental restart with these enabled can expose all traffic.
Verify exercises to earn โ 180 XP and unlock next lab level.