mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-04-25 17:35:52 +03:00
[GH-ISSUE #677] Customize SSL cert renewing interval to avoid reloading nginx every hour #573
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#573
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 @niklasdahlheimer on GitHub (Oct 26, 2020).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/677
Is your feature request related to a problem? Please describe.
First of all: great tool! Setting up reverse poxies is really fun with this one :)
According to the docker logs, npm is checking for expired certificates every hour:
I think reloading nginx every hour could lead to problems in the business times of our web services (e.g. downloads buffered by nginx ..)
Is there a way to customize the cron job which triggers the cert renewing every hour to start the renewing only once a day or so?
Describe the solution you'd like
some way (UI or production.config) to customize the renewal interval
@papatistos commented on GitHub (Aug 19, 2021):
I don't quite understand why the renewing interval is set to such a short period in the first place. I think, letsencrypt certs are usually valid for three months or so. Why do 2160 checks during that period?
@niklasdahlheimer commented on GitHub (Aug 19, 2021):
probably it's just changing
github.com/jc21/nginx-proxy-manager@4f10d129c2/backend/internal/certificate.js (L24)to
intervalTimeout: (process.env.CERTIFICATE_RENEWAL_INTERVAL_IN_SECONDS * 1000) || (1000 * 60 * 60), // 1 hourThan the environment variable
CERTIFICATE_RENEWAL_INTERVAL_IN_SECONDScould be used to set the preferred interval.Sadly I'm not able to setup a working build environment to test it to create a pull request :/
@CorvetteCole commented on GitHub (Aug 27, 2021):
this really need to be changed, I'm sure lets encrypt doesn't particularly appreciate it either
@chaptergy commented on GitHub (Aug 27, 2021):
Letsencrypt does not notice this, as it is only checked locally whether a certificate is due to expire within a month, and only then a request to letsencrypt ist made. The only "issue" this high renewal rate causes is a slightly higher than necessary CPU consumption every hour. So NPM would be made more efficient by changing this, but this is not very urgent. Which does not mean that it should not be changed.
@niklasdahlheimer commented on GitHub (Aug 28, 2021):
@chaptergy I agree with you that certbot will only contact letsEncrypt if a certificate really expires within the next 30 days:
"[...]Since renew only renews certificates that are near expiry it can be run as frequently as you want - since it will usually take no action.[...]"
https://certbot.eff.org/docs/using.html?highlight=renew#renewing-certificates
But my concerns where more about the reload of nginx, which, I think, is triggered every time the task is run, so every hour. See
github.com/jc21/nginx-proxy-manager@5c67908460/backend/internal/certificate.js (L55)I'm not so much into nginx but couldn't this might cause running connections to "hickup" or result in a denial of service if you do a request just in this reload interval?
Either way, this hourly reload is not nescessary and I think it's easy to avoid it by implementing a environment variable, just like I suggested above.
...Or just increase the interval...Actually every value below 30 days should be enough
@chaptergy commented on GitHub (Aug 29, 2021):
It seems the original intention was to not run certbot at boot since you can't execute other certbot commands while it is running. And to make sure certbot runs even if you restart frequently, the hourly interval was chosen.
@papatistos commented on GitHub (Aug 29, 2021):
Thanks for the explanation. At least it makes some sense now. But the same could also be achieved by running certbot exactly once an hour after boot and thereafter once every couple of weeks or so.
@marcb1387 commented on GitHub (Feb 7, 2022):
I'm having this same thing occur and getting 522 error on my pages around the time when it reloads nginx. All of my certs are months off from expiration. If this could be scheduled during off time one a day it would be great.
[2/7/2022] [9:05:39 PM] [SSL ] › ℹ info Renewing SSL certs close to expiry...
[2/7/2022] [9:05:41 PM] [Nginx ] › ℹ info Reloading Nginx
[2/7/2022] [9:05:41 PM] [SSL ] › ℹ info Renew Complete
@RafaelSchridi commented on GitHub (Mar 31, 2022):
Since it renews when expiry is <30 days I see absolutely no reason to run this so often, should be at the minimum a 1 day interval.
@LucidityCrash commented on GitHub (Apr 1, 2022):
this issues an nginx reload not a restart ... reload doesn't kill existing connections :
@frabnet commented on GitHub (May 3, 2022):
Customizing renew interval can be also useful to improve security or avoid unwanted network traffic.
Now the port 80 tcp is opened in every moment since we don't know when the renew will happen.
If the renew is running in a scheduled moment, we can open the 80 port only on (for example) Sunday from 23:25 to 23:35.
It's not a big security problem but the 80 port is much common, surely we can avoid some potential problems.
Anyway, I'm open to suggestions.
@LucidityCrash commented on GitHub (May 3, 2022):
Is it really opening port 80 though ... I don't claim to be an expert but it doesn't make sense to me for it to be attaching to port 80 if there isn't a certificate to renew ... that said I use the cloudflare dns method so it never opens port 80 and I can't test either
however from the certbot docs :
Note this bit it can be run as frequently as you want - since it will usually take no action It really does seem to suggest that this is not doing what you seem to believe it is doing.
@frabnet commented on GitHub (May 4, 2022):
I don't want to criticize, just clarify: I assure you that the port 80 is always opened and always responsive, even when a renew is not needed:
With a scheduled renew timing, it could be closed by the user firewall (it can be a hardware firewall or iptables rule in the container).
UPDATE: I just found Let's Encrypt suggest to keep the 80 port open: https://letsencrypt.org/docs/allow-port-80/
I'm still convinced it's not a good way of managing it, but wathever 🙇
@LucidityCrash commented on GitHub (May 4, 2022):
I'm really confused here, I certainly don't think you are critizing, I just think we seem to have a missunderstanding :)
The points I've made are that
Looking at the cert code in NPM :
Initial cert request -
github.com/NginxProxyManager/nginx-proxy-manager@14b889a85f/backend/internal/certificate.js (L835)and renewal -
github.com/NginxProxyManager/nginx-proxy-manager@14b889a85f/backend/internal/certificate.js (L42)(renews are done with the same authenticator as the initial request)
I can see that if you do not use the DNS challenge method then it will use certbot with the webroot auth method with certonly ... this means that the web service, in this case nginx, is not restarted. certbot adds files to specific paths for the auth process - https://eff-certbot.readthedocs.io/en/stable/using.html?highlight=renew#webroot
So in short even if you don't use dns challenge for LE your sites should never be unavailable (slight caveat on that -
github.com/NginxProxyManager/nginx-proxy-manager@14b889a85f/backend/internal/certificate.js (L131)if you create a new certificate that has a domain name in that is already in another cert then the site using that other cert gets disabled while the new cert is being created)I'm rereading what you are saying and I think I understand what you are saying Port 80 is always listening and you'd like to be able to disable port 80 completely (except for cert renewals) ?
If that is the case then I don't think this is done because of LE ... this is simply the way NPM sets up its server config files you kinda have have to have it listening on port 80 else how would you serve up sites that you don't want SSLd ? and if you enable "force SSL" on a site then extra config is injected for that site that puts in that redirect you posted.
OK you could argue that in this day and age why would you not SSL everything but this is a generic Proxy, you have to account for all use cases and as you pointed out yourself having port 80 open is no real security threat - though changing the default site to something other than the Congratulations and 404 page is probably a good idea as both of those give hints as to what is running ... the custom page option does too as it sets the server header :( But that doesn't really increase the attack surface just gives them a little more info that will save them all of 10 seconds.
@waytosahil commented on GitHub (Aug 27, 2022):
I see it is mentioned in above thread that request is sent to Let's Encrypt only if the cert is due for renewal and renewal check done locally (my understanding from above thread).
One observation from my setup, I have 19 certs installed and I can see in the last 24 hrs ~700 requests were made by NPM to lencr.org , which are too many request in my opinion for certs with expiry time > 2 Months. May be if we can have an option to manage it would really help optimize things.
@pShota commented on GitHub (Nov 16, 2022):
(bump) may I ask any update on this?
@kirby12bit commented on GitHub (Apr 15, 2023):
I would like to add to this thread (know it's old but it's still open) this is causing a hiccup with using streams. I am running minecraft servers and this is causing external connections to drop during each reload.
@sercanyaldiz commented on GitHub (May 4, 2023):
Any update on this?
My certificate expires 11th July 2023, 2:45 am
Why does NPM renew my SSL cert every 1 hour?
@JOHLC commented on GitHub (Jun 8, 2023):
I also agree that a configurable renewal period would be a good feature. I have multiple instances requesting certs, every hour seems excessive.
@MyCleverGirl commented on GitHub (Jun 10, 2023):
im having the same issues, every hour all domains go offline untill its done and reloads, i tried to change the (1000 * 60 * 60) to 30 days and i get a sqlite error in docker logs and system breaks till i re- add (1000 * 60 * 60). im thinking of looking for alternative software, its a great program but this issue makes me wanna go elese were. they need to have a area in the online portal to allow us to change this based off user needs.
@fullmetalbrackets commented on GitHub (Jul 14, 2023):
This issue has been open since 2020, will it ever be resolved or even acknowledged by the maintainers? I don't even use SSL certificates, I only proxy my Docker containers to
*.home.arpalocally via http, and it still does this renewal every hour on the hour. There aren't even any SSL certificates to renew!@HomemadeAdvanced commented on GitHub (Jul 14, 2023):
Nginx Proxy Manager V3 will be released. It is in development since two years. So it is obvious that the developers invest not that much afford into the NPM V2 anymore.
https://github.com/NginxProxyManager/nginx-proxy-manager/discussions/1202
@github-actions[bot] commented on GitHub (Mar 24, 2024):
Issue is now considered stale. If you want to keep it open, please comment 👍
@HomemadeAdvanced commented on GitHub (Mar 25, 2024):
Is still an issue.
@jjmerri commented on GitHub (Nov 11, 2024):
why does reloading cause unavailability? I wouldn't care about this hourly check if it wasn't causing outages.
@kramttocs commented on GitHub (Nov 30, 2024):
So if it's checking every hour, I only need to open port 80 on my router, let's say as an example, for a period of 2hrs once a week, right?
Just thinking it'd be nice to not have port 80 open on the router if it isn't needed 24/7.
@BuckinghamIO commented on GitHub (Jan 8, 2025):
5 years and no update on something that really is so very simple...
This is causing me issues now as the reload knocks off the home assistant app it seems.
@kramttocs commented on GitHub (Jan 8, 2025):
Are you on the latest? Pretty sure the reload part was addressed with:
github.com/NginxProxyManager/nginx-proxy-manager@1be87f48c1@jkwhar commented on GitHub (May 27, 2025):
I'm having the issue on 2.12.3. Current cert expiration is until July 15.
[5/27/2025] [4:24:27 PM] [SSL ] › ℹ info Renewing SSL certs expiring within 30 days ...
[5/27/2025] [4:24:27 PM] [SSL ] › ℹ info Completed SSL cert renew process
[5/27/2025] [5:24:27 PM] [SSL ] › ℹ info Renewing SSL certs expiring within 30 days ...
[5/27/2025] [5:24:27 PM] [SSL ] › ℹ info Completed SSL cert renew process
[5/27/2025] [6:24:27 PM] [SSL ] › ℹ info Renewing SSL certs expiring within 30 days ...
[5/27/2025] [6:24:27 PM] [SSL ] › ℹ info Completed SSL cert renew process
@dragonfly4 commented on GitHub (Jun 23, 2025):
This is still running every hour and causing my Docker container to hang. Certificate expires on September 15, 2025.
github.com/NginxProxyManager/nginx-proxy-manager@f327c1e825/backend/internal/certificate.js (L34)[6/23/2025] [11:43:47 AM] [SSL ] › ℹ info Renewing SSL certs expiring within 30 days ...
[6/23/2025] [11:43:47 AM] [SSL ] › ℹ info Completed SSL cert renew process
@Dominic-Preap commented on GitHub (Dec 9, 2025):
Is there any way to bypass on that?