Guides / Web servers and domains

TLS certificates: automatic renewal with ACME and monitoring expiry

beginnerUpdated 27 Nov 20261065 words

With certificate lifetimes of 47 days from 2029, renewal by hand is no longer workable. ACME clients renew automatically; monitor the expiry dates as well, because renewal can fail.

Certificate lifetimes

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. The opt-in tlsserver profile issues 45-day certificates from 2026-05-13; the default classic profile 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 you do not monitor expiry yourself, nobody tells you.

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:

Challenge What the client does Notes
HTTP-01 serves a token at http://<domain>/.well-known/acme-challenge/ port 80 must be reachable
TLS-ALPN-01 answers a special TLS handshake on port 443
DNS-01 publishes a TXT record at _acme-challenge.<domain> works for wildcard certificates and for servers the internet cannot reach; the client needs an API token for your DNS provider

Caddy

Caddy obtains and renews certificates for every site in its configuration without further setup.

certbot

On Debian and Ubuntu, the certbot package 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 server

On Debian 12 (certbot 2.1.0) the timer has OnCalendar=*-*-* 00,12:00:00 with 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. The certbot snap installs snap.certbot.renew.timer, and the EPEL package on the RHEL family certbot-renew.timer; systemctl list-timers '*certbot*' finds either.

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: --deploy-hook "systemctl reload nginx" when you first request the certificate, or a script in /etc/letsencrypt/renewal-hooks/deploy/. certbot runs only the executable files there, so chmod +x the script.

Other clients

Traefik, acme.sh, lego and the ACME support of most hosting panels use the same protocol and challenges.

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 can fail without anyone noticing: a DNS token expired, a new firewall rule closed port 80, or the deploy hook failed and the server still sends 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. On a 90-day schedule, a certificate with less than 21 days left 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 fill in a missing intermediate from their cache; curl, other programming languages and older devices do not. Check with a client that does not:

echo | openssl s_client -connect example.com:443 -servername example.com -verify_hostname example.com \
  -verify_return_error 2>&1 | grep -E 'Verify return code|verify error'

A good chain gives Verify return code: 0 (ok). 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 means the certificate does not cover the name you connected to; without -verify_hostname, openssl s_client does not compare the names and reports 0 (ok).

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 other CAs refuse, for example when an attacker tricks a different CA into issuing:

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 any CA, the third asks CAs to report refused requests. If you use a wildcard certificate, leave out the second line or name the CA in it (issuewild "letsencrypt.org"); with ";", its next renewal fails. 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, to see certificates you did not request.

Sources

Check your servers every day

The Vulnpocalypse collector reports the packages and settings of a server once a day, and the digest lists what to fix, most urgent first.

Start free