SSL certificate expiry: why sites still go down and how to never miss one

Why certificates still expire with auto-renewal in place, how to check expiry from the command line, and what to monitor so you hear about it weeks early.

Updated · 7 min read

Why certificates still expire

Automatic renewal with Let's Encrypt and managed certificates from cloud providers have made expiry rarer, not impossible. When it happens, browsers show a full-page warning and most visitors leave. Common causes:

  • Renewal works, deployment does not. A new certificate is issued but the server, load balancer or CDN keeps serving the old one until it is reloaded.
  • Validation silently fails. A DNS change, a firewall rule or a redirect breaks the HTTP-01 or DNS-01 challenge, and renewal errors go to a mailbox nobody reads.
  • Forgotten hosts. The marketing site renews; the status page, the old API domain or the regional storefront on a separate server does not.
  • Manually bought certificates. One- or two-year certificates bought by someone who has since left, with the renewal reminder going to their address.
  • Shorter lifetimes. Maximum certificate lifetimes are being reduced step by step, so renewals happen more often and there are more chances for one to fail.

How to check expiry by hand

With openssl, connect to the host and print the certificate's validity dates:

echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null \
  | openssl x509 -noout -dates -subject -issuer

notAfter is the expiry date. Always pass -servername: servers with several certificates choose one based on it, and without it you may be checking the wrong certificate.

To check whether a certificate expires within the next 30 days (2,592,000 seconds), use -checkend; it exits non-zero if it does:

echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null \
  | openssl x509 -noout -checkend 2592000 && echo "OK" || echo "Expires within 30 days"

What else to check while you are there

An unexpired certificate can still fail visitors. While checking expiry, also confirm:

  • The name matches. The certificate covers the exact host, including www and any subdomain you serve.
  • The chain is complete. Missing intermediate certificates work in some browsers and fail in others and in API clients.
  • Old protocols are off. TLS 1.0 and 1.1 should no longer be accepted.
  • The key is strong enough. RSA keys should be at least 2048 bits.
  • HTTP redirects to HTTPS, and HSTS tells browsers to stay there. See our security headers guide.
  • The domain itself is not about to expire. A lapsed domain registration takes everything down with it, certificate included.

What good monitoring looks like

  • Check from outside. Look at what visitors actually receive, not what is on disk. That catches the "renewed but not deployed" case.
  • Check every host. Keep a list of every domain and subdomain you serve, including the forgotten ones.
  • Warn early, then louder. A first warning around 30 days out gives time to fix a broken renewal calmly; an urgent alert at two weeks makes sure it is not ignored.
  • Send alerts to a team channel, not one person's inbox.

A one-page checklist

CheckHealthy
Days until certificate expiryMore than 30
Certificate nameMatches every host served
Certificate chainComplete and trusted
TLS versions1.2 and 1.3 only
RSA key size2048 bits or more
HTTP to HTTPSRedirects, HSTS set
Domain registrationAuto-renew on, not expiring soon

Never miss one again. SonarKite checks your certificates from the outside, warns you 30 days before expiry, sends an urgent alert under 14 days, and watches your domain registration too.

Or let SonarKite run these checks for you.

Every check in this guide runs on its own, on every page, every day. Free for 30 days.