Certbot renew error -- Invalid response from


#1

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. https://crt.sh/?q=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:
teramotohome.com

I ran this command:

certbot renew --preferred-challenges http

It produced this output:

   Domain: teramotohome.com
   Type:   unauthorized
   Detail: Invalid response from
   http://teramotohome.com/.well-known/acme-challenge/SIRA5IDVirr6_aGuQ_996oyQq9qs3DN1AvZPXoY7c0g:
   "<html>\r\n<head><title>404 Not Found</title></head>\r\n<body
   bgcolor=\"white\">\r\n<center><h1>404 Not
   Found</h1></center>\r\n<hr><center>"

   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.

My web server is (include version):
nginx-1.15.0

The operating system my web server runs on is (include version):
freebsd-10.3-RELEASE-p7

My hosting provider, if applicable, is:
ISP is eo

I can login to a root shell on my machine (yes or no, or I don’t know):
yes

I’m using a control panel to manage my site (no, or provide the name and version of the control panel): no

I have a problem renewing my certificate. I issued

sudo certbot renew --preferred-challenges http

which resulted the following error

   Domain: teramotohome.com
   Type:   unauthorized
   Detail: Invalid response from
   http://teramotohome.com/.well-known/acme-challenge/SIRA5IDVirr6_aGuQ_996oyQq9qs3DN1AvZPXoY7c0g:
   "<html>\r\n<head><title>404 Not Found</title></head>\r\n<body
   bgcolor=\"white\">\r\n<center><h1>404 Not
   Found</h1></center>\r\n<hr><center>"

   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.

To tried to solve this error, I created the .well-known/acme-challenge
subdirectory to my root directory. After this, I could get a “hello” message
from this subdirectory. So the directory exists. But I still get the same “404 not found” error message except a different long file name in the message.

I’ll appreciate if somebody helps me to solve this problem.

Thank you very much in advance,
Yoshiki


#2

What was the rest of Certbot’s output?


#3

The following is the all certbot’s output.

Saving debug log to /var/log/letsencrypt/letsencrypt.log

-------------------------------------------------------------------------------
Processing /usr/local/etc/letsencrypt/renewal/teramotohome.com.conf
-------------------------------------------------------------------------------
Cert is due for renewal, auto-renewing...
Plugins selected: Authenticator standalone, Installer None
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for teramotohome.com
Waiting for verification...
Cleaning up challenges
Attempting to renew cert (teramotohome.com) from /usr/local/etc/letsencrypt/renewal/teramotohome.com.conf produced an unexpected error: Failed authorization procedure. teramotohome.com (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://teramotohome.com/.well-known/acme-challenge/SIRA5IDVirr6_aGuQ_996oyQq9qs3DN1AvZPXoY7c0g: "<html>\r\n<head><title>404 Not Found</title></head>\r\n<body bgcolor=\"white\">\r\n<center><h1>404 Not Found</h1></center>\r\n<hr><center>". Skipping.
All renewal attempts failed. The following certs could not be renewed:
  /usr/local/etc/letsencrypt/live/teramotohome.com/fullchain.pem (failure)

-------------------------------------------------------------------------------

All renewal attempts failed. The following certs could not be renewed:
  /usr/local/etc/letsencrypt/live/teramotohome.com/fullchain.pem (failure)
-------------------------------------------------------------------------------
1 renew failure(s), 0 parse failure(s)

IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: teramotohome.com
   Type:   unauthorized
   Detail: Invalid response from
   http://teramotohome.com/.well-known/acme-challenge/SIRA5IDVirr6_aGuQ_996oyQq9qs3DN1AvZPXoY7c0g:
   "<html>\r\n<head><title>404 Not Found</title></head>\r\n<body
   bgcolor=\"white\">\r\n<center><h1>404 Not
   Found</h1></center>\r\n<hr><center>"

   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.

#5

Hi @Yoshiki,

Seems you are using standalone authenticator, that means that certbot will raise a simple web server to serve the challenge so you should stop your nginx server before that, something strange, I would expect another error if certbot can’t bind the web server to yourip and port 80.

Could you please show the content of /usr/local/etc/letsencrypt/renewal/teramotohome.com.conf?.

Cheers,
sahsanu


#6

Thank you, sahsanu

Your suggestion worked perfectly. I stopped nginx before issuing the certbot renew command. This time, it successfully renewed
fullchain.pem! I’m very happy that you solved the problem.

Thanks again,
Yoshiki


#7

Hi @Yoshiki,

I’m glad you renewed the cert but keep in mind that you will have this problem next time you want to renew the certificate, so you could add a pre-hook and post-hook to stop nginx before the renewel and start it again once the cert has been renewed or maybe you could switch from standalone to webroot authentication so you don’t need to stop/start nginx and you only add a deploy-hook to reload nginx once the certificate is renewed so it is loaded into nginx.

Cheers,
sahsanu


#8

Hi sahsanu,

Thank you for the follow up information. As you have suggested, I put a shell script to stop nginx in the renewal-hooks/pre directory and an another shell script to start nginx in the renewal-hooks/post directory. I’ll see how they work when the next time certbot renew is executed at three months later.

Thank you,
Yoshiki