A Practical systemd Unit Hardening Checklist for Go Services
Static Go binaries rarely need broad filesystem visibility or privileged capabilities. A short systemd drop-in can reduce exposure substantially with minimal operational overhead.
High-Value Directives
[Service]
NoNewPrivileges=yes
PrivateTmp=yes
ProtectSystem=strict
ProtectHome=yes
ReadWritePaths=/var/lib/myservice
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
SystemCallFilter=@system-service
Use systemd-analyze security myservice.service after reloading the daemon to verify the effective exposure score before rolling the unit to production.