feat: Add qualifiers
field to BPF enforcer custom rule interfaces
#257
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does
Extends the BPF enforcer’s custom rule interface with a
qualifiers
field across core rule types, enabling users to specify rule behavior modifiers (e.g.,deny
,audit
)—aligning with AppArmor’s familiar syntax. This allows granular control over custom rule actions inEnhancedProtect
mode, supporting use cases like rule testing and targeted audit-only monitoring.Key Features Added
Qualifiers []string
field to 7 core BPF rule structs to define rule behavior:FileRule
(file/process access control)Service
/Pod
/Destination
(network egress targeting)NetworkSocketRule
(socket operation control)PtraceRule
(process tracing restrictions)MountRule
(filesystem mount control)qualifiers
values and behavior:["deny"]
: Blocks matching behavior without auditing.["audit"]
: Logs matching behavior without blocking (observation mode for the rule).["audit", "deny"]
: Block and logs matching behavior.Benefits
audit
mode to validate coverage before switching todeny
, minimizing operational risk.Related Issue
Fixes #248
Notes
The
allow
qualifier is not supported for now. The BPF enforcer’s Allow-by-Default model permits actions unless explicitly restricted viadeny
.