feat(aa): add the Kind struct to manage aa rules.

This commit is contained in:
Alexandre Pujol 2024-05-28 18:15:22 +01:00
parent 1333ec2025
commit 3b0944c615
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
23 changed files with 239 additions and 223 deletions

View file

@ -9,10 +9,10 @@ import (
"slices"
)
const tokCAPABILITY = "capability"
const CAPABILITY Kind = "capability"
func init() {
requirements[tokCAPABILITY] = requirement{
requirements[CAPABILITY] = requirement{
"name": {
"audit_control", "audit_read", "audit_write", "block_suspend", "bpf",
"checkpoint_restore", "chown", "dac_override", "dac_read_search",
@ -36,7 +36,7 @@ func newCapabilityFromLog(log map[string]string) Rule {
return &Capability{
RuleBase: newRuleFromLog(log),
Qualifier: newQualifierFromLog(log),
Names: Must(toValues(tokCAPABILITY, "name", log["capname"])),
Names: Must(toValues(CAPABILITY, "name", log["capname"])),
}
}
@ -70,6 +70,6 @@ func (r *Capability) Constraint() constraint {
return blockKind
}
func (r *Capability) Kind() string {
return tokCAPABILITY
func (r *Capability) Kind() Kind {
return CAPABILITY
}