mirror of
https://github.com/roddhjav/apparmor.d.git
synced 2025-01-29 22:35: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
|
@ -87,15 +87,16 @@ func (p *AppArmorProfile) AddRule(log map[string]string) {
|
||||||
case "net":
|
case "net":
|
||||||
p.Rules = append(p.Rules, NetworkFromLog(log))
|
p.Rules = append(p.Rules, NetworkFromLog(log))
|
||||||
case "mount":
|
case "mount":
|
||||||
p.Rules = append(p.Rules, MountFromLog(log))
|
switch log["operation"] {
|
||||||
case "remount":
|
case "mount":
|
||||||
p.Rules = append(p.Rules, RemountFromLog(log))
|
p.Rules = append(p.Rules, MountFromLog(log))
|
||||||
case "umount":
|
case "umount":
|
||||||
p.Rules = append(p.Rules, UmountFromLog(log))
|
p.Rules = append(p.Rules, UmountFromLog(log))
|
||||||
case "pivot_root":
|
case "remount":
|
||||||
p.Rules = append(p.Rules, PivotRootFromLog(log))
|
p.Rules = append(p.Rules, RemountFromLog(log))
|
||||||
case "change_profile":
|
case "pivotroot":
|
||||||
p.Rules = append(p.Rules, RemountFromLog(log))
|
p.Rules = append(p.Rules, PivotRootFromLog(log))
|
||||||
|
}
|
||||||
case "mqueue":
|
case "mqueue":
|
||||||
p.Rules = append(p.Rules, MqueueFromLog(log))
|
p.Rules = append(p.Rules, MqueueFromLog(log))
|
||||||
case "signal":
|
case "signal":
|
||||||
|
@ -107,7 +108,11 @@ func (p *AppArmorProfile) AddRule(log map[string]string) {
|
||||||
case "unix":
|
case "unix":
|
||||||
p.Rules = append(p.Rules, UnixFromLog(log))
|
p.Rules = append(p.Rules, UnixFromLog(log))
|
||||||
case "file":
|
case "file":
|
||||||
p.Rules = append(p.Rules, FileFromLog(log))
|
if log["operation"] == "change_onexec" {
|
||||||
|
p.Rules = append(p.Rules, ChangeProfileFromLog(log))
|
||||||
|
} else {
|
||||||
|
p.Rules = append(p.Rules, FileFromLog(log))
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
if strings.Contains(log["operation"], "dbus") {
|
if strings.Contains(log["operation"], "dbus") {
|
||||||
p.Rules = append(p.Rules, DbusFromLog(log))
|
p.Rules = append(p.Rules, DbusFromLog(log))
|
||||||
|
|
|
@ -33,6 +33,7 @@ var (
|
||||||
// TODO: Should be a map of slice, not exhaustive yet
|
// TODO: Should be a map of slice, not exhaustive yet
|
||||||
maskToAccess = map[string]string{
|
maskToAccess = map[string]string{
|
||||||
"a": "w",
|
"a": "w",
|
||||||
|
"ac": "w",
|
||||||
"c": "w",
|
"c": "w",
|
||||||
"d": "w",
|
"d": "w",
|
||||||
"k": "k",
|
"k": "k",
|
||||||
|
|
Loading…
Reference in a new issue