Payments are experiencing issues due to temporary restrictions in Russia. If your payment does not go through, please submit a support request.Our support team is available 24/7 — we are always here to help with hosting and server issues.We are now accepting requests for dedicated server rental and colocation services in our data center.Reminder: we recommend enabling backups for additional data protection.A new VPS/VDS lineup with NVMe storage and improved performance is now available.Maintenance work on some servers has been completed. All services are operating normally.
Article3 min readViews2

How to Check Certificate Expiry and HTTPS Chain via OpenSSL

We separately verify the local certificate and what the server actually serves: validity period, hostname, and chain trust require distinct checks.

Padlock on a closed server cabinet
In this article

The certificate looks fresh in the control panel, yet the browser still reports an HTTPS error. The updated file may not have been uploaded to the web server, a different node might be checked, or an intermediate certificate may be missing. First, separate the two tasks: reading the local file and verifying the active connection.

Read the local certificate

Examples are calculated for OpenSSL 3.x. The file certificate.pem is a placeholder name for a public certificate in PEM format, not a private key. Substitute the path to your own file, which must be readable.

openssl x509 -in certificate.pem -noout -subject -issuer -dates

The command displays the owner, issuer, and dates. This does not verify which certificate the site currently serves. Successfully reading the file also does not guarantee that the chain is trusted or that the site name matches.

To check if the certificate expires within the next seven days:

openssl x509 -in certificate.pem -noout -checkend 604800

The number is specified in seconds. A non-zero result from this check requires investigating the message and exit code; in a script, do not hide file read errors under a generic expiry notification.

Check the actual server

Enter the domain name without protocol and path:

read -r TARGET_HOST

printf '' | openssl s_client -connect "${TARGET_HOST}:443" -servername "$TARGET_HOST" -verify_hostname "$TARGET_HOST" -verify_return_error -showcerts

The server name parameter is required for SNI, and a separate name check matches the certificate to the expected node. Error return mode prevents a connection resumed after a check error from being treated as proof of trust.

The utility uses the trusted certificate authorities available to it. This set may differ from the browser or corporate store. Save the OpenSSL version and the exact error text. For a private trust center, correct configuration is required, not disabling certificate checks.

What the certificate list means

The output certificates are what the server sent. The mere presence of a list does not prove the chain is built and verified. Review the check result and consider the node name, validity periods, and the trusted store.

If a CDN or load balancer stands in front of the site, you are checking the public node of that chain. The local certificate on the origin server may be different. This is acceptable in some schemes but must align with the configuration of the entire connection chain.

Analyze the discrepancy

Example: the local file is already new, but the remote server returns old dates. Check whether the service uses the correct path, whether the configuration has been applied, and whether all serving nodes have been updated identically. A single successful response from a load balancer does not rule out an outdated certificate on another node.

The private key is not needed for these checks and must not appear in the report. Record the name, expiration date, issuer, chain verification result, and connection endpoint. After fixing the issue, repeat the connection check and open the site with a standard client. A valid local file is only part of the result; the user cares about the certificate received during a real HTTPS session.

Validity period checks depend on correct system time. If you encounter an unexpected result, first compare the machine's time with a trusted source.

Discussion 0

Share your experience and ask questions. Comments without links appear after editorial review.

No comments yet. Start the discussion.