A monitoring alert fires that a certificate expires in seven days. You log in, run the renewal by hand, and it succeeds. Two months later the same alert fires for the same domain. “Let’s Encrypt is flaky” is rarely the right conclusion — the renewal job has been failing every night for weeks, and nobody noticed because the cron output goes to a mailbox nobody reads.
What’s happening
Let’s Encrypt renewals fail for a small number of recurring reasons: the HTTP-01 challenge can’t be served because a CDN or WAF is intercepting /.well-known/acme-challenge/, the DNS-01 challenge can’t update the TXT record because the API token expired or the zone moved, a CAA record was added that doesn’t include letsencrypt.org, or the renewal hook fires but the resulting cert is never reloaded by nginx/Apache. The certbot exit code tells the truth; the cron mail telling you it failed is usually being dropped silently.
How to verify
Run the renewal in dry-run mode and read the output:
certbot renew --dry-run -v 2>&1 | tail -40
Confirm the challenge path is reachable from the public internet — not from the origin:
curl -sI https://example.com/.well-known/acme-challenge/test-file
Check the CAA record actually allows the issuing CA:
dig +short CAA example.com
Inspect what cert is currently being served, and when it expires:
openssl s_client -connect example.com:443 -servername example.com </dev/null 2>/dev/null \
| openssl x509 -noout -dates -issuer
If notAfter doesn’t move forward after a renewal claims success, the cert was issued but the web server never picked it up.
The fix
- If the HTTP-01 challenge is being intercepted by Cloudflare, add a page rule or Configuration Rule that bypasses cache, WAF, and any redirect on
/.well-known/acme-challenge/*. Or switch to DNS-01 with an API token scoped to the zone. - If a CAA record exists, add
0 issue "letsencrypt.org"(and0 issuewild "letsencrypt.org"if you renew wildcards). - Make sure the renewal hook actually reloads the service:
certbot renew --deploy-hook "systemctl reload nginx". - Route the cron output somewhere a human reads — a Slack channel, a monitoring webhook, anywhere except
root@localhost.
Once those four are in place, the 30-day renewal runs unattended and you stop being paged at day seven.
Stack Harbor owns certificate lifecycle as part of Monitoring & Support. If you’re getting woken up by expiring certs, book a review.