devsecurity

SSL/TLS certificate check: expiry, chain and hostname

Updated

A broken certificate stops visitors at a full-page browser warning. Most failures are easy to prevent when you know what to look at.

What to check

Validity dates: the certificate must be inside its notBefore and notAfter window. Renew at least 30 days before expiry.

Hostname match: the name visitors use must appear in the certificate's Subject Alternative Names.

Complete chain: the server must send the intermediate certificates, not only its own.

Strong signature and key: SHA-256 or better, and an RSA key of at least 2048 bits (or an ECDSA P-256 key).

Protocol versions: allow TLS 1.2 and TLS 1.3. TLS 1.0 and 1.1 were formally deprecated in RFC 8996.

Check it with OpenSSL

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

To see the chain the server actually sends:

openssl s_client -connect example.com:443 -servername example.com -showcerts </dev/null

The usual failures

Expired certificate: automate renewal with an ACME client such as certbot and alert when fewer than 30 days remain.

Incomplete chain: desktop browsers may cope, but apps, APIs and older clients fail. Configure the full chain file.

Hostname mismatch: the certificate covers example.com but not www.example.com, or the reverse.

Legacy protocols: disable TLS 1.0 and 1.1 in your web server or load balancer.

When a certificate authority has an incident

If a CA is distrusted or a certificate is mis-issued, browsers can stop trusting certificates from that chain. devsecurity compares your chain with the CA events it tracks and reports one of four states: not affected, potentially affected, confirmed affected, or unable to determine. An issuer match alone is never reported as a compromise.

Frequently asked questions

How far ahead should I renew a certificate?

At least 30 days before expiry, and ideally automatically. Short-lived certificates from ACME providers renew on a schedule.

Is TLS 1.0 still acceptable?

No. TLS 1.0 and 1.1 are deprecated (RFC 8996) and fail modern compliance checks. Allow TLS 1.2 and 1.3.