π§° Stage 5: Troubleshooting and Advanced Topics¶
π― Learning Objectives¶
By the end of this stage, you will be able to: 1. Systematically troubleshoot HTTPS connection problems. 1. Decode and interpret handshake or negotiation failures. 1. Identify performance issues in HTTP/2 (latency, head-of-line blocking, flow control). 1. Correlate TLS errors with certificate and cipher configurations. 1. Explain the full HTTPS transaction, packet-by-packet, from client to server.
π Suggested Duration¶
1β2 weeks (10β12 hours total) - 4 h theory - 6β8 h hands-on diagnostics
π Section 1: Troubleshooting Methodology¶
π§ Concepts to Learn¶
Always move from Layer 1 upward:
1οΈβ£ Network (IP reachability) 2οΈβ£ TCP (connection handshake) 3οΈβ£ TLS (security handshake) 4οΈβ£ HTTP/2 (application framing)
π§© Flow¶
- Check reachability (ping, traceroute).
- Check TCP connectivity (nc host 443).
- Check TLS handshake (openssl s_client).
- Check HTTP protocol (curl -v --http2).
- Use Wireshark for packet-level inspection.
π Section 2: TLS Handshake Failures¶
π§ Common Errors and Causes¶
| Error | Likely Root Cause | Command to Diagnose |
|---|---|---|
handshake failure |
Cipher/version mismatch | openssl s_client -connect host:443 -tls1_2 |
| certificate expired | Out-of-date cert | openssl x509 -enddate -in cert.pem -noout |
hostname mismatch |
Wrong SAN | openssl s_client -connect host:443 -servername wrong |
unknown CA |
Missing intermediate | openssl verify -CAfile chain.pem server.crt |
alert: bad record mac |
Data corruption or key mismatch | Wireshark β TLS alert |
π§ͺ Lab 1 β Simulate TLS Errors¶
- Run a local HTTPS server with a self-signed cert:
- Connect without trusting the CA:
β Youβll see certificate verify failed.
- Then trust the CA with
--cacertand retry to verify resolution.
π Section 3: HTTP/2 Connection and Negotiation Failures¶
π§ Possible Causes¶
- Server doesnβt advertise ALPN: h2.
- Proxy/firewall strips ALPN or downgrades connection.
- Client forces HTTP/1.1.
- Misconfigured TLS cipher (HTTP/2 forbids some).
π§ͺ Lab 2 β Analyze ALPN¶
β Look for:
If missing, the server or intermediary is disabling HTTP/2.
π§© Tip¶
HTTP/2 requires TLS 1.2+, and certain ciphers (e.g., no CBC).
π Section 4: Performance Analysis¶
π§ Common Symptoms¶
| Symptom | Likely |
|---|---|
| High latency before first byte | Slow DNS, TCP handshake, or TLS handshake |
| Connection resets | MTU issues, firewall, or timeout |
| Slow page load despite low latency | HTTP/1.1 fallback, poor parallelism |
| Uneven performance | Window size misconfiguration, flow-control stalls |
π§ͺ Lab 3 β Measure Timing¶
Use curl to measure connection phases:
Compare with and without --http2.
β Youβll see reduced total time with HTTP/2 due to multiplexing.
π Section 5: Wireshark End-to-End Analysis¶
π§ͺ Lab 4 β Full HTTPS Capture¶
- Start Wireshark, filter:
- Visit https://example.com.
- Identify:
- DNS request/response (UDP 53).
- TCP handshake (SYN, SYN/ACK, ACK).
- TLS handshake (ClientHello β ServerHello).
- ALPN: h2 negotiation.
-
HTTP/2 frames (SETTINGS, HEADERS, DATA).
-
Export TLS session keys from the browser (if supported) to decrypt HTTPS and see HTTP/2 frames decoded.
Example (Firefox/Chrome):
Load /tmp/sslkeys.log in Wireshark Preferences β TLS β (Pre-Master-Secret log file).
β You can now view plaintext HTTP/2 headers.
π Section 6: Certificate Chain and Trust Validation¶
π§ Concepts¶
- The client must build a chain: Server β Intermediate β Root.
- Failure at any link = validation error.
- Browsers maintain trusted root store; CLI tools use system store.
π§ͺ Lab 5 β Chain Inspection¶
β Observe all certificates returned by the server. Then verify:
π Section 7: Mixed Content and Redirect Issues¶
π§ Concepts¶
- HTTPS pages loading HTTP subresources β blocked by browsers.
- HTTP β HTTPS redirects might cause extra round trips.
π§ͺ Lab 6 β Follow Redirect Chains¶
β Observe 301 redirect to https://github.com.
Capture the same in Wireshark to count the number of TLS handshakes.
π Section 8: Advanced Tools¶
| Tool | Purpose |
|---|---|
| curl | Quick diagnostics (-v, --http2, --resolve, --trace-time) |
| openssl | TLS verification, cert chain, ALPN |
| ssllabs.com/ssltest | Public site TLS analysis |
| testssl.sh | Local script for cipher/protocol audit |
| nghttp / h2load | HTTP/2 client testing and benchmarking |
| Wireshark | Packet-level analysis and decryption |
π Section 9: Common Troubleshooting Scenarios¶
| Scenario | Diagnostic Steps | Tools |
|---|---|---|
| Site unreachable | Check IP, DNS | ping, dig |
| TCP connect fails | Port closed/firewall | nc host 443 |
| TLS fails | Wrong cipher, expired cert | openssl s_client |
| HTTP/2 fallback | ALPN missing | curl -v |
| Slow page load | Multiple connections or poor reuse | h2load, Wireshark |
| βUnknown CAβ | Chain incomplete | openssl verify |
π Section 10: Explain and Document¶
π§© Task¶
Write a complete flow explanation:
βWhat happens when you access https://example.com with HTTP/2.β
Include:
- DNS lookup
- TCP handshake
- TLS negotiation (ALPN = h2)
- HTTP/2 streams (HEADERS β DATA β END_STREAM)
- Connection close
Then, describe one failure scenario and the diagnostic steps you would take to resolve it.
π§ Knowledge Check¶
- What is the sequence of layers to check when HTTPS fails?
- How does ALPN affect protocol selection?
- What is the difference between a cipher mismatch and a certificate error?
- How can you decrypt HTTPS traffic in Wireshark for analysis?
- What tools help you test HTTP/2 performance?
π Stage 5 Completion Outcome¶
You should now be able to: β Systematically troubleshoot HTTPS/TLS/HTTP/2 issues from the network up. β Explain the full lifecycle of an HTTP/2 over TLS connection. β Use Wireshark, curl, and openssl to diagnose handshake and ALPN problems. β Interpret timing metrics and optimize web performance. β Document and teach the protocol flow clearly to others.