fix(ssl): preserve live certificates and renewal state across failed deployments

This commit is contained in:
Hamed Sanaei
2026-12-02 21:17:30 +03:30
parent 6387073b50
commit 85a8dd6725
9 changed files with 1709 additions and 354 deletions
+14 -6
View File
@@ -1,7 +1,7 @@
# IP certificate regression tests
Run from the repository root in Bash. The suite uses temporary files, mocks ACME
orders and service commands, and generates local self-signed certificate fixtures.
orders and service commands, and generates certificate fixtures from a local CA.
It never requests a certificate from a CA or executes the complete installer.
```bash
@@ -14,7 +14,7 @@ IP_SSL_LINUX_TEST=1 bash scripts/test/ip-ssl-listener-test.sh
bash scripts/test/ip-ssl-certificate-test.sh
```
Linux integration needs `socat`, `curl`, `openssl` (1.1.1+), and standard coreutils.
Linux integration needs `socat`, `curl`, `flock`, `openssl` (1.1.1+), and standard coreutils.
The listener tests bind unprivileged random ports on loopback. They need an IPv6
loopback interface, but no public IPv6 address, root privileges, or working
external echo service. Run the same commands on Debian/Ubuntu and AlmaLinux/RHEL;
@@ -22,9 +22,10 @@ install test dependencies in a disposable container if they are missing locally.
The tests cover real embedded installer/menu functions, discovery and consent,
unattended overrides, both socket families, actual IP SAN types and matching keys,
failed issuance/installation, rollback, permissions, and the persisted renewal
reload guard. Package installation, ACME orders, and panel/service operations are
mocked at their command boundaries.
failed issuance and installation, failed restoration, interruption, shared-path
locking, rejected automatic renewals, and the persisted renewal runner. Package
installation, ACME orders, and panel/service operations are mocked at their command
boundaries.
To check unchanged upstream acme.sh listener implementations separately:
@@ -33,14 +34,21 @@ curl -fsSLo /tmp/acme-3.1.5.sh https://raw.githubusercontent.com/acmesh-official
bash scripts/test/ip-ssl-acme-listener-test.sh /tmp/acme-3.1.5.sh 28085
curl -fsSLo /tmp/acme-3.1.6.sh https://raw.githubusercontent.com/acmesh-official/acme.sh/3.1.6/acme.sh
bash scripts/test/ip-ssl-acme-listener-test.sh /tmp/acme-3.1.6.sh 28085
bash scripts/test/ip-ssl-acme-lifecycle-test.sh /tmp/acme-3.1.5.sh /tmp/acme-3.1.6.sh
```
This invokes only the upstream listener dispatcher, sends independent loopback
The listener test invokes the upstream dispatcher, sends independent loopback
HTTP requests with `curl -4` and `curl -6`, prints the sockets with `ss`, then
stops the listeners. It does not issue ACME orders or change an installed client.
Run it in a disposable Linux environment with `iproute2`/`iproute` installed.
Test both `net.ipv6.bindv6only=0` and `1` container configurations where available.
The lifecycle test exercises stock `--installcert` and the retry path of stock
`--renew`. It reproduces the live-file overwrite on a failed upstream reload,
then checks the x-ui runner against the same behavior using isolated ACME state,
fixture certificates, and no CA requests. CI fetches the two upstream versions
by commit and runs this test alongside the lifecycle and concurrency regressions.
Loopback success does not establish public reachability. Real CA validation,
external port 80 forwarding, provider firewalls, and scheduled cron execution on
a deployed server require separate deployment testing.