brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: systemd-analyze security scores how locked down a service is

Systemd
~/tips/tip-systemd-analyze-security-score

systemd-analyze security nginx.service

Rates the sandboxing of a service from 0 to 10 and lists the options that are still open.

I use this as a checklist when I harden a unit file, because it tells me which options are still missing.

systemd-analyze security nginx.service
systemd-analyze security --no-pager | head

With a unit name it prints a table of sandboxing settings, each with an exposure value, and ends with an overall exposure level from 0.0 to 10.0 plus a label such as OK. Without a name it rates all loaded, long-running services. The score is a heuristic: a high number means open settings, not a vulnerability. Raising it with ProtectSystem= and similar options can break the service, so test after each change.

Further reading: systemd-analyze manual page

More Systemd tips [Service] sudo mkdir -p /etc/systemd/system/service.d [Service] printf 'hunter2' | sudo systemd-creds encrypt --name=dbpass – dbpass.cred systemd-analyze timespan 1h30min All Systemd tips (88) All topics

Link