Capture the public leaf from the intended hostname and port, then run openssl x509 -noout -enddate. To test a seven-day expiry window, run openssl x509 -checkend 604800 on that same leaf and inspect the exit status.
Capture the leaf from the endpoint
- Connect with the intended hostname
For an HTTPS service you operate, run openssl s_client -connect tls.example.com:443 -servername tls.example.com -showcerts </dev/null. Use the actual hostname and port. Retain the output from that connection.
- Read the dates and fingerprint
Save the first PEM certificate from the list as observed-leaf.pem. Run openssl x509 -in observed-leaf.pem -noout -dates -sha256 -fingerprint. Record the target, fingerprint, observation time and notAfter value.
- Check the planned expiry window
Run openssl x509 -in observed-leaf.pem -noout -checkend 604800. This tests the next seven days against the local clock. Confirm that the certificate parsed successfully before interpreting a nonzero exit as an expiry result.
Compare expiry evidence after renewal
| Result | Next check |
|---|---|
| Local file and public leaf have the same new SHA-256 fingerprint | Record the observed deployment for that connection. Recheck the other termination points covered by the rollout. |
| Local file expires later than the served leaf | Identify the public termination point and inspect its certificate attachment, deployment hook or reload. |
| Different addresses return different dates | Keep each observation separately. Check whether a proxy, load balancer or CDN has multiple active certificate versions. |
| The connection returned no parseable leaf | Record the check as failed and diagnose the connection before interpreting certificate expiry. |
Choose an alert window for the service
Choose a window that gives the owner time to investigate, reissue and deploy before the leaf expires. A seven-day window is a test example. Services with slow approvals or externally managed termination may need more time.
Store the most recent usable result and its age. A timeout after an earlier pass calls for another observation. Check intermediate certificates under the client trust policy when the issue is path validation.
Frequently asked questions
What does notAfter mean in OpenSSL output?
It is the certificate's end of validity. In OpenSSL date output, check the printed time zone and use the exact time when comparing it with your alert window.
Can I check expiry using the certificate file on disk?
Yes. Run openssl x509 -in file.pem -noout -enddate. Inspect the live endpoint separately to determine whether its leaf is the same certificate.
Does a certificate with time left pass client validation?
Expiry is one validation input. Check hostname, trust path and the client's other requirements for the actual connection.