Stop fighting with ‘SSL handshake failed’ errors
Networking & Firewall (Ss/Netstat/Iptables/Nftables/Curl)
Stop fighting with ‘SSL handshake failed’ errors
🧩 The Challenge
You’re staring at an error message: ‘SSL handshake failed’ or ‘certificate validation error’. It’s coming from your application talking to another service, or maybe just curl from a new server. Browsers load it fine, but your backend or client keeps throwing a fit. Nobody tells you this when you’re starting out, and I’ve wasted *hours* trying to debug these blind. You just need to know if the remote server is actually sending a valid cert chain, or if your local trust store is the one being a jerk.
💡 The Fix
There’s a set of curl flags that’ll make it spit out the whole TLS handshake, including every detail of the server’s certificate and why curl is trusting (or not trusting) it. You’ll instantly see if the server presented a stale or incorrect cert, or if your client just doesn’t like the CA.
curl -vvv --show-error https://your-broken-service.com/some/path
⚙️ Why It Works
Adding -vvv makes curl incredibly verbose, printing out each step of the TLS negotiation. You’ll see the full certificate chain presented by the server, details about its issuer, subject, and validity dates. –show-error is a lifesaver; it guarantees curl prints a clear message if it bails out early due to a problem, instead of just an exit code.
🚀 Pro-Tip: Testing a specific backend behind a load balancer, or dealing with DNS caching? Use –resolve “your-broken-service.com:443:1.2.3.4” to force curl to connect to a specific IP, while still using the correct hostname for TLS validation.
Linux Tips & Tricks | © ngelinux.com | 11/24/2026
