“certbot --nginx” temporarily modifies the Nginx configuration to serve the challenge file from a certain Certbot directory, then reverts the configuration change.
Your Nginx configuration shouldn’t normally need any references to /.well-known/acme-challenge/ or anything. Certbot’s supposed to be able to figure everything out on its own. If it can’t, it’s a bug. (Though it might not be a high priority to fix all bugs parsing egregiously weird configurations.)
In this case it’s not succeeding… So the questions are why, and what needs to be done to fix it. I’m suspicious of the port thing. There’s nothing wrong with doing that, and I think Cerbot’s current implementation is intended to support it, but it seems to be the only slightly unusual aspect of the configuration.
If you run Certbot with --debug-challenges, it will stop in the middle to let you examine the configuration changes. (I’m not certain renew supports that option, though.)
It may help to examine the configuration and see if anything looks wrong. Or run nginx -T and pastebin everything.
Edit: Also, what’s in the /etc/letsencrypt/renewal/ configuration file?
it doesn’t wait. It just pauses for a few seconds with this message
-------------------------------------------------------------------------------
Challenges loaded. Press continue to submit to CA. Pass "-v" for more info about
challenges.
-------------------------------------------------------------------------------
and then just continues
I’ll try to catch it at that point, but gotta run now. Thanks so far.
I say built the -T option… by hand.
Start with the initial nginx.conf - post that.
grep it for includes - post those.
grep those for possible even more includes - post those as well
until all included files have been posted.
Yes – since it’s adding a whole virtual host on port 80, but the port forwarding causes the requests to go to your other port 81 virtual host, which returns 404 Not Found.
But now I’m confused… Why were you able to get a production certificate? At least 4 of them, in fact.
One of the (production) rate limits is 5 identical certificates per week, so it’s a bad idea to do something that might issue a new production certificate this week.
That is what I have been wondering all along. I am able to get a certificate, so somehow cerbot manages to pass the challenges there. That is why I repeated it a few times. But during the renewal process it fails…
Don’t issue another production certificate now, but do you have the console output or letsencrypt.log from one of the times you issued one? In particular, the first time? It should be in /var/log/letsencrypt/letsencrypt.log or one of the older files in /var/log/letsencrypt/.
The question is what to do next… Under the circumstances, I’m not entirely certain, and I don’t want to guess wrong.
Edit:
I have an idea, but it’s not necessarily a wise idea:
Try adding “http01_port = 81” to the renewalparams section of /etc/letsencrypt/renewal/fritz.debler.net.conf – since it’s the last section of the file, appending it to the end is fine – and running “certbot renew --dry-run” again.
I think it will work. It probably won’t permanently damage anything.
certbot renew --dry-run
Saving debug log to /var/log/letsencrypt/letsencrypt.log
-------------------------------------------------------------------------------
Processing /etc/letsencrypt/renewal/fritz.debler.net.conf
-------------------------------------------------------------------------------
Cert not due for renewal, but simulating renewal for dry run
Plugins selected: Authenticator nginx, Installer nginx
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for fritz.debler.net
Waiting for verification...
Cleaning up challenges
-------------------------------------------------------------------------------
new certificate deployed with reload of nginx server; fullchain is
/etc/letsencrypt/live/fritz.debler.net/fullchain.pem
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
** DRY RUN: simulating 'certbot renew' close to cert expiry
** (The test certificates below have not been saved.)
Congratulations, all renewals succeeded. The following certs have been renewed:
/etc/letsencrypt/live/fritz.debler.net/fullchain.pem (success)
** DRY RUN: simulating 'certbot renew' close to cert expiry
** (The test certificates above have not been saved.)
-------------------------------------------------------------------------------
This topic/thread will be closed in 30 days.
modify the renewal conf file to be larger than 60 (75?)
and it should try before then
and we can get to the bottom of this quicker.
Of course you would put it back to 30 once we are done testing/fixing
does that hash work like a comment here, or does it need to stay?
EDIT:
Another related question. I see there is a cron job for renewal in /etc/cron.d/certbot
Do I need to add a post-hook script to restart nginx, or does it already restart it because nginx is mentioned in the renewal conf?