Guides / Web servers and domains
TLS certificates: automatic renewal with ACME and monitoring expiry
An expired certificate takes a site offline as surely as a crashed server: browsers show a full-page warning and API clients refuse to connect. Certificate lifetimes are getting shorter every year, so manual renewal stops being an option. Automatic renewal with ACME avoids expired certificates, as long as you also watch the expiry dates yourself.
Lifetimes are getting shorter
- The CA/Browser Forum, which sets the rules for publicly trusted certificates, adopted ballot SC-081 in April 2025. It reduces the maximum validity in steps from 398 days, starting in March 2026, to 47 days in March 2029, and shortens how long a domain validation may be reused.
- Let's Encrypt issues 90-day certificates and is cutting them to 45 days. Its schedule: the opt-in
tlsserverprofile issues 45-day certificates from 2026-05-13; the defaultclassicprofile moves to 64 days on 2027-02-10 and to 45 days on 2028-02-16. The time a domain validation can be reused drops from 30 days to 7 hours by 2028. - Let's Encrypt stopped sending expiry reminder e-mails on 2025-06-04. If nobody monitors expiry, nobody is told.
With 45-day certificates, a client that renews 30 days before expiry renews every two weeks; one that renews at a fixed 60-day interval never renews in time.
How ACME renewal works
ACME (RFC 8555) is the protocol between your server and the certificate authority. The client proves control of the domain with a challenge:
- HTTP-01: serve a token at
http://<domain>/.well-known/acme-challenge/. Needs port 80 reachable. - TLS-ALPN-01: answer a special TLS handshake on port 443.
- DNS-01: publish a TXT record at
_acme-challenge.<domain>. Works for wildcard certificates and servers that are not reachable from the internet, but the client needs an API token for your DNS provider.
Common clients:
-
Caddy obtains and renews certificates for every site in its configuration without any setup.
-
certbot on Debian and Ubuntu installs a systemd timer that runs twice a day:
systemctl list-timers certbot.timer sudo certbot certificates # names, domains, expiry dates sudo certbot renew --dry-run # test renewal against the staging serverOn Debian 12 (certbot 2.1.0) the timer has
OnCalendar=*-*-* 00,12:00:00with a random delay of up to 12 hours. Certbot 4.0.0 in Debian 13 can choose a Let's Encrypt profile with--preferred-profile. -
Traefik, acme.sh, lego and the ACME support of most hosting panels work the same way.
After renewal, the web server has to load the new certificate. Caddy does this itself. With certbot and nginx, add a deploy hook that reloads nginx, for example --deploy-hook "systemctl reload nginx" when you first request the certificate, or a script in /etc/letsencrypt/renewal-hooks/deploy/.
Let's Encrypt recommends ACME Renewal Information (ARI), with which the CA tells the client when to renew; check whether your client supports it. Without ARI, renew when about a third of the lifetime remains.
Monitor expiry yourself
Renewal fails silently more often than it should: a DNS token expired, port 80 was closed by a new firewall rule, the deploy hook failed and the server still serves the old certificate. Check the certificate the server sends, from outside:
host=example.com
echo | openssl s_client -connect "$host:443" -servername "$host" 2>/dev/null | openssl x509 -noout -enddate
notAfter=Dec 26 02:59:11 2026 GMT
-checkend turns that into a test for scripts and cron jobs; it takes a number of seconds:
echo | openssl s_client -connect "$host:443" -servername "$host" 2>/dev/null \
| openssl x509 -noout -checkend $((21*86400)) || echo "$host: certificate expires within 21 days"
Run it daily for every host name you serve, including mail (-connect mail.example.com:465, or -starttls smtp on port 587) and API endpoints. Alert at 21 days and again at 7. A certificate with less than 21 days left on a 90-day schedule means renewal has failed at least once.
Check the chain
A server must send its own certificate and the intermediate certificates up to a root the client trusts. Browsers often repair a missing intermediate from their cache; curl, other programming languages and older devices do not. Check with a client that does not repair:
echo | openssl s_client -connect example.com:443 -servername example.com -verify_return_error 2>&1 \
| grep -E 'Verify return code|verify error'
Verify return code: 0 (ok) is what you want. unable to get local issuer certificate usually means the server sends only its own certificate: configure the full chain file (fullchain.pem with certbot). Hostname mismatch errors mean the certificate does not cover the name you connected to.
Restrict who may issue: CAA
A CAA DNS record (RFC 8659) names the certificate authorities that may issue for your domain. Authorities must check it before issuing, so it blocks issuance by any other CA, for example after an attacker tricks a different CA:
example.com. CAA 0 issue "letsencrypt.org"
example.com. CAA 0 issuewild ";"
example.com. CAA 0 iodef "mailto:security@example.com"
The first line allows Let's Encrypt, the second forbids wildcard certificates from anyone, the third asks CAs to report refused requests. Check with dig +short CAA example.com. If you use several CAs (a CDN often uses its own), list each of them.
Watch what gets issued
Every publicly trusted certificate is logged in Certificate Transparency logs. Search them for your domain at https://crt.sh/?q=example.com, or subscribe to a monitoring service, and you see certificates you did not request.
Sources
- CA/Browser Forum Ballot SC-081v3 (398 to 47 days, March 2026 to March 2029, voting results)
- Let's Encrypt: Decreasing Certificate Lifetimes to 45 Days (profiles, dates, authorization reuse, ARI, renewal at two thirds of the lifetime)
- Let's Encrypt: Ending Support for Expiration Notification Emails (2025-06-04)
- RFC 8555: ACME and RFC 8659: CAA
- certbot documentation (renewal, hooks)
- certbot 2.1.0 timer read in
debian:bookworm-20261027-slim, certbot 4.0.0 options indebian:trixie-20261123-slim, OpenSSL commands tested against a test nginx, all on 2026-11-26
Check your servers every day
The agent of Patchbrief reports the packages and settings of a server once a day; the digest names what to fix first.