mirror of
https://github.com/containerd/containerd.git
synced 2026-08-09 09:33:06 +00:00
apparmor: Set abi conditionally
The "abi" keyword was added for apparmor 3.0 The original change to add this ended up breaking versions < 3.0. The abi itself is a macro in /etc/apparmor.d so we can check if the macro exists to determine if we *can* set an abi in the template. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
@@ -40,8 +40,8 @@ import (
|
||||
const dir = "/etc/apparmor.d"
|
||||
|
||||
const defaultTemplate = `
|
||||
abi <abi/3.0>,
|
||||
|
||||
{{if .Abi}}abi <{{.Abi}}>,
|
||||
{{end}}
|
||||
{{range $value := .Imports}}
|
||||
{{$value}}
|
||||
{{end}}
|
||||
@@ -96,6 +96,7 @@ profile {{.Name}} flags=(attach_disconnected,mediate_deleted) {
|
||||
`
|
||||
|
||||
type data struct {
|
||||
Abi string
|
||||
Name string
|
||||
Imports []string
|
||||
InnerImports []string
|
||||
@@ -118,6 +119,11 @@ func loadData(name string) (*data, error) {
|
||||
Name: name,
|
||||
}
|
||||
|
||||
const abi = "abi/3.0"
|
||||
if macroExists(abi) {
|
||||
p.Abi = abi
|
||||
}
|
||||
|
||||
if macroExists("tunables/global") {
|
||||
p.Imports = append(p.Imports, "#include <tunables/global>")
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user