- Auto-enrollment on startup when certs are missing/invalid and enrollment.manager_url configured - Certificate validation (existence, parse, expiry, key match, CA trust) - --enroll exits after completion (no port conflict with systemd service) - --renew-certs flag for manual cert renewal - SO_REUSEADDR on TcpListener::bind (prevents Address already in use) - Polling token persistence for enrollment resume after restart - Exit code strategy (0=clean, 1=error, 2=enrollment in progress) - HTTP 409 (host already exists) handling during enrollment - Move 'Listening on' log after actual bind - Increase RestartSec to 10s and add StartLimitBurst=5 - Postinst checks for certs and enrollment URL, prints guidance - EnrollmentConfig.manager_url changed to Option<String> - cert_renewal_threshold_days and polling_token config fields - Updated SPEC.md and DEPLOYMENT_GUIDE.md with new workflow - RCA document for crash loop root cause analysis - Version bumped to 1.2.0
65 lines
1.8 KiB
Desktop File
65 lines
1.8 KiB
Desktop File
[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=10s
|
|
StartLimitBurst=5
|
|
StartLimitIntervalSec=300
|
|
TimeoutStopSec=30s
|
|
|
|
# Process management
|
|
RuntimeDirectory=linux-patch-api
|
|
RuntimeDirectoryMode=0755
|
|
|
|
# Security hardening
|
|
# NOTE: Package management requires extensive system access. The following
|
|
# restrictions have been removed because they block core functionality:
|
|
# - ProtectSystem=strict: Blocks writes to /usr, /etc, /lib where packages install
|
|
# - NoNewPrivileges: Blocks sudo/setuid which apt needs for _apt sandbox
|
|
# - RestrictSUIDSGID: Blocks setuid/setgid which apt needs for _apt sandbox
|
|
# - CapabilityBoundingSet: Drops capabilities that apt needs (SETUID, SETGID, CHOWN, etc.)
|
|
# - AmbientCapabilities: Same issue as CapabilityBoundingSet
|
|
# Network security is provided by mTLS + IP whitelist. The service runs as root
|
|
# and MUST be able to install/remove/update packages system-wide.
|
|
ProtectHome=true
|
|
PrivateTmp=true
|
|
ProtectHostname=true
|
|
ProtectClock=true
|
|
ProtectKernelTunables=true
|
|
ProtectKernelModules=true
|
|
ProtectKernelLogs=true
|
|
RestrictNamespaces=true
|
|
LockPersonality=true
|
|
MemoryDenyWriteExecute=false
|
|
RestrictRealtime=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
|