mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-04-25 01:15:51 +03:00
[GH-ISSUE #1549] Let's Encrypt HTTP challenge renewal fails with timeout #1174
Labels
No labels
awaiting feedback
bug
cannot reproduce
dns provider request
duplicate
enhancement
enhancement
enhancement
good first issue
help wanted
invalid
need more info
no certbot plugin available
product-support
pull-request
question
stale
troll
upstream issue
v2
v2
v2
v3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/nginx-proxy-manager-NginxProxyManager#1174
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mwip on GitHub (Nov 2, 2021).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1549
Describe the bug
Since about two months, certbot renewal of letsencypt certificates fails. This is persistent through several versions of NPM now and none of the exisiting issues such as fixing dns inside docker have solved the issue.
Nginx Proxy Manager Version
2.9.10
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Certbot will automatically renew expiring certificates
Operating System
Linux 5.13.0-arm64 #1 SMP PREEMPT Debian 5.13.15-202109101456~buster (2021-09-10) aarch64 GNU/Linux
Additional context
I use the following ports, as my NPM is installed alongside Nextcloudpi, which by default occupies default HTTP(s) ports 80/443. Externally, ports 443 and 80 point towards 40443 and 8080, respectively. However, this was not a problem earlier (prior to ~August/September 2021).
@chaptergy commented on GitHub (Nov 3, 2021):
Unfortunately certbot does not output much information in the command line. Have a look at https://github.com/jc21/nginx-proxy-manager/issues/1271#user-content-certificate-error and tell us what the letsencrypt logs say
@mwip commented on GitHub (Nov 3, 2021):
Thanks so much for the hint and sorry for missing this. Checking the letsencrypt logs revealed that the renewal fails due to the DNS challenge being invalid. That is reasonable, since I never set it up anyways. So I found https://letsencrypt.org/docs/challenge-types/ which leads me to believe, that for my use case simple HTTP-01 challenge is sufficient.
Maybe you could help me with the following question:
• is there any particular reason why NPM chooses DNS challenge by default?
• can I alter existing certificates to only use HTTP-01 challenges?
• and is there any immediate security implication to using HTTP-01 challenges only that I am missing?
Also, I think the following improvements could be added to NPM (probably deserving their own issues):
• add an info box on the toggle Use DNS Challenge to https://letsencrypt.org/docs/challenge-types/
• it is possible to generate a certificate on the fly when setting up a new proxy host. There is no mention of the DNS challenge. There should be a toggle as well, right?
@chaptergy commented on GitHub (Nov 3, 2021):
Okay, that's weird. About your questions:
/etc/letsencrypt/renewal.LetsEncryptit was created as a HTTP challenge. If it is a DND challenge it should sayLetsEncrypt -<provider name>.I'm not really sure what the issue could be. Could you provide us with the relevant part of the letsencrypt log and the renewal config? Replace any sensitive information with placeholders of course.
@mwip commented on GitHub (Nov 3, 2021):
Thanks so much for your help!
So I watched the logs while (successfully) creating a new certificate and deliberately not activating the DNS challenge. This triggered the following log in the docker app:
Is it normal that certbot will include
--preferred-challenges "dns,http"even though the DNS challenge was not ticked in NPM? I also tried to renew this newly created certificate and eveything worked fine, no LE-logs just a success log for NPM. Does that maybe mean that I am just better off by replacing all certificates?Concerning previous certificates, please find the logs. I hope I did not blank relevant stuff. The part that tripped me up is that
challengescontains{ "type": "dns-01", "status": "pending", "url": "https://acme-v02.api.letsencrypt.org/acme/chall-v3/asdf", "token": "asdf" },. Also, in /etc/letsencrypt/renewal/npm-5.conf there ispref_challs = dns-01, http-01while NPM's certificate table just saysLet's Encryptas Certificate Provider.What do you mean by
NPM, and the sites it proxies are exposed via ports 80 and 443 (external) and forwarded to 8080 and 40443 internally, but that should not matter, right? Port 81 (NPM interface) is not exposed externally.
Logs
This seems to keep going for a few tries until:
@mwip commented on GitHub (Nov 3, 2021):
Ok, I why certificates would not be renewed: for the proxy hosts in question, I had the option "Force SSL" active. Once I deactivated this option in the SSL Tab of the respective hosts, I was able to renew all certificates. ✔️
Does leave this issue to be closed for "user error" (that could be totally on me. Sorry for spamming here...), or would that indicate a deeper problem worth keeping this issue around?
@chaptergy commented on GitHub (Nov 3, 2021):
So that means enabling Force SSL caused the certificates to fail to renew?
@mwip commented on GitHub (Nov 3, 2021):
Right now, I just can definitively state the inverse: disabling Force SSL made renewal possible. I tested it for 3 proxy hosts, all worked afterwards. I can test enabling Force SSL once more and check if that really is what caused the hickup
@mwip commented on GitHub (Nov 4, 2021):
I am so confused and embarrassed... I tested whether enabling any of the SSL options Force SSL, HSTS Enabled and HSTS Subdomains would break the renewal process. I activated them one after the other and renewed the certificate every single time with success. At this point I don't know what has caused the incident, I am sorry. But maybe I'll write up the (admittedly super hacky) solution for future reference in a closing comment, if you think it could be helpful to the community @chaptergy. Just LMK, else feel free to close.
@chaptergy commented on GitHub (Nov 4, 2021):
Hm, so now everything works no matter the state of any of the settings? You can't replicate the issue anymore? Then I'll go ahead and close this issue for now. But feel free to add anything that could be helpful in a comment.
@jamestutton commented on GitHub (Nov 22, 2021):
Just for reference. I have seen this behavior before if for some reason the existing certificate has lapsed and Force SSL is on then yes renewal will fail as it is forced to use a certificate that is expired and hence cant renew as the SSL in invalid. Maybe that is the situation you found yourself in.
@vinc32 commented on GitHub (Jan 4, 2023):
thx for the hint - disabling Force SSL let me renew all SSL Certs
@aszurnasirpal commented on GitHub (Jan 7, 2023):
I was affected by the same bug. Disabling the SSL Force option allowed me to renew the cert as well.
@0rn0lf commented on GitHub (Mar 14, 2023):
Same here. After finding this issue today, i tried disabling "Force SSL" which indeed did the trick for 10 expired certificates. I kept recreateing certificates for over a year now without finding the issue.
I also tried one certificate which is still valid until May. With "Force SSL" enabled, renewal didnt work. As soon as i disabled the option, renewal worked.
Nevertheless, it cant be expired certificates because NPM should renew them before they expire.
@DorCoMaNdO commented on GitHub (Jun 8, 2023):
I've had the same issue via the unRaid Docker container up until today, instead of disabling Force SSL I instead added a custom location rule (in the proxy host settings) with the following settings:
Location:
/.well-known/acme-challengeScheme:
httpForward Hostname/IP:
[YourNginxServerIP]/data/letsencrypt-acme-challenge(do not add your Nginx custom port here)Forward Port: Your Nginx Port
This resolved the issue where the challenge files generated by the certification process could not be accessed by the remote host, my previous solution was to disable the proxy host temporarily, generate new certificate, and then re-enable it, only had to be done once every 3 months but it was still nonsensical.
@soenkef commented on GitHub (Jun 16, 2023):
THis works for me!
@Unskilledcrab commented on GitHub (Mar 23, 2024):
I've ran into this issue twice now and just found this solution. The previous time I completely removed NPM and re-installed thinking there was something wrong with the installation. This saved me from having to repeat the process, thank you!
@ndsvw commented on GitHub (Jul 13, 2025):
Same.