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>
41 lines
1.3 KiB
Desktop File
41 lines
1.3 KiB
Desktop File
[Unit]
|
|
Description=Check for services needing a restart (for kernelwatch)
|
|
# Pulled in by kernelwatch-agent.service before each report. Skipped cleanly
|
|
# when needrestart isn't installed; the dashboard then shows "unknown".
|
|
ConditionPathExists=/usr/sbin/needrestart
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
# -b batch output, -r l list only: never restarts anything.
|
|
ExecStart=/bin/sh -c 'needrestart -b -r l > /run/kernelwatch/needrestart.new && mv /run/kernelwatch/needrestart.new /run/kernelwatch/needrestart'
|
|
RuntimeDirectory=kernelwatch
|
|
RuntimeDirectoryMode=0755
|
|
RuntimeDirectoryPreserve=yes
|
|
UMask=0022
|
|
|
|
# Root, but only with what needrestart needs to inspect every process
|
|
# (/proc/<pid>/maps of other users) and nothing else. No network at all.
|
|
User=root
|
|
CapabilityBoundingSet=CAP_SYS_PTRACE CAP_DAC_READ_SEARCH
|
|
AmbientCapabilities=
|
|
NoNewPrivileges=yes
|
|
PrivateNetwork=yes
|
|
ProtectSystem=strict
|
|
ProtectHome=read-only
|
|
PrivateTmp=yes
|
|
PrivateDevices=yes
|
|
ProtectKernelTunables=yes
|
|
ProtectKernelModules=yes
|
|
ProtectKernelLogs=yes
|
|
ProtectControlGroups=yes
|
|
ProtectClock=yes
|
|
ProtectHostname=yes
|
|
RestrictNamespaces=yes
|
|
RestrictRealtime=yes
|
|
RestrictSUIDSGID=yes
|
|
LockPersonality=yes
|
|
MemoryDenyWriteExecute=yes
|
|
RestrictAddressFamilies=AF_UNIX
|
|
SystemCallArchitectures=native
|
|
SystemCallFilter=@system-service
|