fix(systemd_hardening): look up the listed units instead of listing every unit file
Build / build (pull_request) Successful in 20s
Molecule / molecule (pull_request) Canceled after 0s
Lint / lint (pull_request) Canceled after 38s

The role listed every service unit file to answer one question: is each
unit in its disable and mask lists installed? The listing keeps PID 1 busy
for as long as the host has unit files. Ask about the listed units only,
with one `systemctl show --property=LoadState`; a unit with no unit file
reports `not-found` and is skipped as before.

An instance name such as [email protected] is now matched when its template
exists. A template name such as [email protected] makes the lookup fail, where
the listing matched it.

Closes #283

Assisted-by: Claude Code
This commit is contained in:
Dragonish committed 2026-11-22 19:41:23 +00:00
1 parent 5962b9b6fb
commit 6c2d124b3f
4 files changed
+54 -17

No files matched your search

@@ -0,0 +1,8 @@
---
bugfixes:
- >-
systemd_hardening - Look up the listed units with one ``systemctl show`` instead of listing every unit
file. The listing can keep PID 1 busy for seconds on a host with slow storage, and the cost grows with
the number of unit files. A unit is still skipped when it has no unit file. An instance name such as
``[email protected]`` is now matched when its template exists, and a template name such as
``[email protected]`` in the lists now makes the lookup fail instead of matching.