The backup heartbeat check on healthchecks.io went down a day after setup, even though the nightly backups were succeeding.
kernelwatch-backup.service still had PrivateNetwork=yes and RestrictAddressFamilies=AF_UNIX. Those settings date from before scheduled-backup started pinging backup_heartbeat_url. Inside that sandbox DNS can't resolve, so every ping failed:
kernelwatch: heartbeat request failed (URLError)
ping() logs the failure on purpose and doesn't fail the run. So the backup still counted as successful, and the only visible symptom was the monitor going quiet. Running kernelwatch test-heartbeat outside the sandbox showed both URLs worked.
Changes
server/kernelwatch-backup.service: drop PrivateNetwork=yes and allow AF_INET/AF_INET6, the same as kernelwatch-alerts.service. The rest of the sandbox stays as it was.
tests/test_install.py: new test_units_that_send_requests_have_network_access. Every unit that runs check-alerts, scheduled-backup or notify-backup-failure must keep IP network access: no PrivateNetwork=, no IPAddressDeny=, and RestrictAddressFamilies= must include AF_INET and AF_INET6. The test fails on the old unit.
docs/security.md: a note that the server's timer units need outbound network access (ntfy and the heartbeats).
Testing
make test: all 242 tests pass.
The new test fails against the previous backup unit.
Deploying
Re-run server/install.sh, which copies the units and runs daemon-reload. If you added a systemctl edit override as a stopgap, remove it after upgrading with sudo systemctl revert kernelwatch-backup.service, then sudo systemctl daemon-reload. To confirm, run sudo systemctl start kernelwatch-backup.service; the backup check on healthchecks.io should go back to up.
## Problem
The backup heartbeat check on healthchecks.io went down a day after setup, even though the nightly backups were succeeding.
`kernelwatch-backup.service` still had `PrivateNetwork=yes` and `RestrictAddressFamilies=AF_UNIX`. Those settings date from before `scheduled-backup` started pinging `backup_heartbeat_url`. Inside that sandbox DNS can't resolve, so every ping failed:
kernelwatch: heartbeat request failed (URLError)
`ping()` logs the failure on purpose and doesn't fail the run. So the backup still counted as successful, and the only visible symptom was the monitor going quiet. Running `kernelwatch test-heartbeat` outside the sandbox showed both URLs worked.
## Changes
- **`server/kernelwatch-backup.service`**: drop `PrivateNetwork=yes` and allow `AF_INET`/`AF_INET6`, the same as `kernelwatch-alerts.service`. The rest of the sandbox stays as it was.
- **`tests/test_install.py`**: new `test_units_that_send_requests_have_network_access`. Every unit that runs `check-alerts`, `scheduled-backup` or `notify-backup-failure` must keep IP network access: no `PrivateNetwork=`, no `IPAddressDeny=`, and `RestrictAddressFamilies=` must include `AF_INET` and `AF_INET6`. The test fails on the old unit.
- **`docs/security.md`**: a note that the server's timer units need outbound network access (ntfy and the heartbeats).
## Testing
- `make test`: all 242 tests pass.
- The new test fails against the previous backup unit.
## Deploying
Re-run `server/install.sh`, which copies the units and runs `daemon-reload`. If you added a `systemctl edit` override as a stopgap, remove it after upgrading with `sudo systemctl revert kernelwatch-backup.service`, then `sudo systemctl daemon-reload`. To confirm, run `sudo systemctl start kernelwatch-backup.service`; the backup check on healthchecks.io should go back to up.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
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>
patrick
merged commit 3e2f550414 into main2026-10-31 19:04:21 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Problem
The backup heartbeat check on healthchecks.io went down a day after setup, even though the nightly backups were succeeding.
kernelwatch-backup.servicestill hadPrivateNetwork=yesandRestrictAddressFamilies=AF_UNIX. Those settings date from beforescheduled-backupstarted pingingbackup_heartbeat_url. Inside that sandbox DNS can't resolve, so every ping failed:ping()logs the failure on purpose and doesn't fail the run. So the backup still counted as successful, and the only visible symptom was the monitor going quiet. Runningkernelwatch test-heartbeatoutside the sandbox showed both URLs worked.Changes
server/kernelwatch-backup.service: dropPrivateNetwork=yesand allowAF_INET/AF_INET6, the same askernelwatch-alerts.service. The rest of the sandbox stays as it was.tests/test_install.py: newtest_units_that_send_requests_have_network_access. Every unit that runscheck-alerts,scheduled-backupornotify-backup-failuremust keep IP network access: noPrivateNetwork=, noIPAddressDeny=, andRestrictAddressFamilies=must includeAF_INETandAF_INET6. The test fails on the old unit.docs/security.md: a note that the server's timer units need outbound network access (ntfy and the heartbeats).Testing
make test: all 242 tests pass.Deploying
Re-run
server/install.sh, which copies the units and runsdaemon-reload. If you added asystemctl editoverride as a stopgap, remove it after upgrading withsudo systemctl revert kernelwatch-backup.service, thensudo systemctl daemon-reload. To confirm, runsudo systemctl start kernelwatch-backup.service; the backup check on healthchecks.io should go back to up.🤖 Generated with Claude Code
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>