SSL certificates don't fail loudly, until the day they do

An expired certificate takes a working website offline in a single second. How renewals break, how to check expiry from the terminal, and what to monitor so it never surprises you.

AskMyServers team · · 2 min read

An expired certificate is one of the strangest outages you can have. Your server is fine. Your code is fine. The database is fine. And every visitor sees a full-page browser warning telling them your site might be trying to steal their information.

The certificate didn't break. It just reached a date that was printed on it the day it was issued.

"But we use Let's Encrypt, it renews itself"

It does, usually. Automatic renewal is one of the best things to happen to the web. But "automatic" has a way of turning into "nobody's watching", and renewals fail more often than people expect:

  • The renewal runs from a timer or cron job that was lost when the server moved.
  • A firewall or redirect change blocks the HTTP challenge Let's Encrypt uses to check you own the domain.
  • DNS for the domain moved to a new provider and the validation no longer passes.
  • The certificate renews fine, but the web server was never reloaded, so it keeps serving the old one.
  • The certificate is on a load balancer, CDN or appliance that doesn't use your renewal setup at all.

That fourth one is sneaky. The new certificate is sitting on disk and every check of the files says you're fine, while users still get the old one.

Check what users actually see

Don't check the file. Check the live connection, the same way a browser does:

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

notAfter is the date that matters. If you run certbot, you can also test the whole renewal without changing anything:

sudo certbot renew --dry-run

If the dry run fails, you've found next month's outage while it's still just a log message.

Don't forget the domain itself

Certificates get the attention, but domain registrations expire too, and that's worse: when a domain lapses, your website, email and API can all disappear together. Registrars send reminders, but they tend to go to whoever bought the domain years ago, at an address that may no longer exist.

What to monitor

For every public hostname you care about, you want to know:

WhatWhy
Days until the certificate expiresThe main thing
Who issued itSpots a surprise switch of provider
Whether it matches the hostnameCatches the wrong certificate being served
Domain registration expiryThe outage nobody thinks about

In AskMyServers, the SSL page checks each domain's live certificate every six hours and its registration expiry once a day. Certificate reminders go out 14, 7, 3 and 1 days before expiry (you can start them earlier per domain), and domain registration reminders at 30, 15, 7 and 1 days, by email, Slack or Teams. An incident is opened when either gets close.

A habit worth having

Even with monitoring, keep a short list somewhere of every domain you own, where it's registered, and how its certificate gets renewed. When something does go wrong at an awkward hour, that list saves a lot of guessing.

Monitor your certificates for free

SSL certificates don't fail loudly, until the day they do · AskMyServers