feat(aa): add the Kind struct to manage aa rules.
This commit is contained in:
parent
1333ec2025
commit
3b0944c615
23 changed files with 239 additions and 223 deletions
|
|
@ -14,13 +14,14 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
PROFILE Kind = "profile"
|
||||
|
||||
tokATTRIBUTES = "xattrs"
|
||||
tokFLAGS = "flags"
|
||||
tokPROFILE = "profile"
|
||||
)
|
||||
|
||||
func init() {
|
||||
requirements[tokPROFILE] = requirement{
|
||||
requirements[PROFILE] = requirement{
|
||||
tokFLAGS: {
|
||||
"enforce", "complain", "kill", "default_allow", "unconfined",
|
||||
"prompt", "audit", "mediate_deleted", "attach_disconnected",
|
||||
|
|
@ -52,7 +53,7 @@ func newHeader(rule []string) (Header, error) {
|
|||
if rule[len(rule)-1] == "{" {
|
||||
rule = rule[:len(rule)-1]
|
||||
}
|
||||
if rule[0] == tokPROFILE {
|
||||
if rule[0] == PROFILE.Tok() {
|
||||
rule = rule[1:]
|
||||
}
|
||||
|
||||
|
|
@ -120,8 +121,8 @@ func (p *Profile) Constraint() constraint {
|
|||
return blockKind
|
||||
}
|
||||
|
||||
func (p *Profile) Kind() string {
|
||||
return tokPROFILE
|
||||
func (p *Profile) Kind() Kind {
|
||||
return PROFILE
|
||||
}
|
||||
|
||||
// Merge merge similar rules together.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue