[Unit] Description=Linux Patch API - Secure Remote Package Management Documentation=man:linux-patch-api(8) After=network-online.target Wants=network-online.target [Service] Type=simple NotifyAccess=all ExecStart=/usr/bin/linux-patch-api --config /etc/linux_patch_api/config.yaml Restart=on-failure RestartSec=5s TimeoutStopSec=30s # Process management RuntimeDirectory=linux-patch-api RuntimeDirectoryMode=0755 # Security hardening # Allow reboot capability for scheduled reboots CapabilityBoundingSet=CAP_SYS_BOOT AmbientCapabilities=CAP_SYS_BOOT # ProtectSystem removed - package management requires write access to /usr, /etc, /lib # Network security provided by mTLS + IP whitelist ProtectHome=true # ReadWritePaths kept as documentation reference for apt/dpkg paths ReadWritePaths=/var/lib/linux_patch_api /var/log/linux_patch_api /var/cache/apt /var/lib/apt /var/lib/dpkg /var/log/apt PrivateTmp=true PrivateDevices=true ProtectHostname=true ProtectClock=true ProtectKernelTunables=true ProtectKernelModules=true ProtectKernelLogs=true RestrictNamespaces=true LockPersonality=true MemoryDenyWriteExecute=false RestrictRealtime=true # RestrictSUIDSGID removed - package management requires setuid/setgid for apt/dpkg RemoveIPC=true # System call filtering (whitelist approach) SystemCallFilter=@system-service SystemCallErrorNumber=EPERM # Environment Environment="RUST_BACKTRACE=1" Environment="DEBIAN_FRONTEND=noninteractive" Environment="RUST_LOG=info" # Logging StandardOutput=journal StandardError=journal SyslogIdentifier=linux-patch-api SyslogFacility=daemon SyslogLevel=info # Resource limits LimitNOFILE=65536 LimitNPROC=4096 [Install] WantedBy=multi-user.target