← All notes · 2026-09-29 · 4 min read

Minimal Systemd Hardening Checklist for Go Binaries

Reducing blast radius for small internal HTTP services with ProtectSystem, dynamic users, and socket limits.

linuxsystemdops

Start with filesystem isolation

Static Go binaries need almost nothing from the host filesystem at runtime. Even if an application only binds a loopback port behind nginx, isolating the unit keeps accidental path bugs harmless.

Combining ProtectSystem=strict, ProtectHome=true, and PrivateTmp=true takes three lines and works on every modern Debian and Ubuntu release.

[Service]
User=www-data
NoNewPrivileges=true
ProtectSystem=strict
ProtectHome=true
PrivateTmp=true
CapabilityBoundingSet=

Timeouts and restart cadence

Setting Restart=always with RestartSec=3 and TimeoutStopSec=10 ensures graceful HTTP shutdowns have time to drain active keep-alive connections without hanging package upgrades.