I have Nginx reverse proxy (IPv4 only) pointing to server in local network which has dual IPv4 and IPv6 (public) stack. For some reason when I run Certbot renew on my Nginx reverse proxy box it is trying to use IPv6 address and obviously fails as Certbot command was not invoked from that server. Why Certbot prefer IPv6 and not falling back to IPv4 causing renewal process impossible?
Even if I delete all data referring to that domain/cert I can’t obtain new cert:
# certbot certonly --standalone -d domain.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator standalone, Installer None
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for domain.com
Waiting for verification...
Cleaning up challenges
Failed authorization procedure. domain.com (http-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from https://domain.com/login [2001:xxx:xx:xxx::x]: "<!DOCTYPE html>\n<html class=\"ng-csp\" data-placeholder-focus=\"false\" lang=\"en\" data-locale=\"en\" >\n\t<head\n data-requesttoken=\"C9B3"
IMPORTANT NOTES:
- The following errors were reported by the server:
Domain: domain.com
Type: unauthorized
Detail: Invalid response from https://domain.com/login
[2001:xxx:xx:xxx::x]: "<!DOCTYPE html>\n<html class=\"ng-csp\"
data-placeholder-focus=\"false\" lang=\"en\" data-locale=\"en\"
>\n\t<head\n data-requesttoken=\"C9B3"
To fix these errors, please make sure that your domain name was
entered correctly and the DNS A/AAAA record(s) for that domain
contain(s) the right IP address.
please answer the following questions. That's the standard template from Help
Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. crt.sh | example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.
My domain is:
I ran this command:
It produced this output:
My web server is (include version):
The operating system my web server runs on is (include version):
My hosting provider, if applicable, is:
I can login to a root shell on my machine (yes or no, or I don't know):
I'm using a control panel to manage my site (no, or provide the name and version of the control panel):
The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot):
Remove AAAA record from your domain if your proxy doesn’t support it. having AAAA record points to something else means anybody with ipv6 address will bypass reverse proxy and don’t see certificates
Yes, will bypass Nginx IPv4 only proxy and point directly to IPv6 server. Certificates are already there, copied from reverse proxy box. Can’t see the problem here. The only problem is this fantastic feature of forcing IPv6 as preferred during the renewal without option of forcing IPv4.
Try to imagine situation, where IPv4 traffic is going through the reverse proxy whilst IPv6 is going directly. If hacker will gain an access on that level, then he/she will do whatever he or she want. If it is security feature, so why it is trying talk to IPv6 address while original request came from IPv4 box? There is no logic here. But I of course really appreciate your help and explanation.