summaryrefslogtreecommitdiff
path: root/profiles
diff options
context:
space:
mode:
authorAleksa Sarai <asarai@suse.com>2016-02-14 18:04:16 +1100
committerAleksa Sarai <asarai@suse.com>2016-02-15 20:36:07 +1100
commit4bf7a84c969b9309b0534a61af55b8bb824acc0a (patch)
treed82c7081df3be8dbb4b55573b746d4f2a0edb6e2 /profiles
parent7d9532552b433581253898052849524500a21ff5 (diff)
downloaddocker-4bf7a84c969b9309b0534a61af55b8bb824acc0a.tar.gz
apparmor: fix version checks to work properly
Using {{if major}}{{if minor}} doesn't work as expected when the major version changes. In addition, this didn't support patch levels (which is necessary in some cases when distributions ship apparmor weirdly). Signed-off-by: Aleksa Sarai <asarai@suse.com>
Diffstat (limited to 'profiles')
-rw-r--r--profiles/apparmor/apparmor.go6
-rw-r--r--profiles/apparmor/template.go8
2 files changed, 6 insertions, 8 deletions
diff --git a/profiles/apparmor/apparmor.go b/profiles/apparmor/apparmor.go
index 46178886e6..ab139a860a 100644
--- a/profiles/apparmor/apparmor.go
+++ b/profiles/apparmor/apparmor.go
@@ -30,10 +30,8 @@ type profileData struct {
Imports []string
// InnerImports defines the apparmor functions to import in the profile.
InnerImports []string
- // MajorVersion is the apparmor_parser major version.
- MajorVersion int
- // MinorVersion is the apparmor_parser minor version.
- MinorVersion int
+ // Version is the {major, minor, patch} version of apparmor_parser as a single number.
+ Version int
}
// generateDefault creates an apparmor profile from ProfileData.
diff --git a/profiles/apparmor/template.go b/profiles/apparmor/template.go
index d52748c2bf..2e2594a1e3 100644
--- a/profiles/apparmor/template.go
+++ b/profiles/apparmor/template.go
@@ -38,13 +38,13 @@ profile {{.Name}} flags=(attach_disconnected,mediate_deleted) {
deny /sys/firmware/efi/efivars/** rwklx,
deny /sys/kernel/security/** rwklx,
-{{if ge .MajorVersion 2}}{{if ge .MinorVersion 8}}
+{{if ge .Version 208000}}
# suppress ptrace denials when using 'docker ps' or using 'ps' inside a container
ptrace (trace,read) peer=docker-default,
-{{end}}{{end}}
-{{if ge .MajorVersion 2}}{{if ge .MinorVersion 9}}
+{{end}}
+{{if ge .Version 209000}}
# docker daemon confinement requires explict allow rule for signal
signal (receive) set=(kill,term) peer={{.ExecPath}},
-{{end}}{{end}}
+{{end}}
}
`