feat(aa): improve rule creation from log.
This commit is contained in:
parent
13de4182c8
commit
c7485326e8
15 changed files with 62 additions and 57 deletions
|
|
@ -13,7 +13,24 @@ type Qualifier struct {
|
|||
FileInherit bool
|
||||
}
|
||||
|
||||
func NewQualifier(owner, noNewPrivs, fileInherit bool) Qualifier {
|
||||
func NewQualifierFromLog(log map[string]string) Qualifier {
|
||||
owner := false
|
||||
fsuid, hasFsUID := log["fsuid"]
|
||||
ouid, hasOuUID := log["ouid"]
|
||||
OUID, hasOUID := log["OUID"]
|
||||
isDbus := strings.Contains(log["operation"], "dbus")
|
||||
if hasFsUID && hasOuUID && hasOUID && fsuid == ouid && OUID != "root" && !isDbus {
|
||||
owner = true
|
||||
}
|
||||
|
||||
fileInherit := false
|
||||
if log["operation"] == "file_inherit" {
|
||||
fileInherit = true
|
||||
}
|
||||
noNewPrivs := false
|
||||
if log["error"] == "-1" {
|
||||
noNewPrivs = true
|
||||
}
|
||||
return Qualifier{
|
||||
Audit: false,
|
||||
AccessType: "",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue