What You Will Learn
INTERMEDIATE- The TLS handshake — step by step, in plain English
- Cipher suites & forward secrecy (why it matters post-Snowden)
- Common TLS misconfigurations that still bite teams in 2026
What HTTPS Actually Does
HTTPS = HTTP over TLS. TLS provides three guarantees: confidentiality (data is encrypted), integrity (data can't be modified in transit), and authentication (you're really talking to imcseian.com, not an attacker). Without TLS, none of those hold.
How TLS achieves this: a handshake where browser and server agree on encryption keys (using public-key cryptography), then encrypted communication using those keys. The handshake takes 1-2 round trips (~50-100ms) on first connection, then is cached for subsequent ones.
The Handshake in Detail
- ClientHello: browser sends list of ciphers it supports, a random number, and the SNI (Server Name Indication — which site it wants).
- ServerHello: server picks one cipher, sends its certificate (proving it's really imcseian.com), and a random number.
- Key exchange: browser generates a pre-master secret, encrypts with server's public key (from cert). Both sides derive the same session key.
- Encrypted communication: all subsequent traffic uses the session key with symmetric encryption (AES-GCM).
Cipher Suites: What They Mean
A cipher suite is a string like TLS_AES_128_GCM_SHA256. It defines three things: the key exchange (how session keys are derived), the bulk encryption (how traffic is encrypted), and the message authentication (how tampering is detected).
| Component | Modern Choice | Why | Avoid |
|---|---|---|---|
| Key exchange | ECDHE (Elliptic Curve Diffie-Hellman Ephemeral) | Forward secrecy — even if private key leaks, old traffic stays encrypted | RSA key exchange (no forward secrecy) |
| Bulk encryption | AES-GCM or ChaCha20-Poly1305 | Authenticated encryption — detects tampering | AES-CBC (vulnerable to padding oracle) |
| Authentication | SHA-256 or SHA-384 | Standard hash | MD5, SHA-1 (broken) |
TLS 1.3 vs TLS 1.2
| Aspect | TLS 1.2 | TLS 1.3 (2018) |
|---|---|---|
| Handshake round trips | 2 | 1 (faster) |
| Forward secrecy | Optional (often missing) | Required |
| Weak ciphers | Allows AES-CBC, RC4, MD5 | Removed (only AEAD ciphers) |
| Renegotiation | Allowed (vulnerable) | Removed |
| Status in 2026 | Still 50% of internet | Required for new apps |
Common TLS Misconfigurations
- Allowing HTTP: even if HTTPS works, allowing HTTP means users can be SSL-stripped. Use HSTS header to force HTTPS.
- Weak cipher suites: allowing TLS 1.0/1.1, RC4, AES-CBC. Modern scanners flag these. Disable in Nginx/Apache config.
- Self-signed certs: browsers warn users. Use Let's Encrypt (free) or paid CAs.
- Missing intermediate cert: some clients fail silently. Always include full chain.
- Long cert lifetimes: 1+ year certs mean if stolen, long exploit window. Use 90-day Let's Encrypt certs with auto-renewal.
- No HSTS header:
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload— tells browser to always use HTTPS for a year. - No OCSP stapling: clients must check revocation status, adding latency. Enable OCSP stapling on server.
Setting Up HTTPS with Let's Encrypt
# Install certbot (works with Nginx, Apache, or standalone)
sudo apt install certbot python3-certbot-nginx
# Get a free 90-day cert for your domain
sudo certbot --nginx -d imcseian.com -d www.imcseian.com
# Certbot auto-edits Nginx config to:
# - Listen on 443 with the cert
# - Redirect HTTP → HTTPS
# - Set HSTS header
# Auto-renewal cron is set up automatically
# Test your setup at https://www.ssllabs.com/ssltest/
# Aim for A+ rating
Nginx TLS Configuration (Production)
# /etc/nginx/sites-available/imcseian.com
server {
listen 443 ssl http2;
server_name imcseian.com;
ssl_certificate /etc/letsencrypt/live/imcseian.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/imcseian.com/privkey.pem;
# Modern TLS configuration (Mozilla intermediate, 2026)
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';
ssl_prefer_server_ciphers off;
# HSTS (force HTTPS for 1 year, including subdomains)
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
# OCSP stapling
ssl_stapling on;
ssl_stapling_verify on;
resolver 1.1.1.1 8.8.8.8 valid=300s;
}
# Redirect HTTP → HTTPS
server {
listen 80;
server_name imcseian.com;
return 301 https://$host$request_uri;
}
Testing Your TLS Setup
Two free tools every security engineer should bookmark:
- SSL Labs SSL Test — the gold standard. Aim for A+ rating.
- Mozilla Observatory — tests headers, CSP, HSTS, etc.
🎯 Key Takeaways
- HTTPS = HTTP over TLS. Provides confidentiality, integrity, and authentication.
- TLS handshake: client/server agree on cipher, exchange keys, encrypt traffic.
- Forward secrecy (ECDHE) — even if private key leaks, old traffic stays encrypted. Required in 2026.
- TLS 1.3 (2018) is faster, more secure, mandatory for new apps. TLS 1.0/1.1 must be disabled.
- Let's Encrypt: free 90-day certs with auto-renewal. Use certbot.
- Always add HSTS header to force HTTPS. Submit to preload list for browser-level protection.
- Test at ssllabs.com/ssltest/ — aim for A+ rating.
Comments
Comments
Post a Comment