Skip to content
7LayerX

Security / Field note

Troubleshoot SSL/TLS handshake failures

Find common TLS handshake problems with OpenSSL, curl, and DNS checks, then learn what each result can tell you.

7LayerX Editorialupdated 4 min readOpenSSLcurlDNS

A TLS handshake can fail before a website loads. Start by checking the exact hostname, certificate, TLS version, and application protocol. A command-line result is evidence about one client and one connection; it may differ from a browser or another network.

Common causes

What you seeWhat to check
The certificate is expired or not yet validCheck certificate dates and the device clock.
The certificate name does not matchCheck the requested hostname, SNI, and the certificate names.
The certificate is not trustedCheck the full certificate chain and the client trust store.
The client and server cannot agree on a TLS version or cipherCompare the client offer with the server settings. Do not re-enable obsolete protocols as a quick fix.
TLS connects but the application protocol is unexpectedCheck ALPN, such as h2 or http/1.1.
Some clients work and others failCompare client versions, trust stores, middleboxes, DNS answers, and server endpoints.

Revocation checking is not identical in every client. Some clients use OCSP, stapled status, CRLs, or local policy; others may not have current status information. Treat a revocation result as client- and policy-dependent.

Inspect the negotiated handshake and certificate chain

Replace example.com with a hostname you are allowed to test. -servername sends SNI so a server that hosts multiple sites can choose the intended certificate.

openssl s_client -connect example.com:443 -servername example.com -showcerts

Look for the negotiated protocol, cipher suite, certificate chain, and verification result. A successful chain check does not always mean the command checked the requested hostname. To request hostname verification, add -verify_hostname:

openssl s_client -connect example.com:443 -servername example.com -verify_hostname example.com -showcerts

Check certificate dates and identity

This command prints the certificate subject, issuer, and validity dates:

openssl s_client -connect example.com:443 -servername example.com 2>/dev/null | openssl x509 -noout -dates -subject -issuer

Check notBefore and notAfter. To verify the hostname, use the -verify_hostname option shown above. Do not rely on the certificate subject line alone; modern hostname checks use the Subject Alternative Name (SAN) extension.

BadSSL provides public test hostnames such as expired.badssl.com, wrong.host.badssl.com, and self-signed.badssl.com. Use them only as diagnostic examples and check their current behavior before relying on a specific result.

curl -vI https://wrong.host.badssl.com/
curl -vI https://expired.badssl.com/

Compare TLS versions

Use these commands to ask the server for a TLS 1.3 or TLS 1.2 connection:

openssl s_client -connect example.com:443 -servername example.com -tls1_3
openssl s_client -connect example.com:443 -servername example.com -tls1_2

If one works and the other does not, check server policy, client support, and any middleboxes in the path. A failure from one command does not by itself identify the cause.

Check ALPN

ALPN selects an application protocol inside TLS. This command offers HTTP/2 and HTTP/1.1:

openssl s_client -connect example.com:443 -servername example.com -alpn h2,http/1.1

The handshake can succeed while the selected protocol differs from what an application expects. Check the negotiated ALPN in the OpenSSL output.

Check DNS before investigating TLS

DNS can send a client to an unexpected endpoint. Compare the answers the client receives:

dig A example.com +short
dig AAAA example.com +short

CAA records publish which certificate authorities are allowed to issue certificates for a domain:

dig CAA example.com +short

HTTPS records can publish service connection hints, including protocol and Encrypted Client Hello configuration when used. Their presence does not replace TLS certificate checks:

dig HTTPS example.com +short

A steady troubleshooting order

  1. Confirm the hostname and DNS answers.
  2. Test the endpoint with SNI enabled.
  3. Check the certificate dates, hostname, chain, and verification result.
  4. Compare TLS 1.2 and TLS 1.3 support.
  5. Check ALPN and the client’s error message.
  6. Compare the result from another client or network before changing server settings.

Make one change at a time and repeat the same check. Avoid disabling certificate validation or enabling SSL and obsolete TLS versions to make a test pass.

Common questions about TLS troubleshooting

Why does OpenSSL work but my browser still fail?

The browser may use a different trust store, DNS answer, proxy, TLS policy, or hostname check. Compare the exact hostname and network path.

Does “Verification: OK” prove the hostname is correct?

Not always. Ask OpenSSL to check the name with -verify_hostname example.com as well as sending the matching SNI name.

Should I turn off certificate checks to test a service?

No. Use a controlled test certificate or a dedicated diagnostic endpoint. Disabling verification can hide the exact security problem you need to find.

Sources and further reading

Pass it along

Found this useful? Share it.

Choose a platform or copy the direct link.

LinkedInXFacebook

Continue reading

Reader signal

Was this useful?

Your feedback helps shape the next field note and lab.

… views

Views count when this page opens. You can change or remove your vote during this tab session.