Guideschevron_rightServers

Servers · 6 min read · Updated

Certbot "Error Getting Validation Data": How to Fix It

“Error getting validation data” and the newer “Certbot failed to authenticate some domains” both mean Let's Encrypt tried to fetch a small challenge file from http://your-domain/.well-known/acme-challenge/ and could not. Four causes cover almost every case: the domain's A or AAAA record points somewhere else, port 80 is blocked by a firewall, the web server answers from the wrong folder (a 404), or a proxy or CDN in front of the server gets in the way. Check them in that order, and test with --dry-run so failed attempts do not use up your rate limit.

Read the Detail Line

Certbot prints the reason under each failed domain. The detail tells you which cause to look at:

Certbot failed to authenticate some domains (authenticator: nginx).
  Domain: example.com
  Type:   connection
  Detail: 203.0.113.10: Fetching http://example.com/.well-known/acme-challenge/...:
          Timeout during connect (likely firewall problem)
  • Timeout during connect: a firewall, or the wrong IP address.
  • Connection refused: nothing listens on port 80 at that address.
  • Invalid response … 404: the web server answered, but not from the folder Certbot used.
  • DNS problem: NXDOMAIN: the domain has no record yet, or a typo.

Always compare the IP address in the detail line with your server's address. If they differ, the problem is DNS.

1. Check Where the Domain Points

dig +short A example.com
dig +short AAAA example.com
ip -4 addr show scope global      # this server's address

The A record must be this server's address. Watch for an AAAA (IPv6) record left over from a previous host: Let's Encrypt may validate over IPv6 when one exists, so a stale AAAA record fails the check even when the A record is right. Virteche Cloud servers are IPv4 only, so remove any AAAA record when moving a domain to one. After changing DNS, wait for the old record's TTL to expire.

2. Open Port 80

Make sure something listens on port 80, then that every firewall in the path allows it:

sudo ss -tlnp '( sport = :80 )'     # nginx or apache2 should be listed
sudo ufw allow 80/tcp                # if the server uses UFW
sudo firewall-cmd --permanent --add-service=http && sudo firewall-cmd --reload   # if it uses firewalld

There may also be a firewall in front of the server. On Virteche Cloud that is the firewall on the server's page in the dashboard: allow TCP 80 there too. Then test from another machine, not from the server itself: curl -I http://example.com/.

3. Serve the Challenge from the Right Folder

A 404 means the request reached a web server that did not have the file. With the --webroot method, the folder you pass must be the one the server block for this domain serves. Test it with a file of your own:

sudo mkdir -p /var/www/html/.well-known/acme-challenge
echo ok | sudo tee /var/www/html/.well-known/acme-challenge/test
curl -i http://example.com/.well-known/acme-challenge/test   # from another machine: expect 200 and "ok"

If you get a 404 or another site's page, the domain is not matching the server block you think it is (check server_name in Nginx or ServerName in Apache), or a redirect sends the request elsewhere. Using --nginx or --apache instead lets Certbot configure the challenge itself.

4. Proxies and CDNs

If the domain is behind a CDN or another proxy, Let's Encrypt connects to the proxy, not to your server. The challenge then works only if the proxy passes /.well-known/acme-challenge/ through to your server over plain HTTP. If it does not, either turn the proxy off for the domain while issuing, or use the DNS challenge, which proves control with a TXT record and needs no open port at all.

Test Without Using Up Your Limit

sudo certbot certonly --nginx -d example.com --dry-run
sudo certbot renew --dry-run
systemctl list-timers | grep -i certbot    # the scheduled renewal

--dry-run uses Let's Encrypt's staging service, which has much higher limits, and changes nothing on the server. For the whole setup from the start, see hosting a website on a VPS.

Let's Encrypt and Certbot are trademarks of their respective owners. Virteche is not affiliated with or endorsed by them. Details about their products come from their public documentation as of the date at the top of this guide.

Common Questions

  • What does "Timeout during connect (likely firewall problem)" mean?

    Let's Encrypt could not open a connection to port 80 on the address your domain points to. Either a firewall drops the traffic (on the server or in front of it), or the domain points to a different address than you think.

  • Do I need port 80 open if my site only uses HTTPS?

    For the usual HTTP challenge, yes: Let's Encrypt always starts the check on port 80. Keep port 80 open and redirect visitors to HTTPS there. If you cannot open port 80, use the DNS challenge instead.

  • I tried several times and now get "too many failed authorizations". What now?

    Let's Encrypt allows 5 failed validations per domain per account per hour, refilling one every 12 minutes. Wait, fix the cause, and test with --dry-run, which uses the staging service and its much higher limits.

  • How do I check that automatic renewal works?

    Run sudo certbot renew --dry-run. It goes through the whole renewal against the staging service without replacing your certificate. If that passes, the scheduled renewal will too, as long as nothing changes.

Each VPS has a firewall on the host managed from the dashboard. Allow port 80 there as well as on the server, and Let's Encrypt can reach it.

See VPS plans

Keep Reading

All guides
Fix Certbot "Error Getting Validation Data" | Virteche Cloud