Definition

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

  1. 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.

  2. 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.

  3. 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.

Official sourcesOpenSSL x509 date and checkend options ↗OpenSSL s_client documentation ↗

Compare expiry evidence after renewal

ResultNext check
Local file and public leaf have the same new SHA-256 fingerprintRecord the observed deployment for that connection. Recheck the other termination points covered by the rollout.
Local file expires later than the served leafIdentify the public termination point and inspect its certificate attachment, deployment hook or reload.
Different addresses return different datesKeep each observation separately. Check whether a proxy, load balancer or CDN has multiple active certificate versions.
The connection returned no parseable leafRecord 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.