fix(apply): restart target firewall with strategy

Co-authored-by: GPT-6 <gpt-6@openai.com>
This commit is contained in:
ZeusinaandGPT-6 Bot committed 2026-10-10 08:33:43 +03:00
1 parent cdeb67f0dd
commit 0b4b909a20
6 files changed
+91 -15

No files matched your search

+25 -5
View File
@@ -59,8 +59,23 @@ Apply requires distinct positive qualified frontend/exact-GGC SQLite candidate
IDs, complete endpoint × TLS evidence and inert shell-safe arguments. It opens
the candidate DB read-only via `ZAPRET_AUTOTUNE_DB`; candidates are not active
state. Bindings/inputs are checked before pending transaction reconciliation.
Production reload remains exclusively the fixed init executable with
`restart-daemons`, no shell, with a 30-second deadline; no firewall restart.
Production reload is exclusively the fixed argv
`/opt/zapret2/init.d/sysv/zapret2 restart`, no shell, with a 30-second deadline.
Apply and rollback both use this full firewall/daemon restart; daemon-only
restart is not a supported fallback. This changes only the **new target
container's dedicated network namespace**, never the host or old container's
firewall. Provisioning must not use host networking or share an existing
container's network namespace.
The baseline explicitly sets `INIT_APPLY_FW=1`, `NFQWS2_ENABLE=0`, empty
`NFQWS2_OPT`, TCP ports `80,443`, UDP ports `443`, and TCP/UDP in/out packet
limits of `15`. QNUM is deliberately inherited from the base runtime default.
Active configs keep those fixed firewall values and set `NFQWS2_ENABLE=1`
with the qualified managed strategy arguments. Restoring the baseline and
running full restart removes its target-local queues and stops nfqws2;
restoring an earlier active config reinstates its firewall/daemon state.
The config replacement is atomic; the init script's stop/start sequence is
not a zero-interruption or kernel-atomic firewall transaction.
The transaction engine is unchanged: same-directory staging/fsync/rename,
durable journal/backup, advisory locking, external drift rejection, rollback
@@ -70,9 +85,14 @@ filesystem mutation is outside the transaction boundary. Shell config safety
and exact GGC filtering are unchanged.
No Docker socket, deployment/container/remote changes, old target paths, Xray
edits, monitor loop or firewall provisioning are included. New-target image
compatibility, actual config loading, NFQUEUE routing and rollback gates still
need independent acceptance. Persistent volume durability is a provisioning
edits, monitor loop or host firewall provisioning are included. Before deployment,
provisioning must verify the pinned image honors `ZAPRET_CONFIG`, supports all
listed variables, and starts ss-local while the baseline leaves nfqws2 disabled.
Start the fresh target with that baseline, then verify active apply installs
target-local nft NFQUEUE rules and starts nfqws2, and rollback restores both.
These image/startup/routing gates remain unverified: if any is unsupported or
uncertain, deployment must fail closed, not substitute `restart-daemons` or
alter an old config. Persistent volume durability is a provisioning
requirement; mountinfo alone cannot establish the storage lifecycle.
Injected unit tests cover exact identity/path/config, mountpoint refusal,