feat(aa-log): add support for mqueue.
This commit is contained in:
parent
319b976beb
commit
735e3529fb
5 changed files with 38 additions and 3 deletions
|
|
@ -4,19 +4,29 @@
|
||||||
|
|
||||||
package aa
|
package aa
|
||||||
|
|
||||||
|
import "strings"
|
||||||
|
|
||||||
type Mqueue struct {
|
type Mqueue struct {
|
||||||
Qualifier
|
Qualifier
|
||||||
Access string
|
Access string
|
||||||
Type string
|
Type string
|
||||||
Label string
|
Label string
|
||||||
|
Name string
|
||||||
}
|
}
|
||||||
|
|
||||||
func MqueueFromLog(log map[string]string) ApparmorRule {
|
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{
|
return &Mqueue{
|
||||||
Qualifier: NewQualifierFromLog(log),
|
Qualifier: NewQualifierFromLog(log),
|
||||||
Access: maskToAccess[log["requested_mask"]],
|
Access: maskToAccess[log["requested"]],
|
||||||
Type: log["type"],
|
Type: mqueueType,
|
||||||
Label: log["label"],
|
Label: log["label"],
|
||||||
|
Name: log["name"],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ func (p *AppArmorProfile) AddRule(log map[string]string) {
|
||||||
case "pivotroot":
|
case "pivotroot":
|
||||||
p.Rules = append(p.Rules, PivotRootFromLog(log))
|
p.Rules = append(p.Rules, PivotRootFromLog(log))
|
||||||
}
|
}
|
||||||
case "mqueue":
|
case "posix_mqueue", "sysv_mqueue":
|
||||||
p.Rules = append(p.Rules, MqueueFromLog(log))
|
p.Rules = append(p.Rules, MqueueFromLog(log))
|
||||||
case "signal":
|
case "signal":
|
||||||
p.Rules = append(p.Rules, SignalFromLog(log))
|
p.Rules = append(p.Rules, SignalFromLog(log))
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,14 @@ var (
|
||||||
"a": "w",
|
"a": "w",
|
||||||
"ac": "w",
|
"ac": "w",
|
||||||
"c": "w",
|
"c": "w",
|
||||||
|
"create": "create",
|
||||||
"d": "w",
|
"d": "w",
|
||||||
|
"delete": "delete",
|
||||||
|
"getattr": "getattr",
|
||||||
"k": "k",
|
"k": "k",
|
||||||
"l": "l",
|
"l": "l",
|
||||||
"m": "rm",
|
"m": "rm",
|
||||||
|
"open": "open",
|
||||||
"r": "r",
|
"r": "r",
|
||||||
"ra": "rw",
|
"ra": "rw",
|
||||||
"read write": "read write",
|
"read write": "read write",
|
||||||
|
|
@ -49,6 +53,7 @@ var (
|
||||||
"rw": "rw",
|
"rw": "rw",
|
||||||
"send receive": "send receive",
|
"send receive": "send receive",
|
||||||
"send": "send",
|
"send": "send",
|
||||||
|
"setattr": "setattr",
|
||||||
"w": "w",
|
"w": "w",
|
||||||
"wc": "w",
|
"wc": "w",
|
||||||
"wd": "w",
|
"wd": "w",
|
||||||
|
|
|
||||||
|
|
@ -161,6 +161,25 @@
|
||||||
{{- template "comment" . -}}
|
{{- template "comment" . -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- if eq $type "Mqueue" -}}
|
||||||
|
{{- template "qualifier" . -}}
|
||||||
|
{{- "mqueue" -}}
|
||||||
|
{{- with .Access -}}
|
||||||
|
{{ " " }}{{ . }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- with .Type -}}
|
||||||
|
{{ " type=" }}{{ . }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- with .Label -}}
|
||||||
|
{{ " label=" }}{{ . }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- with .Name -}}
|
||||||
|
{{ " " }}{{ . }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- "," -}}
|
||||||
|
{{- template "comment" . -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
{{- if eq $type "Unix" -}}
|
{{- if eq $type "Unix" -}}
|
||||||
{{- template "qualifier" . -}}
|
{{- template "qualifier" . -}}
|
||||||
{{- "unix" -}}
|
{{- "unix" -}}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ var (
|
||||||
regAbi4To3 = util.ToRegexRepl([]string{ // Currently Abi3 -> Abi4
|
regAbi4To3 = util.ToRegexRepl([]string{ // Currently Abi3 -> Abi4
|
||||||
`abi/3.0`, `abi/4.0`,
|
`abi/3.0`, `abi/4.0`,
|
||||||
`# userns,`, `userns,`,
|
`# userns,`, `userns,`,
|
||||||
|
`# mqueue`, `mqueue`,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue