Observation and diagnostics · Intermediate

Inspecting TLS with openssl s_client

Align SNI, destination, verification name and trust settings, separating TLS negotiation from certificate validation and application success.

Ask Logeia about this articleTry the three questionsReview your answers

Updated

On this page
  1. Record destination and verification identity separately
  2. Require verification errors to stop the test
  3. Separate the served list from the validation path
  4. Distinguish crypto negotiation from application protocol
  5. Return to the affected client’s conditions
  6. Ask Logeia about this articleCheck your understanding

Record destination and verification identity separately

Openssl s_client is a test tool for inspecting TLS negotiation and certificate information. The TCP destination, server name sent through SNI and identity used for certificate-name verification are related but separate settings. State which is fixed, especially when connecting to an IP while investigating a hostname-based virtual server. Record OpenSSL version, trust-store configuration, current time and any proxy or TLS terminator. A different trust store or route from the affected browser can produce a different outcome. The result should explain one explicit verification context rather than be generalized to every client merely because a command established a connection.

Require verification errors to stop the test

The example connects to example.com on port 443 and uses that name for both SNI and hostname verification. Verify_return_error makes certificate verification errors stop the test instead of merely being displayed. S_client is designed for diagnosis and can otherwise continue negotiation after reporting verification problems. Connected output or a printed certificate is therefore insufficient evidence of successful identity validation. An outer timeout bounds waiting, and closed standard input avoids leaving an interactive session open. The procedure does not report a currently measured certificate or response. Check help and the installed-version documentation for matching options before interpreting an unrecognized setting as a network or TLS failure.

sh
timeout 10s openssl s_client -connect example.com:443 \
  -servername example.com -verify_hostname example.com \
  -verify_return_error -showcerts </dev/null

Separate the served list from the validation path

Showcerts prints the certificate list supplied by the server, not automatically a complete trusted validation path. Inspect the leaf subject alternative names, validity period, issuer and supplied intermediates together with the client trust configuration. A server omitting the root certificate is not by itself a chain defect, while sending a root does not make the client trust it. Distinguish expiration, name mismatch and unavailable trust anchors rather than treating every failure as renewal trouble. Compare the certificate actually served by the terminator with the deployed file, using an appropriate identifier such as a fingerprint. Issuance, installation, selection and delivery are separate stages that can fail independently.

Distinguish crypto negotiation from application protocol

Protocol-version or cipher negotiation problems occur at a different boundary from certificate expiry. An ALPN result identifies a negotiated application protocol but does not establish success of an HTTP business request. Verify TLS establishment, protocol selection and application semantics separately. In mutual TLS, placing a client certificate on the command line does not prove the server requested or accepted it. Use suitable test credentials and a deliberate recording scope when private keys are involved. Revocation or OCSP-related checks also depend on enabled behavior; an ordinary successful connection must not be promoted into proof that every possible validation mechanism ran. Report only the checks supported by the actual settings and result.

Return to the affected client’s conditions

After repair, return to the affected client’s destination, SNI, verification name, clock and trust conditions. With several CDN or load-balancer terminators, one updated endpoint does not establish that every path now serves the intended certificate. Require normal verification and the necessary application response rather than a connection made with validation disabled. Preserve command settings, version, validation outcome, served-certificate identity and later HTTP results separately. Copying certificate text alone does not complete the diagnosis. A useful record explains which identity was accepted under which trust assumptions, making it possible to investigate both expiry and delivery-path regressions without confusing test-tool connectivity with end-user success.

Reading and practice are recorded separately in this browser, for each language.

Learn this in order

Understand the systems behind the web · STEP 10

Choose a learning path