mirror of
https://github.com/roddhjav/apparmor.d.git
synced 2025-01-18 08:58:15 +01:00
feat(aa-log): improve log to rule conversion.
This commit is contained in:
parent
58b577385e
commit
3197f52a97
2 changed files with 16 additions and 10 deletions
|
@ -86,16 +86,17 @@ func (p *AppArmorProfile) AddRule(log map[string]string) {
|
|||
p.Rules = append(p.Rules, CapabilityFromLog(log))
|
||||
case "net":
|
||||
p.Rules = append(p.Rules, NetworkFromLog(log))
|
||||
case "mount":
|
||||
switch log["operation"] {
|
||||
case "mount":
|
||||
p.Rules = append(p.Rules, MountFromLog(log))
|
||||
case "remount":
|
||||
p.Rules = append(p.Rules, RemountFromLog(log))
|
||||
case "umount":
|
||||
p.Rules = append(p.Rules, UmountFromLog(log))
|
||||
case "pivot_root":
|
||||
p.Rules = append(p.Rules, PivotRootFromLog(log))
|
||||
case "change_profile":
|
||||
case "remount":
|
||||
p.Rules = append(p.Rules, RemountFromLog(log))
|
||||
case "pivotroot":
|
||||
p.Rules = append(p.Rules, PivotRootFromLog(log))
|
||||
}
|
||||
case "mqueue":
|
||||
p.Rules = append(p.Rules, MqueueFromLog(log))
|
||||
case "signal":
|
||||
|
@ -107,7 +108,11 @@ func (p *AppArmorProfile) AddRule(log map[string]string) {
|
|||
case "unix":
|
||||
p.Rules = append(p.Rules, UnixFromLog(log))
|
||||
case "file":
|
||||
if log["operation"] == "change_onexec" {
|
||||
p.Rules = append(p.Rules, ChangeProfileFromLog(log))
|
||||
} else {
|
||||
p.Rules = append(p.Rules, FileFromLog(log))
|
||||
}
|
||||
default:
|
||||
if strings.Contains(log["operation"], "dbus") {
|
||||
p.Rules = append(p.Rules, DbusFromLog(log))
|
||||
|
|
|
@ -33,6 +33,7 @@ var (
|
|||
// TODO: Should be a map of slice, not exhaustive yet
|
||||
maskToAccess = map[string]string{
|
||||
"a": "w",
|
||||
"ac": "w",
|
||||
"c": "w",
|
||||
"d": "w",
|
||||
"k": "k",
|
||||
|
|
Loading…
Reference in a new issue