I have ServerA with CloudLinux where domain.com is served. On ServerA is the subdomain.domain.com defined with an A record pointing to ServerB with Debian 9, Nginx 1.10.3 by IP (ServerB is a different remote server).
While trying to issue a cert with Certbot 0.28.0 on ServerB for subdomain.domain.com I receive the following error: “Failed authorization procedure. subdomain.domain.com (http-01). urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from”
Tried with: certbot nginx
as well as with: certbot certonly --staging --webroot -w /var/www/domain/ -d subdomain.domain.com
The directories /.well-known/acme-challenge have both permission 755, a dummy file is accessible with curl and nginx is configured to always return content type /plain/text for this directory.
A record of server B on server A? is server A authoritative name server for domain.com zone? (NS record fro domain.comfrom com zone tells server A’s IP?)
if not, A record set on server A won’t heard by anything. add proper A record for subdomain on where you bought the domain, or you use for DNS hosting
domain.com A IP ServerA
domain.com NS ns1.hoster.com (different from IP ServerA)
domain.com NS ns2.hoster.com (different from IP ServerA)
subdomain.domain.com A IP ServerB
What do you mean with “A record for subdomain must be added on hoster’s site menu.”?
The “A record” pointing to ServerB was entered in the hoster’s web panel where config is done for domain.com/ServerA
server A is red haring, so let’s turn it off(ignore it). would you expect your config to work if you do that?
if done right server B work even if server A is turned off.
use hoster.com’s API/web menu for DNS records for any subdomain. using IP of server B.
Unfortunately not. Your answers helped me to understand it better, but nothing was changed in configs so far, so the same error as in the original post still appears. I run the certbot command as root
Then there is some issue with the --webroot and the real root...
Try making a dedicated location for the challenges:
[something like] sudo mkdir /ACME-challenges/ sudo chmod 777 /ACME-challenges/
then modify this location section:
to specify the challenge root:
[and slightly modified location]
Created the directory, and adopted nginx config per your suggestion. Instead of root /ACME-challenges/; I had to use the alias directive. The dummy file is accessible via browser. Ran certbot with certbot --staging --nginx.
Same error occurs: “Failed authorization procedure. subdomain.domain.com (http-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization”
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.