mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-04 16:34:52 +03:00
fix(ssl): preserve live certificates and renewal state across failed deployments
This commit is contained in:
@@ -110,17 +110,38 @@ when using a custom port. In containers, enable IPv6 networking and publish the
|
||||
validation port for both families. Local listener success cannot verify an
|
||||
external firewall, NAT, or the provider's routing.
|
||||
|
||||
The resulting certificate's IP SANs, validity, and matching private key are
|
||||
checked before configuring the panel. Existing live certificate files are backed
|
||||
up during installation and restored after a failed or invalid copy; failed
|
||||
issuance does not remove certificates or ACME account data. Renewal still copies
|
||||
to the usual `/root/cert/ip/` paths, with a persisted SAN/key check before the
|
||||
panel reload command. The private key remains mode `600` and the chain `644`.
|
||||
A failed order also restores the acme.sh renewal entry of the certificate that
|
||||
was already in place, so cron keeps renewing it for its original addresses.
|
||||
If IP setup fails in the installer, the failure is reported and the installation
|
||||
continues: the panel is installed and reachable over plain HTTP, and the
|
||||
certificate can be issued later from the `x-ui` menu.
|
||||
Issuance and renewal work in a private directory under `/root/cert/ip/.xui-ip-ssl/`.
|
||||
The helper checks the chain, validity dates, every requested IP SAN, and the
|
||||
matching key before activating a new generation. One symlink switch activates
|
||||
the certificate, key, and their ACME renewal state together. The panel still
|
||||
uses `/root/cert/ip/fullchain.pem` (mode `644`) and `/root/cert/ip/privkey.pem`
|
||||
(mode `600`). A failed order, copy, validation, or promotion preserves the
|
||||
previous generation and its renewal schedule. If reloading the panel fails
|
||||
after activation, the valid certificate stays installed and reload is retried.
|
||||
|
||||
The root crontab checks the versioned local renewal helper hourly. Manual setup
|
||||
and cron share a file lock for the same panel paths, even when the primary IP
|
||||
changes. The first successful setup retires legacy acme.sh renewal entries for
|
||||
those paths. Existing domain certificates and the ACME account are retained.
|
||||
Renew managed IP certificates from the `x-ui` menu. Standard acme.sh cron
|
||||
continues to handle its other certificates.
|
||||
|
||||
After an interrupted attempt, the next run recovers the pending transaction
|
||||
before making another ACME request. If recovery reports an error, keep the
|
||||
reported journal and any listed `.xui-retired-*` directories. Fix the reported
|
||||
filesystem problem and rerun IP certificate setup from `x-ui` to retry recovery.
|
||||
The installer reports certificate setup failures and continues, so you can issue
|
||||
the certificate from the `x-ui` menu later.
|
||||
|
||||
In acme.sh 3.1.5 and 3.1.6, an explicit issue uses the destinations and hooks
|
||||
passed on its command line. Renewing can replay saved destinations and hooks.
|
||||
The client records the next renewal time before copying files and runs the
|
||||
reload command after the copy. x-ui supplies private staging paths and commits
|
||||
the modified renewal state once the candidate passes validation. The test suite
|
||||
exercises the upstream copy and install-retry behavior with local certificates.
|
||||
Public issuance and renewal require a separate test with port 80 reachable over
|
||||
both address families. [acme.sh issuance and renewal](https://github.com/acmesh-official/acme.sh/blob/3.1.5/acme.sh#L5289-L6742)
|
||||
· [acme.sh install and retry](https://github.com/acmesh-official/acme.sh/blob/3.1.6/acme.sh#L7205-L7380)
|
||||
|
||||
Inspect both IP SAN entries after issuance:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user