Let's Encrypt - Troubleshooting

๐Ÿ“‹ cheatsheet Certificate $ curl /raw/letsencrypt-troubleshooting.txt

Common Let's Encrypt and Certbot errors with solutions and debugging steps

What is this? Official docs

Free, automated certificate authority providing SSL/TLS certificates for securing websites with HTTPS.

What is Letโ€™s Encrypt?

Letโ€™s Encrypt is a free, automated, and open certificate authority that provides SSL/TLS certificates to enable HTTPS on websites. This guide covers common troubleshooting scenarios and solutions for Certbot and certificate issues.

โšก Key Features

  • Comprehensive error solutions
  • Port and firewall debugging
  • DNS and validation fixes
  • Auto-renewal troubleshooting
  • Certificate verification tools

๐ŸŽฏ Use Cases

  • Fixing issuance failures
  • Resolving renewal errors
  • Debugging validation issues
  • Cloudflare integration
  • Rate limit handling

๐Ÿšซ Troubleshoot - Port 80 in Use

Fix โ€œPort 80 in useโ€ error during certificate issuance.

Find process using port 80:

sudo lsof -i :80

Stop service temporarily:

sudo systemctl stop nginx
sudo certbot certonly --standalone -d example.com
sudo systemctl start nginx

โ˜๏ธ Troubleshoot - Use DNS Challenge

Alternative method when port 80 is unavailable.

sudo certbot certonly --manual --preferred-challenges dns -d example.com

Steps:

  1. Certbot will provide a TXT record
  2. Add TXT record to your DNS
  3. Wait for DNS propagation (1-5 minutes)
  4. Press Enter to continue

๐Ÿ”Œ Troubleshoot - NGINX Plugin Missing

Fix โ€œnginx plugin not installedโ€ error.

sudo apt install python3-certbot-nginx

Verify installation:

certbot plugins

Expected output includes nginx plugin.

โ˜๏ธ Troubleshoot - Cloudflare Error 525

Fix SSL handshake error between Cloudflare and origin.

Solutions:

  1. Set Cloudflare SSL mode to Full (not Full Strict)
  2. Temporarily disable โ€œAlways Use HTTPSโ€
  3. Verify certificate is installed correctly
  4. Check web server is listening on port 443

Check if server is listening on 443:

sudo netstat -tlnp | grep :443

๐Ÿšจ Troubleshoot - Auto-Renew Failing

Debug automatic renewal failures.

Check renewal logs:

sudo cat /var/log/letsencrypt/letsencrypt.log

Test renewal process:

sudo certbot renew --dry-run

โš ๏ธ Troubleshoot - Common Renewal Issues

Common problems preventing auto-renewal.

Checklist:

  • Webroot path changed (check /etc/letsencrypt/renewal/*.conf)
  • Firewall blocking port 80/443
  • DNS records changed or misconfigured
  • Server not reachable from internet
  • Web server stopped or crashed

Check firewall:

# Ubuntu/Debian
sudo ufw status

# RHEL/CentOS
sudo firewall-cmd --list-all

๐Ÿ”’ Troubleshoot - Permission Denied

Fix permission errors when running Certbot.

# Run with sudo
sudo certbot renew

# Check log file permissions
ls -la /var/log/letsencrypt/

# Fix ownership if needed
sudo chown -R root:root /etc/letsencrypt/

๐ŸŒ Troubleshoot - DNS Propagation

Check if DNS changes have propagated.

# Check DNS from multiple locations
dig example.com
dig example.com @8.8.8.8
dig example.com @1.1.1.1

# Check TXT records for DNS challenge
dig _acme-challenge.example.com TXT

โฑ๏ธ Troubleshoot - Rate Limit Exceeded

Handle Letโ€™s Encrypt rate limit errors.

Rate limits:

  • 50 certificates per registered domain per week
  • 5 duplicate certificates per week
  • 300 new orders per account per 3 hours

Solutions:

  • Wait for rate limit reset (weekly)
  • Use staging environment for testing
  • Check existing certificates: sudo certbot certificates

Use staging for testing:

sudo certbot --staging --nginx -d example.com

โ›” Troubleshoot - Certificate Not Trusted

Fix โ€œCertificate not trustedโ€ browser errors.

Check certificate chain:

sudo openssl s_client -connect example.com:443 -servername example.com < /dev/null

Verify using fullchain.pem:

# Correct - includes intermediate certificates
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;

# Wrong - missing chain
ssl_certificate /etc/letsencrypt/live/example.com/cert.pem;

โฐ Troubleshoot - Connection Timeout

Fix timeout errors during validation.

Check server is reachable:

# Test from external server
curl -I http://example.com

# Check DNS resolution
nslookup example.com

# Check if port 80 is open
telnet example.com 80

Common causes:

  • Firewall blocking port 80
  • DNS pointing to wrong IP
  • Server offline or unreachable
  • Reverse proxy misconfigured

๐Ÿ“‚ Troubleshoot - Webroot Path Invalid

Fix webroot validation errors.

Verify webroot path exists:

# Check directory exists
ls -la /var/www/html

# Create .well-known directory
sudo mkdir -p /var/www/html/.well-known/acme-challenge
sudo chown -R www-data:www-data /var/www/html/.well-known

Test webroot manually:

# Create test file
echo "test" | sudo tee /var/www/html/.well-known/acme-challenge/test.txt

# Access from browser
curl http://example.com/.well-known/acme-challenge/test.txt

โŒ Troubleshoot - Challenge Failed

Debug ACME challenge validation failures.

View detailed error:

sudo certbot renew --dry-run --debug

Check challenge type:

  • HTTP-01: Requires port 80 open, webroot accessible
  • DNS-01: Requires DNS TXT record
  • TLS-ALPN-01: Requires port 443 with ALPN support

Switch challenge type:

# Use DNS instead of HTTP
sudo certbot certonly --manual --preferred-challenges dns -d example.com

๐Ÿ”„ Troubleshoot - Revoked Certificate

Handle revoked certificate errors.

Delete revoked certificate:

sudo certbot delete --cert-name example.com

Issue new certificate:

sudo certbot --nginx -d example.com

๐Ÿ“‹ Troubleshoot - Check Certbot Logs

View detailed logs for debugging.

# View main log
sudo tail -100 /var/log/letsencrypt/letsencrypt.log

# Follow log in real-time
sudo tail -f /var/log/letsencrypt/letsencrypt.log

# Search for errors
sudo grep -i error /var/log/letsencrypt/letsencrypt.log