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>
36 lines
928 B
Desktop File
36 lines
928 B
Desktop File
[Unit]
|
|
Description=Report kernel and update status to kernelwatch
|
|
Wants=network-online.target
|
|
After=network-online.target apt-daily.service
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
ExecStart=/usr/local/sbin/kernelwatch-agent
|
|
LoadCredential=token:/etc/kernelwatch/agent.token
|
|
|
|
# Everything the agent reads is world-readable, so it runs as a throwaway
|
|
# unprivileged user. The token credential is made readable to that user.
|
|
DynamicUser=yes
|
|
CapabilityBoundingSet=
|
|
AmbientCapabilities=
|
|
NoNewPrivileges=yes
|
|
ProtectSystem=strict
|
|
ProtectHome=yes
|
|
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 AF_INET AF_INET6
|
|
SystemCallArchitectures=native
|
|
SystemCallFilter=@system-service
|
|
UMask=0077
|