Skip to content

fix(gen-audit-rules): emit the unit-dir watch once per user, not per repo - #221

Merged
robercano merged 1 commit into
mainfrom
fix/gen-audit-rules-per-user-dedupe
Aug 6, 2026
Merged

fix(gen-audit-rules): emit the unit-dir watch once per user, not per repo#221
robercano merged 1 commit into
mainfrom
fix/gen-audit-rules-per-user-dedupe

Conversation

@robercano

Copy link
Copy Markdown
Owner

Problem

gen-audit-rules.sh emits the ~/.config/systemd/user/ watch inside the
per-registry-line loop, but that watch is a property of the agent user, not the
repo. When several repos are consolidated under one agent user — a topology the
registry format explicitly permits — the identical rule is generated once per repo,
and augenrules --load rejects the duplicate:

Error sending add rule data request (Rule exists)
There was an error in line 18 of /etc/audit/audit.rules

This recurs on every load, including every boot. The watching itself is
unaffected (the first copy loads), but a permanent load error on the audit layer is
noise that trains the operator to ignore audit failures.

Fix

Repo-scoped watches stay in the per-line loop; user-scoped watches move to a second
pass over sort -u unique users.

Verification

With a registry of two repos under one user: 12 -w rules, sort | uniq -d empty.
Found and reproduced live on BusyBee's first consolidated-registry load
(recode-agent hosting both reCode and reDeploy).

🤖 Generated with Claude Code

…repo

The ~/.config/systemd/user/ watch is a property of the agent USER, but the
generator emitted it inside the per-registry-line loop. With several repos
consolidated under one agent user -- a topology the registry explicitly
permits -- the identical rule is generated once per repo and auditd rejects
the duplicates ("Rule exists", error in audit.rules) on every load,
including every boot. A recurring load error on the audit layer is noise
that trains the operator to ignore the one channel that must stay credible.

Emit repo-scoped watches in the per-line loop and user-scoped watches in a
second pass over unique users. Found live on the first consolidated-registry
load (recode-agent hosting both reCode and reDeploy).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@robercano
robercano merged commit 2adf6d7 into main Aug 6, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant