An HTTPS process can be healthy while the public certificate is close to expiry, issued for the wrong name, or served differently on another edge. A useful check asks the public endpoint for the certificate it would give to a real client.
Include the hostname
TLS virtual hosting depends on the server name. Pass the hostname as SNI and inspect the peer certificate:
host=www.example.test
openssl s_client -connect "$host:443" -servername "$host" </dev/null 2>/dev/null \
| openssl x509 -noout -subject -issuer -dates -fingerprint -sha256
The command is read-only. It does not renew anything and it does not prove that every intermediate certificate is accepted by every client. It does give you the not-before, not-after, subject, issuer, and fingerprint of the certificate presented for that hostname.
Alert on a threshold
Choose a threshold that leaves time for a failed renewal, a DNS problem, and a human response. The exact number belongs to the service’s recovery target; a universal “30 days” rule is not a substitute for that decision. The companion TLS expiry check prints the expiry and exits non-zero when the remaining interval is below the threshold you pass.
Run the check from outside the host when possible. A local process may see a different listener, certificate file, or proxy path than a visitor on the public network.
Sources
- Caddy Automatic HTTPS, checked 2026-08-22.
- OpenSSL
s_clientdocumentation, checked 2026-08-22. - OpenSSL
x509documentation, checked 2026-08-22.