Commit Graph
21 Commits
Author SHA1 Message Date
patrickandClaude Sonnet 5.5 48960e6faf Notify via ntfy when the nightly backup fails
CI / tests (Python 3.10) (pull_request) Successful in 25s
CI / tests (Python 3.11) (pull_request) Successful in 24s
CI / tests (Python 3.12) (pull_request) Successful in 24s
CI / tests (Python 3.13) (pull_request) Successful in 25s
CI / lint (pull_request) Successful in 3s
kernelwatch-backup.service gets OnFailure=kernelwatch-backup-failed.service,
which runs notify-backup-failure, so timeouts, OOM kills and crashes are
reported as well as handled errors. The installer ships the new unit, and tests
check that every OnFailure= target is a real unit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-30 11:13:33 -04:00
patrickandClaude Sonnet 5.5 4a9bc77a08 Back up the database nightly with a timer
CI / tests (Python 3.10) (pull_request) Successful in 23s
CI / tests (Python 3.11) (pull_request) Successful in 25s
CI / tests (Python 3.12) (pull_request) Successful in 24s
CI / tests (Python 3.13) (pull_request) Successful in 24s
CI / lint (pull_request) Successful in 3s
kernelwatch scheduled-backup writes kernelwatch-YYYY-MM-DD.db into backup_dir
and prunes dated copies backup_keep_days or older, only after the new backup
succeeded and only files with exactly that name. kernelwatch-backup.timer runs
it at about 03:30 as the unprivileged service user with no network, and
server/install.sh enables it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-30 10:23:45 -04:00
patrickandClaude Sonnet 5.5 3624f0e5d9 Test both installers against a fake root
CI / tests (Python 3.10) (pull_request) Successful in 25s
CI / tests (Python 3.11) (pull_request) Successful in 25s
CI / tests (Python 3.12) (pull_request) Successful in 24s
CI / tests (Python 3.13) (pull_request) Successful in 24s
CI / lint (pull_request) Successful in 4s
27 tests run the real scripts with systemctl, apt-get, useradd and friends
stubbed: fresh installs, upgrades keeping config and token, token sources,
REPORT_HOSTNAME handling, apt-update marker, private CA, needrestart, failed
first report, OS warnings, argument errors, and the server's user creation,
config preservation and interrupted-upgrade recovery. Guards that every unit
and script is installed and that deploy.sh ships every file the agent
installer uses.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-30 09:51:36 -04:00
patrickandClaude Sonnet 5.5 10b1d6abb8 Let an agent report a chosen hostname
CI / tests (Python 3.10) (pull_request) Successful in 22s
CI / tests (Python 3.11) (pull_request) Successful in 22s
CI / tests (Python 3.12) (pull_request) Successful in 22s
CI / tests (Python 3.13) (pull_request) Successful in 21s
CI / lint (pull_request) Successful in 3s
REPORT_HOSTNAME in agent.conf replaces hostname -f in the report, for hosts
registered under a label that differs from their real hostname (otherwise the
dashboard notes a mismatch forever). install.sh --report-hostname NAME sets it,
--default-report-hostname clears it, and re-running with --server (register,
rotate) keeps it. Agent 0.4.1.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-29 22:14:41 -04:00
patrickandClaude Sonnet 5.5 b59336d7e2 Collect Ubuntu Livepatch status in the agent
CI / tests (Python 3.10) (pull_request) Successful in 22s
CI / tests (Python 3.11) (pull_request) Successful in 22s
CI / tests (Python 3.12) (pull_request) Successful in 21s
CI / tests (Python 3.13) (pull_request) Successful in 21s
CI / lint (pull_request) Successful in 2s
kernelwatch-livepatch.service runs canonical-livepatch as root with no
network and a read-only filesystem, and a small python3 helper keeps the
running kernel's state, check state, support, end-of-support date and fix
count in /run/kernelwatch/livepatch. The agent (0.4.0) reads that file the
way it reads needrestart's and never runs the snap itself.

NoNewPrivileges=yes can't be used: snap-confine fails under it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-29 21:37:42 -04:00
patrickandClaude Sonnet 5.5 201a1c5f4b Document hostname check
CI / tests (Python 3.10) (pull_request) Successful in 20s
CI / tests (Python 3.11) (pull_request) Successful in 20s
CI / tests (Python 3.12) (pull_request) Successful in 20s
CI / tests (Python 3.13) (pull_request) Successful in 21s
CI / lint (pull_request) Successful in 2s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-29 21:17:40 -04:00
patrickandClaude Sonnet 5.5 51732066d0 Document report rate limit
CI / tests (Python 3.10) (pull_request) Successful in 21s
CI / tests (Python 3.11) (pull_request) Successful in 19s
CI / tests (Python 3.12) (pull_request) Successful in 19s
CI / tests (Python 3.13) (pull_request) Successful in 19s
CI / lint (pull_request) Successful in 3s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-29 20:46:09 -04:00
patrickandClaude Sonnet 5.5 42a1b41b01 Document backups and restore
CI / tests (Python 3.10) (pull_request) Successful in 19s
CI / tests (Python 3.11) (pull_request) Successful in 18s
CI / tests (Python 3.12) (pull_request) Successful in 18s
CI / tests (Python 3.13) (pull_request) Successful in 18s
CI / lint (pull_request) Successful in 3s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-29 20:37:54 -04:00
patrickandClaude Sonnet 5.5 b6957e3ca4 Document reboot and update alerts
CI / tests (Python 3.10) (pull_request) Successful in 19s
CI / tests (Python 3.11) (pull_request) Successful in 18s
CI / tests (Python 3.12) (pull_request) Successful in 17s
CI / tests (Python 3.13) (pull_request) Successful in 17s
CI / lint (pull_request) Successful in 3s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-29 20:32:24 -04:00
patrick 47f93968e9 Add ntfy alerts for stale hosts and reporting recovery
CI / tests (Python 3.10) (pull_request) Successful in 19s
CI / tests (Python 3.11) (pull_request) Successful in 17s
CI / tests (Python 3.12) (pull_request) Successful in 17s
CI / tests (Python 3.13) (pull_request) Successful in 18s
CI / lint (pull_request) Successful in 3s
2026-10-24 15:15:48 -04:00
patrickandClaude Opus 5.5 f35cc007f5 Optionally refresh apt package lists before each report
CI / tests (Python 3.10) (pull_request) Successful in 15s
CI / tests (Python 3.11) (pull_request) Successful in 15s
CI / tests (Python 3.12) (pull_request) Successful in 15s
CI / tests (Python 3.13) (pull_request) Successful in 15s
CI / lint (pull_request) Successful in 3s
The agent's dist-upgrade simulation already finds new-ABI kernels and
security updates, but only once apt's lists know about them. Debian
doesn't refresh lists by default, so a kernel security release could
stay invisible until someone ran apt update.

install.sh --with-apt-update adds a marker that enables
kernelwatch-apt-update.service, a sandboxed root oneshot the agent pulls
in before each report. Failures (no network, apt lock held) are ignored
so the report still goes out. deploy.sh now ships the unit; a test keeps
deploy.sh's file list in sync with what install.sh uses.

Agent 0.3.2, server 0.3.3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 17:13:55 -04:00
patrickandClaude Opus 5.5 792161edaa Add Gitea Actions CI: tests on Python 3.10-3.13 and shellcheck
CI / tests (Python 3.10) (pull_request) Failing after 4s
CI / tests (Python 3.11) (pull_request) Failing after 4s
CI / tests (Python 3.12) (pull_request) Failing after 3s
CI / tests (Python 3.13) (pull_request) Failing after 3s
CI / lint (pull_request) Successful in 4s
The matrix covers the Python versions on Ubuntu 22.04/24.04 and Debian
12/13. make lint now includes deploy.sh, and its token check is
rewritten as an if statement to satisfy shellcheck SC2015.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 15:26:50 -04:00
patrickandClaude Opus 5.5 06118a1bee Document putting the dashboard behind Authelia
Forward auth via nginx auth_request, with /api/v1/report bypassed so
agents keep reporting with their bearer tokens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 15:24:44 -04:00
patrickandClaude Opus 5.5 45af8bc1f8 Give phased updates their own dashboard column
The "+N phased" suffix in the Updates cell was easy to miss and only
appeared when something was deferred. Add a Phased column instead:
the count (hover for the packages), "0" when nothing is deferred, "–"
on distributions that don't phase (Debian), "?" for agents too old to
report it. Dashboard-only; no agent redeploy needed. Server 0.3.1.

Also list Ubuntu 26.04 as tested in the agent installer and README
(already reporting fine from a 26.04 host).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 13:09:15 -04:00
patrickandClaude Opus 5.5 271af3b071 Show Ubuntu phased updates separately from available updates
apt lists updates deferred by phasing in an indented block rather than
as Inst lines, so they were already excluded from the counts but
invisible. The agent now parses that block into phased_packages; the
dashboard shows "+N phased" in the Updates column (with a tooltip) and
the list on the host page. Phasing never affects status: Ubuntu doesn't
phase security updates, and there's nothing to act on until apt offers
the update.

Run the apt simulation with LC_ALL=C since we parse its messages (the
systemd unit already runs in the C locale; manual --print may not).
Agent and server 0.3.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 12:03:02 -04:00
patrickandClaude Opus 5.5 834c1459c0 Report services needing a restart via a separate root needrestart unit
needrestart has to inspect every process, which an unprivileged agent
can't (and unprivileged it gave false kernel results). Add
kernelwatch-needrestart.service: root with only CAP_SYS_PTRACE and
CAP_DAC_READ_SEARCH, PrivateNetwork=yes, list-only (-r l). It writes
`needrestart -b` output to /run/kernelwatch/needrestart; the agent unit
pulls it in before each report and reads the file (ignored if older than
2h). The agent no longer runs needrestart itself. Skipped cleanly when
needrestart isn't installed: the dashboard shows "?" and status is
unaffected.

Server: services_need_restart / sessions_need_restart fields, an
"update"-level reason, a Services column, and a note (not an escalation)
for hosts running an agent older than the one shipped with the server.

install.sh --with-needrestart installs needrestart and sets it to list
services after apt upgrades instead of prompting; deploy.sh passes
anything after `--` to install.sh. Agent 0.2.0, server 0.2.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 11:54:39 -04:00
patrickandClaude Opus 5.5 69d4cf6363 Add agent/deploy.sh: install and upgrade agents over SSH
Run from a workstation checkout; hosts need no git or Gitea access.
A plain run upgrades every host in agent/hosts (config and token kept);
--register runs `kernelwatch add-host --token-only` on the dashboard
over SSH and hands the token to the host on stdin, never argv or the
terminal; --rotate does the same with rotate-token. Newly registered
hosts are appended to agent/hosts. Failures are summarised and don't
stop the rest of the fleet.

Supporting changes: install.sh --token-file, and --token-only on
`kernelwatch add-host` / `rotate-token`. Tested end to end with ssh and
sudo stubbed to run locally against the real CLI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 11:51:15 -04:00
patrickandClaude Opus 5.5 818a2e7a1c README: add CloudPanel setup section
Run kernelwatch outside the site user's htdocs, create the site as a
Reverse Proxy to a free local port (8080 may be taken by Varnish's
backend), and check the generated vhost forwards Host and
X-Forwarded-For and doesn't serve /static from the empty docroot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 10:33:46 -04:00
patrickandClaude Opus 5.5 16d647cf9c Support Ubuntu 22.04 (agent and server on Python 3.10)
The server only needed Python 3.11 for tomllib. Fall back to a small
parser for the flat key = value subset the config uses, checked against
tomllib on the shipped example. Relax the installer's version check to
3.10 and list Ubuntu 22.04 as supported for agents and server.

Add status tests using uname -v / package versions captured from real
22.04.5 and 24.04.4 HWE hosts, confirming the Ubuntu build mapping.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 10:23:00 -04:00
patrickandClaude Opus 5.5 48f2d155af Run the agent unprivileged; detect in-place kernel upgrades
The agent ran as (capability-less) root only so needrestart could read
Ubuntu's root-only /boot images. Switch the unit to DynamicUser=yes and
make needrestart optional.

To cover the case needrestart was catching (running kernel's package
upgraded in place, same uname -r), the agent now reports the installed
package version of the running kernel and the server compares it with
the build in uname -v: "Debian 6.12.57-1" vs 6.12.57-1 on Debian,
"#85-Ubuntu" / "#33~24.04.1-Ubuntu" vs the upload part of 6.8.0-85.85 /
6.14.0-33.33~24.04.1 on Ubuntu. Unrecognised builds fall back to
needrestart and the newest-installed comparison.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 10:19:41 -04:00
patrickandClaude Opus 5.5 07749b01b0 Scaffold kernelwatch: fleet kernel status agent and dashboard
Agent: bash script run hourly by a hardened systemd timer on Debian 12/13
and Ubuntu 24.04. Collects running vs installed kernel (needrestart when
available), pending/security updates via a read-only apt simulation,
reboot-required state and apt list freshness, and POSTs them as JSON.

Server: stdlib-only Python + SQLite (system python3 >= 3.11). Token-bound
ingest API, login-protected dashboard with per-host status
(stale/reboot/update/ok) and history, admin CLI, systemd unit and installer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 10:15:06 -04:00