How to tell that a certificate renewal failed silently
Automatic renewal works until one day it does not, and nothing tells you. This guide covers the three ways a renewal fails quietly, a check from outside that works whatever client you use, and where to look in certbot, Caddy, Traefik and Nginx Proxy Manager.
Three ways a renewal fails quietly
- The renewal never runs. A timer was disabled, a cron entry got lost when the server was rebuilt, a container restarts without its scheduler, or the site moved to a new machine and the renewal setup stayed on the old one.
- It runs and fails, and nobody reads the log. Validation fails because port 80 is closed or redirected, the API token for the DNS provider expired, a CAA record does not allow the CA, or a rate limit was hit.
- It succeeds, and the server keeps sending the old certificate. The service was never reloaded, the certificate is copied to a load balancer or appliance by hand, or a second server behind the same name renews on its own, or not at all.
The third one is the hardest to spot: the client reports success, and the log looks fine.
Check from outside first
Whatever your client says, what counts is the certificate your server sends. This shows it, with the CA that issued it and when it was issued:
openssl s_client -connect example.com:443 -servername example.com </dev/null 2>/dev/null \
| openssl x509 -noout -issuer -startdate -enddate
notBefore is when the certificate was issued, notAfter when it expires. If more than about two thirds of the time between them has passed, the renewal is late. For a 90-day certificate that is day 60, for a 64-day certificate day 43.
For a mail server, add the protocol: -connect mail.example.com:25 -starttls smtp (or port 587). Ports 465, 993 and 995 speak TLS directly and need no -starttls.
Then compare with the public Certificate Transparency logs, where every public certificate is recorded when it is issued. Search for the name at crt.sh. If the logs list a newer certificate than the one your server sends, the renewal worked and the deployment did not. If the newest certificate in the logs is the one your server sends and it is past two thirds of its life, the renewal itself is failing.
Certbot
certbot certificateslists each certificate certbot manages, with its names and expiry date.systemctl list-timersshows whencertbot.timer(orsnap.certbot.renew.timerfor the snap) last ran and runs next. Without systemd, look for the cron entry, usually in/etc/cron.d/certbot.- Every run logs to
/var/log/letsencrypt/letsencrypt.log. certbot renew --dry-runruns a full renewal against the staging environment without saving anything.- Deployment: with the
--nginxor--apacheplugin, certbot reloads the web server itself. With--webrootor--standaloneit does not know which services use the certificate. Add a deploy hook for each one, for example--deploy-hook "systemctl reload nginx postfix". Deploy hooks run only after a successful renewal. - Timing: certbot 4.0 and later renew when a third of the lifetime is left, and 4.1 and later also follow the CA's renewal window (ARI). Older versions renew 30 days before expiry, and a
renew_before_expirysetting in a renewal configuration file overrides the default.
Caddy
- Caddy renews on its own, by default when about a third of the lifetime is left, and follows the CA's renewal window since version 2.8. It loads the renewed certificate without a restart, so the deployment step rarely fails.
- Renewal errors are in Caddy's log:
journalctl -u caddy, ordocker logsfor the container. - In a container, keep Caddy's data directory (
/datain the official image) on a volume. Without it, every restart starts with no certificates, asks for new ones, and can run into rate limits.
Traefik
- Traefik keeps its certificates in the file set by the resolver's
storageoption, usuallyacme.json. That file has to survive restarts and must be readable by its owner only (chmod 600). - When to renew follows from
certificatesDuration, which defaults to 2160 hours (90 days); with that default Traefik renews 30 days before expiry. That still works for 64-day certificates. If you ask for a shorter profile, setcertificatesDurationto match. - ACME errors are in Traefik's log.
Nginx Proxy Manager
- Nginx Proxy Manager runs certbot inside its container and renews by itself. The SSL Certificates page lists each certificate with its expiry date.
- Failures are in the container log (
docker logswith the container's name). - The usual causes: port 80 not forwarded to the container (needed for HTTP validation), an expired API token for a DNS challenge, or the
dataandletsencryptvolumes not kept across updates.
Get told instead of looking
All of the above is useful when you suspect a problem. To hear about one without looking, combine the client's failure output with one outside check that knows when each certificate should have been renewed. Our guide on what replaces the Let's Encrypt expiry emails compares the options.
TTLwatch does the outside part: it reads the certificate each endpoint sends twice a day, compares it with the CT logs, and alerts once when a renewal is overdue for that certificate's lifetime or a new certificate was never deployed. Internal hosts report through a short shell script.
Sources
- Certbot user guide (renewal, hooks) and the release notes of 4.0 and 4.1 (renewal timing, ARI)
- Traefik documentation, ACME certificate resolvers (
storage,certificatesDuration) - Caddy documentation, automatic HTTPS and global options (
renewal_window_ratio)