mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2026-09-03 07:24:52 +08:00
Content.WriteFile, ConfigPayload.WriteFile and writeFileWithMode staged and renamed certificate files with os.* calls, so in host_via_ssh + sftp mode the ACME, self-signed and manual certificate flows landed in the container while the site config referencing them was written to the host, and nginx -t on the host failed to load them. Route directory creation, temp-file staging, chmod, rename and cleanup through nginx.MkdirAll/OpenFile/Chmod/Rename/Remove, keeping the atomic replace and the owner-only private key mode in local mode. The temp file is chmod'd before any content is written because the SFTP backend ignores the mode passed to OpenFile. Rename onto an existing file is retried after removing the target, which SFTP servers commonly require. Readers that inspect the same files (certificate info, renewal checks, the self-signed key loader, remote sync, fingerprints, import validation, the API transformer) and the self-signed directory cleanup now use nginx.ReadFile/ Stat/RemoveAll as well. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>