fix: disable hosts and prevent nginx crash when certificate is deleted#5732
Open
mrbaloghakos wants to merge 2 commits into
Open
fix: disable hosts and prevent nginx crash when certificate is deleted#5732mrbaloghakos wants to merge 2 commits into
mrbaloghakos wants to merge 2 commits into
Conversation
…eleted When a certificate is deleted in NPM, the nginx config files for proxy hosts using that certificate were left referencing cert files that no longer exist on disk. This caused nginx to refuse to start on the next restart with: nginx: [emerg] cannot load certificate ".../fullchain.pem": BIO_new_file() failed (SSL: error:80000002:... No such file or directory) Two complementary fixes: 1. certificate.delete() now finds all enabled hosts that reference the deleted certificate, removes their nginx config files, sets meta.nginx_online=false with nginx_err='Certificate was deleted', and reloads nginx. Hosts are taken fully offline (rather than silently downgraded to HTTP) so the user sees a clear signal in the UI. 2. A new prepare script (55-nginx-validate.sh) runs before nginx starts and scans all host config files for ssl_certificate directives. Any config that references a cert file missing from disk is renamed to .conf.err so nginx never attempts to load it. This acts as a safety net for scenarios where cert files go missing without NPM knowing (volume recreation, manual deletion, etc.). Also adds a Cypress test that verifies a proxy host is taken offline when its certificate is deleted.
The explicit DELETE /api/nginx/proxy-hosts cleanup at the end of the 'Deleting a certificate takes dependent proxy hosts offline' test was causing a 502 in the MySQL CI environment. The double back-to-back nginx reload (cert deletion + proxy host deletion) caused the backend to become temporarily unreachable, failing the test. The cleanup is unnecessary: every test spec's before() already calls cy.resetUsers() which wipes all data before the next spec runs.
|
Docker Image for build 2 is available on DockerHub: Note Ensure you backup your NPM instance before testing this image! Especially if there are database changes. Warning Changes and additions to DNS Providers require verification by at least 2 members of the community! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a certificate is deleted in NPM, the nginx config files for proxy hosts using that certificate were left referencing cert files that no longer exist on disk. This caused nginx to refuse to start on the next restart with:
Two complementary fixes:
certificate.delete()now finds all enabled hosts that reference the deleted certificate, removes their nginx config files, setsmeta.nginx_online=falsewithnginx_err='Certificate was deleted', and reloads nginx. Hosts are taken fully offline (rather than silently downgraded to HTTP) so the user sees a clear signal in the UI.A new prepare script (
55-nginx-validate.sh) runs before nginx starts and scans all host config files forssl_certificatedirectives. Any config that references a cert file missing from disk is renamed to.conf.errso nginx never attempts to load it. This acts as a safety net for scenarios where cert files go missing without NPM knowing (volume recreation, manual deletion, etc.).Also adds a Cypress test that verifies a proxy host is taken offline when its certificate is deleted.
ℹ️ Vibecoded using
Claude Sonnet 4.6Fixes the following issues:
Why
Type of Change
AI Usage