Lion Cipher Lab

Monitor TLS certificate expiry with a Python script

Why it matters

Expired TLS certificates are one of the most common self-inflicted outages in the industry: the certificate that encrypts your site silently reaches its 'not after' date, every browser starts throwing a full-page security warning, customers can't reach you, and the fix is trivial but the clock already ran out. The renewal reminder the certificate authority emailed went to an inbox nobody reads. Reading one certificate by hand with openssl doesn't scale to the dozens of hostnames a real environment runs. This lab gives you the at-scale, automated version: a short Python script that checks the…

What you'll learn

Steps in this lab

  1. Why automate this at all — the point before the code
  2. Confirm Python 3 is installed — nothing else to install
  3. The manual way first — and why it doesn't scale
  4. Write the script — a TLS expiry checker in the standard library
  5. Run it and read every line of output
  6. Handle the real-world failures — a monitor must not crash on one bad host
  7. Schedule it so it runs itself
  8. Why this, not that — and when NOT to lean on it
  9. The way a pro does it — and the security angle

Open the full interactive lab →