Conversation
rename() replaces the live file with a fresh temp created under the umask, so a renewal reset any tightened mode on the deployed key/cert (e.g. 0600 to 0644). The previous in-place copy() kept it; copy the live file's mode onto the temp before renaming.
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.
Problem
moveCertsToNginxProxy()deployed the freshly-issued cert with three sequential barecopy()calls (key, crt, chain) intoservices/nginx-proxy/certs/, ignoring every return value and with no temp-file + rename. A failure between copies (disk full, permissions, crash) left nginx-proxy pointing at a mismatched key/cert pair. This runs on both first issuance and renewal (the unattended cron path).Fix
Copy each source to a temp file in the destination directory (checking
copy()), thenrename()each into place (checkingrename()).rename()is atomic on the same filesystem, so a failed copy can no longer leave a half-written live key/cert. On any failure the temp files are cleaned up and an exception is thrown, rather than silently leaving a partial deploy.Existing deployed files keep their mode on renewal (the temp file takes the live file's permissions before the rename), so a hardened
chmod 600key stays 0600.Notes
voidand throws on failure:executeRenewal()already wraps the call in try/catch (surfaces as a renewal warning); on first issuance the exception propagates as a loud failure — preferable to the previous silent broken-cert outcome.ssl-renewsays "renewal is not necessary" and doesn't redeploy; onlyssl-renew --forcerecovers. Until fix(ssl): include ACME error message in operator-facing warnings #486 lands, the renewal warning still reads "Challenge Authorization failed…"; the real reason is inee.log.Testing
Manual: issue/renew a cert and confirm
.key/.crt/.chain.pemdeploy together with no.tmpleftovers. To force a failure, make the certs dir immutable (chattr +i "$(readlink -f /opt/easyengine/services/nginx-proxy/certs)"; plain permissions don't stop root), runee site ssl-renew <site> --force, and confirm it fails withFailed to copy certificate file … .tmpinee.log, no "Certificate renewed successfully!", the live key/cert unchanged and no.tmpfiles; thenchattr -i.Tested on Ubuntu 26.04 with EasyEngine 4.12.0 with real Let's Encrypt certificates (first issuance, and a forced renewal with the certs dir immutable).