fix(auditd): load changed rules in the same run #29
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/auditd-load-rules"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
The auditd role wrote
/etc/audit/rules.dand stopped. A new or changed rule reached the kernel only at auditd's next start, which Debian's unit allows only at boot because it refuses a manual restart.What changed
augenrules --load, the stepauditd.serviceitself runs at start, so rules apply in the run that wrote them.-e 2) takes no new rules until it boots. The handlers readauditctl -sfirst and report that case rather than failing.auditd_load_rules(defaulttrue) turns the load off where the kernel's audit system is not the host's to set, such as a container.Verification
make checkpassed.make test(no podman in the agent sandbox). The auditd scenario now stubsauditctlandaugenrulesahead of the real ones on PATH, andverify.ymlasserts exactly oneaugenrules --load: once for the converge, none for the idempotence run.Risks and follow-ups
augenruleswithout its full path, the stub records a second call and the exact-one assertion fails.make testsettles it; the fix would be to assert at least one call.