feat(aa-log): improve log to rule conversion.
This commit is contained in:
parent
75a8ef2906
commit
9aaf109383
1 changed files with 12 additions and 5 deletions
|
|
@ -140,10 +140,16 @@ func (p *Profile) GetAttachments() string {
|
|||
var (
|
||||
newLogMap = map[string]func(log map[string]string) Rule{
|
||||
// class
|
||||
"rlimits": newRlimitFromLog,
|
||||
"namespace": newUsernsFromLog,
|
||||
"cap": newCapabilityFromLog,
|
||||
"net": newNetworkFromLog,
|
||||
"rlimits": newRlimitFromLog,
|
||||
"namespace": newUsernsFromLog,
|
||||
"cap": newCapabilityFromLog,
|
||||
"net": func(log map[string]string) Rule {
|
||||
if log["family"] == "unix" {
|
||||
return newUnixFromLog(log)
|
||||
} else {
|
||||
return newNetworkFromLog(log)
|
||||
}
|
||||
},
|
||||
"posix_mqueue": newMqueueFromLog,
|
||||
"sysv_mqueue": newMqueueFromLog,
|
||||
"signal": newSignalFromLog,
|
||||
|
|
@ -176,6 +182,7 @@ var (
|
|||
"open": newFileFromLog,
|
||||
"rename_dest": newFileFromLog,
|
||||
"rename_src": newFileFromLog,
|
||||
"rmdir": newFileFromLog,
|
||||
"truncate": newFileFromLog,
|
||||
"unlink": newFileFromLog,
|
||||
}
|
||||
|
|
@ -219,7 +226,7 @@ func (p *Profile) AddRule(log map[string]string) {
|
|||
case strings.Contains(log["operation"], "dbus"):
|
||||
p.Rules = append(p.Rules, newDbusFromLog(log))
|
||||
default:
|
||||
fmt.Printf("unknown log type: %s\n", log["operation"])
|
||||
fmt.Printf("unknown log type: %s:%v\n", log["operation"], log)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue