Give the backup unit network access so its heartbeat ping can leave
CI / tests (Python 3.11) (pull_request) Successful in 28s
CI / tests (Python 3.10) (pull_request) Successful in 29s
CI / tests (Python 3.12) (pull_request) Successful in 25s
CI / tests (Python 3.13) (pull_request) Successful in 26s
CI / lint (pull_request) Successful in 2s

kernelwatch-backup.service still had PrivateNetwork=yes and
RestrictAddressFamilies=AF_UNIX from before scheduled-backup pinged
backup_heartbeat_url. Every nightly ping failed DNS inside the sandbox
("heartbeat request failed (URLError)"); the backup itself succeeded, so
the only symptom was the heartbeat monitor going down after a day.

Allow AF_INET/AF_INET6 like the alerts unit, and add a test that every
unit running a command that sends requests (check-alerts,
scheduled-backup, notify-backup-failure) keeps network access.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
patrickandClaude Opus 5.5 committed 2026-10-31 14:58:51 -04:00
1 parent 669f1dc545
commit f9d9660f71
3 files changed
+31 -2

No files matched your search

+5
View File
@@ -25,6 +25,11 @@ How kernelwatch is locked down, and what it deliberately can't do.
access, like apt's own `apt-daily.service`, but sandboxed: no access to home
directories, devices or kernel settings. apt drops to its `_apt` user for the
downloads, and nothing gets installed.
- **The server's timer units** (alert check, nightly backup, backup-failure
notice) run as the `kernelwatch` user with no capabilities and a syscall
filter, limited to Unix and IP sockets. They need outbound network access
for ntfy and the heartbeat pings, so `PrivateNetwork=` isn't an option
there; `tests/test_install.py` enforces that.
- **The agent** runs as a throwaway unprivileged user (`DynamicUser=yes`) with
no capabilities, a read-only filesystem view and a syscall filter. The token
reaches it through `LoadCredential=` and goes to curl on stdin, so it never