feat(aa-log): add support for mqueue.

This commit is contained in:
Alexandre Pujol 2023-12-05 20:47:32 +00:00
parent 319b976beb
commit 735e3529fb
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
5 changed files with 38 additions and 3 deletions

View file

@ -4,19 +4,29 @@
package aa
import "strings"
type Mqueue struct {
Qualifier
Access string
Type string
Label string
Name string
}
func MqueueFromLog(log map[string]string) ApparmorRule {
mqueueType := "posix"
if strings.Contains(log["class"], "posix") {
mqueueType = "posix"
} else if strings.Contains(log["class"], "sysv") {
mqueueType = "sysv"
}
return &Mqueue{
Qualifier: NewQualifierFromLog(log),
Access: maskToAccess[log["requested_mask"]],
Type: log["type"],
Access: maskToAccess[log["requested"]],
Type: mqueueType,
Label: log["label"],
Name: log["name"],
}
}