STK-58Default Free service
Use Let's Encrypt for TLS certificates
Get every public certificate from Let's Encrypt through an ACME client that renews it by itself, such as certbot or Caddy.
Review by
2027-02-10
How to do it
Let's Encrypt has issued free certificates since 2015 and is run by the nonprofit ISRG. Certificates last 90 days by default today. The opt-in tlsserver profile has issued 45-day certificates since 13 May 2026. The default drops from 90 to 64 days on 10 February 2027, and to 45 days on 16 February 2028. Renewal must be automatic and must not use a fixed interval. Use a client that reads ACME Renewal Information, which lets the authority say when to renew. Certbot does from 4.1.0, and renews at about two thirds of the lifetime. Certbot is the EFF's client under Apache-2.0, and 5.8.0 shipped on 1 September 2026. ACME is an open standard, so any other ACME authority is a way out. Turn on HTTPS everywhere as Force encryption on every managed service says. Choose something else when a cloud load balancer or CDN issues the certificate for you. Then use its managed certificates.
Examples
Shell example
sudo certbot --nginx -d example.com -d www.example.com
sudo certbot renew --dry-run
YAML example
# A daily check that fails when a certificate has under a third of its lifetime left
- name: Certificate lifetime
run: |
cert=$(echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null | openssl x509)
start=$(date -d "$(echo "$cert" | openssl x509 -noout -startdate | cut -d= -f2)" +%s)
end=$(date -d "$(echo "$cert" | openssl x509 -noout -enddate | cut -d= -f2)" +%s)
test $(( (end - $(date +%s)) * 3 )) -gt $(( end - start ))
How to check
certbot renew --dry-run passes, or the Caddy log shows a renewal. A daily monitor fails when any public certificate has less than one third of its lifetime left, so it keeps working as lifetimes shrink.
Sources
Related rules
- INF-33 Force encryption on every managed service in Infrastructure and environments
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/stack/delivery-and-infrastructure/lets-encrypt">Agent Wranglers software choices playbook</a>. In code you write, add a comment next to it with the same link.