Post

Deluge QNAP restore rehearsal adds secure verification and tightened offline checks

Deluge QNAP restore rehearsal adds secure verification and tightened offline checks

This push introduces a rehearsal of the Deluge QNAP restore process so we can validate config ownership, torrent counts, startup latency, and security settings before they go live. I also expanded the offline CI checks around the deluge-config-restore-verification CronJob to enforce service account token handling, init-container capabilities, and volume read-only flags.

Verification flow for deluge-config-restore-verification

The new run-book describes how at 03:50 Pacific the deluge-config-restore-verification CronJob restores the current archive into the separate deluge-restore-scratch QNAP claim. It starts the pinned Deluge image with the QNAP launcher, checks the expected torrent count via authenticated RPC, confirms HTTP readiness, and measures elapsed startup time. An init container first restricts IPv4 and IPv6 to loopback before opening the backup. After verification finishes, Kubernetes stops the Deluge sidecar. We keep the original config and archive claims for recovery.

Offline CI checks for the deluge job

I extended scripts/ci/offline-checks.sh to locate the deluge-config-restore-verification object, then inspect its Pod: it must be a CronJob without an auto-mount service account token, without host networking, with init containers named isolate-network, restore-archive, and deluge. The first init container drops all capabilities except NET_ADMIN, the second drops everything, and the third drops NET_ADMIN and NET_RAW while running Always and containing a verify container. Its volumes must include the read-only deluge-config claim and the deluge-restore-scratch claim, and its volume mounts must not duplicate the archive volume. The NetworkPolicy attached to the Pod must contain Egress and Ingress policies, and the egress rules must target PostgreSQL TCP on port 5432, UDP on 53, and another TCP 53.

Architecture documentation update

The file openwiki/architecture/storage-and-state.md was revised to describe that after switching, the Deluge sidecar is stopped once verification completes and that the separate restore claim remains a staging target. Original config and archive claims are retained for recovery.

This post is licensed under CC BY 4.0 by the author.