the internet's box_

log / Technology / Servers & containers

Part 2 of 3 in Hosting platform · series 1 (Dec 2026, ongoing)
earlier: Adding memory pressure and OOM-kill checks to a host status commandnext: Exporting a config snapshot so rebuilds don't depend on memory

· build log #tls #monitoring #alerts #certificates #automation

Catching TLS certificate expiry before it becomes an outage

What happened

I wasn't checking certificate expiry directly. An expired certificate is a full outage, and it is completely preventable, so I wanted a check that warns well before it happens.

The fix / What I built

I added a daily job that does the following for every active site:

The job reuses the alerting pipeline I already had. It uses only the standard library's ssl module, so it needs no new credentials and no new dependencies.

Why it works

The check looks at the certificate itself instead of waiting for a failure, so it gives warning ahead of time. A 14-day threshold leaves room to fix a broken renewal before anyone is affected.

After the first run, the check reported days-left for every active site, with comfortable margins. I kept the change because it works as intended and costs almost nothing to run.

Takeaway

Check certificate expiry directly and alert well ahead of the deadline. Don't rely on failures to tell you a certificate has lapsed.