How to Check SSL Certificate Expiration
Published:
A certificate file can be current while a proxy still serves an older certificate. Check both the file you intend to deploy and the certificate presented by the endpoint. The examples below inspect public certificates; a private key is not needed.
Read a local PEM certificate
Open the SSL certificate decoder, paste one PEM certificate including its BEGIN CERTIFICATE and END CERTIFICATE boundaries, and select Decode certificate. Review its subject, issuer, validity period and SHA-256 fingerprint.
For the same inspection in a terminal, save the public certificate as certificate.pem and run:
openssl x509 -in certificate.pem -noout -subject -issuer -dates
openssl x509 -in certificate.pem -noout -fingerprint -sha256
notBefore is the start of the validity interval; notAfter is its end. Read the timezone in the output rather than assuming local time. The OpenSSL x509 documentation describes these fields and fingerprint options.
Check an upcoming renewal window
Thirty days is 2,592,000 seconds. This command tests whether the certificate expires within that interval:
openssl x509 -in certificate.pem -noout -checkend 2592000
A successful check returns zero when expiry is outside the window; imminent expiry returns nonzero. Parsing and file errors can also fail the command, so inspect diagnostics before labeling every failure as an expiration event. This check alone does not prove that a certificate is already valid or trusted.
Inspect what an endpoint presents
From a machine allowed to reach your own TLS endpoint, substitute its hostname in both places:
openssl s_client -connect example.com:443 -servername example.com -showcerts </dev/null
The explicit server name requests the intended virtual host through SNI. Save the first presented certificate’s complete PEM block and inspect it with the previous commands. The s_client reference explains the diagnostic options. Its output should not be treated as a successful trust decision merely because a handshake printed certificates.
Investigate a file and endpoint mismatch
- Compare the SHA-256 fingerprint of the local file with the served leaf certificate.
- Check that the TLS listener references the renewed file and has reloaded it.
- Inspect each relevant proxy or load-balancer endpoint if multiple machines terminate TLS.
- Repeat from the client path that originally reported the problem.
Validity dates are only one part of TLS validation. Hostname matching, the trust chain, signatures and revocation policy remain separate checks. The FATOPS decoder neither contacts a hostname nor verifies trust; it explains the public certificate you supplied. Use it to inspect evidence, then verify the deployed service with your normal TLS client and monitoring.