Skip to content

Commit c7fd1a3

Browse files
authored
Merge pull request containerd#13274 from k8s-infra-cherrypick-robot/cherry-pick-13268-to-release/2.1
[release/2.1] apparmor: Set abi conditionally
2 parents d0191d0 + eba90da commit c7fd1a3

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

contrib/apparmor/template.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ import (
4040
const dir = "/etc/apparmor.d"
4141

4242
const defaultTemplate = `
43-
abi <abi/3.0>,
44-
43+
{{if .Abi}}abi <{{.Abi}}>,
44+
{{end}}
4545
{{range $value := .Imports}}
4646
{{$value}}
4747
{{end}}
@@ -98,6 +98,7 @@ profile {{.Name}} flags=(attach_disconnected,mediate_deleted) {
9898
`
9999

100100
type data struct {
101+
Abi string
101102
Name string
102103
Imports []string
103104
InnerImports []string
@@ -120,6 +121,11 @@ func loadData(name string) (*data, error) {
120121
Name: name,
121122
}
122123

124+
const abi = "abi/3.0"
125+
if macroExists(abi) {
126+
p.Abi = abi
127+
}
128+
123129
if macroExists("tunables/global") {
124130
p.Imports = append(p.Imports, "#include <tunables/global>")
125131
} else {

0 commit comments

Comments
 (0)