DEV Community

Cover image for Catch an Expired Certificate Before Your Client Hears “Your Website Is Unsafe”
Mira John
Mira John

Posted on Edited on

Catch an Expired Certificate Before Your Client Hears “Your Website Is Unsafe”

A customer opens your client's website and Chrome shows the warning everyone recognises: Your connection is not private.

They take a screenshot and send it to your client. Your client sends it to you. A certificate renewal that should have been routine is now public, embarrassing and urgent.

The certificate warning a client's customer should never be the first to report

Check the certificate customers actually receive from outside the network, alongside the renewal job and deployment hook.

Publicly trusted TLS server certificates issued from 15 March 2026 have a maximum lifetime of 200 days. The cap drops to 100 days on 15 March 2027 and to 47 days on 15 March 2029. The last of the old 398-day certificates run out in April 2027, and after that everybody is on the short schedule whether they planned for it or not.

The CA/Browser Forum approved this schedule in April 2025 in ballot SC081v3. Shorter lifetimes reduce how long a stolen or mis-issued certificate remains valid.

With shorter lifetimes, reliable automatic renewal and deployment matter even more. A successful renewal job is only part of the check: visitors must receive the replacement certificate.

Five ways automated renewal fails quietly

The job stopped running. The server was rebuilt and the cron entry or systemd timer wasn't carried over. The container image was rebuilt without the ACME client. Nothing logs an error, because nothing runs.

The certificate renewed and the server never reloaded. The ACME client wrote new files and exited. nginx, HAProxy or Postfix are still serving the old certificate from memory and will keep doing so until somebody restarts them. The renewal log says success. There is a longer write-up of this one, with the other places an old certificate hides, in renewed the certificate, old one still served.

It renewed on the wrong machine. You renewed on the origin. Visitors talk to a load balancer, a CDN, or the second box in the pool, and each of those has its own copy.

The challenge started failing. A firewall rule now blocks port 80. The DNS API token used for DNS-01 was rotated. Someone added a CAA record that doesn't include your CA. More frequent renewals make a broken validation path more urgent.

The validation expired. The same ballot shortens how long a CA may reuse a domain validation, down to 10 days by 2029. Setups that leaned on a long-lived validation will have to prove control again at nearly every renewal.

These failures affect different stages of renewal and deployment. Reading the certificate served to visitors confirms which certificate is active on that endpoint.

Check the certificate visitors receive

Connect the way a browser does and read what comes back:

echo | openssl s_client -connect www.example.com:443 -servername www.example.com 2>/dev/null \
  | openssl x509 -noout -issuer -serial -enddate
Enter fullscreen mode Exit fullscreen mode

Keep the -servername. Without SNI, a server that hosts several sites hands you its default certificate, which may not be the one you think you're checking.

Run that on a schedule, from a machine that is not the one doing the renewing, for every hostname that answers on 443. example.com and www.example.com can serve different certificates. So can api., mail. and whatever sits behind your CDN. If a disk fills up on the box that renews, you don't want the warning to live on the same disk.

If you want to spot-check a hostname without a terminal, this SSL certificate checker makes the same connection and shows the expiry, days left, issuer, serial and fingerprint.

How early to warn

A fixed 30-day warning can trigger before a healthy short-lived certificate reaches its scheduled renewal. Set the threshold against your actual renewal window.

Work backwards from the renewal point instead. If your client renews with a third of the lifetime left, a healthy 47-day certificate never drops below about 15 days remaining. A first warning at 14 days then means "renewal should have happened by now and didn't". After that you want reminders that get harder to ignore, and a final one that means a person has to act today. I settled on 14, 7, 3 and 1.

Two more rules kept the noise down for me, the same way they did for DNS records in the seven false alarms post. A new serial with a later expiry is a renewal, so it goes on a timeline and nobody gets an email. A new serial with an earlier expiry does get an email, because that usually means someone installed the wrong file.

Follow the failure to the repair

Where this fits

Certificate expiry is one of four things I watch per domain in DNS Notify, next to DNS records, nameservers and the registration. Its SSL certificate expiry monitoring reads the certificate served on port 443 and tracks the dates, issuer, key and fingerprint. Ongoing checks make a missed renewal visible before the expiry date.

Certificates also fail for DNS reasons. A CAA record that blocks your CA and a broken _acme-challenge CNAME are both DNS changes, which is part of why the two live in one product. I covered the email equivalent of this, records that break without anyone noticing, in the four records that break mail while your site stays up.

If you do one thing this quarter, list every hostname you serve over HTTPS and check that each one is renewed by a machine, reloaded by a hook, and read from outside by something that will tell you when the first two stop working.

Top comments (0)