Fawkes Notes

Minimal Systemd Sandboxing for Small Daemons

Most packaged network services ship conservative unit files so they work out of the box across varied setups. On single-purpose hosts, a short systemd drop-in override can cut the blast radius of a compromise with almost no maintenance overhead.

High-Value Directives

Rather than rewriting vendor unit files in /usr/lib/systemd/system/, place overrides under /etc/systemd/system/<unit>.service.d/security.conf:

[Service]
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=full
ProtectHome=true

For services that only need to bind privileged ports such as 80 or 443 while running under an unprivileged account, AmbientCapabilities=CAP_NET_BIND_SERVICE removes the need to run the main loop as root.

Checking Effective Exposure

After running systemctl daemon-reload, systemd-analyze security <service> reports which namespaces and filters are active and where additional restrictions can be applied safely.