Dev.to Security 🔐 Cybersecurity 👁 2 📖 2 min read

Incident note: Let's Encrypt acme:error:unauthorized: fix

Read the signal Start with the exact wording of the error and its timestamp in the log. Then narrow down the cause before changing anything. Type: unauthorized Detail: 2001:db8::10: Invalid response from http://beis

Read the signal

Start with the exact wording of the error and its timestamp in the log. Then narrow down the cause before changing anything.

Type: unauthorized Detail: 2001:db8::10: Invalid response from http://beispiel.de/.well-known/acme-challenge/kX3v9...: 404

Narrow down possible causes

  • An AAAA record points to an IPv6 address where no vhost or the wrong one answers – Let's Encrypt prefers IPv6.
  • DNS still points to the old server (migration, high TTL).
  • Rewrite or redirect rules (Nextcloud, WordPress, forced HTTPS to another host) catch the path.
  • Wrong --webroot path, so the file is not where nginx serves it.

Check before changing anything

1.

Check A and AAAA records

dig +short A example.com; dig +short AAAA example.com

2.

Test the challenge path over IPv6

curl -6 -sI http://example.com/.well-known/acme-challenge/test

3.

Is nginx listening on IPv6 port 80?

nginx -T 2>/dev/null | grep -E 'listen .*\[::\]:80'

4.

Test issuance without hitting rate limits

certbot certonly --dry-run --webroot -w /var/www/letsencrypt -d example.com

Fix and test again

  1. Add listen [::]:80; to the HTTP vhost, or delete a wrong AAAA record.
  2. Serve the challenge path before any redirect: location ^~ /.well-known/acme-challenge/ { root /var/www/letsencrypt; }.
  3. Lower the TTL before a migration and request the certificate only after the switch.
  4. If port 80 is not reachable, switch to the DNS-01 challenge (e.g. a certbot DNS plugin).

Then repeat the original action and compare the result with the initial error.

Keep a note for the next ticket

Record the exact error, the check result, the change and the retest. That gives the team a useful starting point next time.

Why does it work in my browser but not for Let's Encrypt?

Your browser may use IPv4 or a cache. Let's Encrypt queries over IPv6 as soon as an AAAA record exists, and validates from several locations.

Full error guide: Let's Encrypt: urn:ietf:params:acme:error:unauthorized

Originally published at daniele-michelin.com. More guides, free checks (SPF, TLS, headers) and an error-message lexicon: daniele-michelin.com/en/.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.