- Bundle the server into dist/rotrouter.cjs with esbuild (npm run build), so the package needs only nodejs at runtime and is arch=any. - Read the config and static file paths from ROTROUTER_CONFIG and ROTROUTER_PUBLIC (defaults unchanged for npm start). - PKGBUILD for rotrouter-git and a hardened systemd unit running as a DynamicUser without capabilities. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
49 lines
1.3 KiB
Desktop File
49 lines
1.3 KiB
Desktop File
[Unit]
|
|
Description=RotRouter - N1MM antenna rotator router
|
|
Wants=network-online.target
|
|
After=network-online.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
Environment=ROTROUTER_CONFIG=/etc/rotrouter/config.json
|
|
Environment=ROTROUTER_PUBLIC=/usr/share/rotrouter/public
|
|
ExecStart=/usr/bin/node /usr/lib/rotrouter/rotrouter.cjs
|
|
Restart=on-failure
|
|
RestartSec=5
|
|
|
|
# Run as an unprivileged user that systemd allocates on start and releases on
|
|
# stop; nothing has to be created at install time. Ports 8787 (HTTP) and
|
|
# 12040 (N1MM UDP) are above 1024, so no capabilities are needed.
|
|
User=rotrouter
|
|
DynamicUser=yes
|
|
CapabilityBoundingSet=
|
|
AmbientCapabilities=
|
|
NoNewPrivileges=yes
|
|
UMask=0077
|
|
|
|
# Read-only view of the system; the service writes nothing to disk.
|
|
ProtectSystem=strict
|
|
ProtectHome=yes
|
|
PrivateTmp=yes
|
|
PrivateDevices=yes
|
|
ProtectProc=invisible
|
|
ProcSubset=pid
|
|
ProtectClock=yes
|
|
ProtectHostname=yes
|
|
ProtectKernelTunables=yes
|
|
ProtectKernelModules=yes
|
|
ProtectKernelLogs=yes
|
|
ProtectControlGroups=yes
|
|
|
|
RestrictAddressFamilies=AF_INET AF_INET6
|
|
RestrictNamespaces=yes
|
|
RestrictRealtime=yes
|
|
LockPersonality=yes
|
|
SystemCallArchitectures=native
|
|
SystemCallFilter=@system-service
|
|
SystemCallErrorNumber=EPERM
|
|
# MemoryDenyWriteExecute is deliberately not set: V8's JIT needs W+X memory.
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|