Files
headscale/packaging/systemd/headscale.service
Kristoffer Dalby d2dc13696a config, cli, packaging, nix: stop restarting headscale on a configuration error
serve exits 78 (EX_CONFIG) when the configuration file it loaded is
wrong: format, syntax, keys or values. No file, an unreadable one, the
database and ports still exit 1, so systemd keeps retrying what can
heal. The deb unit and the NixOS module set RestartPreventExitStatus=78.
A parse error gives a position and fixed words, never the file's text.

Updates #1926
2026-11-11 15:02:16 +01:00

56 lines
1.3 KiB
Desktop File

[Unit]
After=network.target
Description=headscale coordination server for Tailscale
[Service]
Type=simple
User=headscale
Group=headscale
ExecStart=/usr/bin/headscale serve
ExecReload=/usr/bin/kill -HUP $MAINPID
Restart=always
RestartSec=5
# headscale serve exits 78 (EX_CONFIG) on a configuration it rejects, which
# a restart cannot fix.
RestartPreventExitStatus=78
WorkingDirectory=/var/lib/headscale
ReadWritePaths=/var/lib/headscale
AmbientCapabilities=CAP_NET_BIND_SERVICE
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
DevicePolicy=closed
LockPersonality=true
MemoryDenyWriteExecute=true
NoNewPrivileges=true
PrivateDevices=true
PrivateMounts=true
PrivateTmp=true
ProcSubset=pid
ProtectClock=true
ProtectControlGroups=true
ProtectHome=true
ProtectHostname=true
ProtectKernelLogs=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectProc=invisible
ProtectSystem=strict
RemoveIPC=true
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
RestrictNamespaces=true
RestrictRealtime=true
RestrictSUIDSGID=true
RuntimeDirectory=headscale
RuntimeDirectoryMode=0750
StateDirectory=headscale
StateDirectoryMode=0750
SystemCallArchitectures=native
SystemCallFilter=@system-service
SystemCallFilter=~@privileged
SystemCallFilter=~@resources
UMask=0077
[Install]
WantedBy=multi-user.target