Skip to content

Commit f445ee1

Browse files
committed
contrib/apparmor: remove remaining version-conditionals (< 2.9) from template
Commit 2e19a4d removed all other version- conditional statements from the AppArmor template, but left this one in place. These conditions were added in 8cf8924 to account for old versions of debian/ubuntu (apparmor_parser < 2.9) that lacked some options; > This allows us to use the apparmor profile we have in contrib/apparmor/ > and solves the problems where certain functions are not apparent on older > versions of apparmor_parser on debian/ubuntu. Those patches were from 2015/2016, and all currently supported distro versions should now have more current versions than that. Looking at the oldest supported versions; Ubuntu 18.04 "Bionic": apparmor_parser --version AppArmor parser version 2.12 Copyright (C) 1999-2008 Novell Inc. Copyright 2009-2012 Canonical Ltd. Debian 10 "Buster" apparmor_parser --version AppArmor parser version 2.13.2 Copyright (C) 1999-2008 Novell Inc. Copyright 2009-2018 Canonical Ltd. This patch removes the remaining conditionals. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 88f4bf4 commit f445ee1

2 files changed

Lines changed: 2 additions & 16 deletions

File tree

contrib/apparmor/main.go

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,9 @@ import (
66
"os"
77
"path"
88
"text/template"
9-
10-
"github.com/docker/docker/pkg/aaparser"
119
)
1210

13-
type profileData struct {
14-
Version int
15-
}
11+
type profileData struct{}
1612

1713
func main() {
1814
if len(os.Args) < 2 {
@@ -22,15 +18,6 @@ func main() {
2218
// parse the arg
2319
apparmorProfilePath := os.Args[1]
2420

25-
version, err := aaparser.GetVersion()
26-
if err != nil {
27-
log.Fatal(err)
28-
}
29-
data := profileData{
30-
Version: version,
31-
}
32-
fmt.Printf("apparmor_parser is of version %+v\n", data)
33-
3421
// parse the template
3522
compiled, err := template.New("apparmor_profile").Parse(dockerProfileTemplate)
3623
if err != nil {
@@ -48,6 +35,7 @@ func main() {
4835
}
4936
defer f.Close()
5037

38+
data := profileData{}
5139
if err := compiled.Execute(f, data); err != nil {
5240
log.Fatalf("executing template failed: %v", err)
5341
}

contrib/apparmor/template.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,7 @@ profile /usr/bin/docker (attach_disconnected, complain) {
149149
}
150150
# xz works via pipes, so we do not need access to the filesystem.
151151
profile /usr/bin/xz (complain) {
152-
{{if ge .Version 209000}}
153152
signal (receive) peer=/usr/bin/docker,
154-
{{end}}
155153
/etc/ld.so.cache r,
156154
/lib/** rm,
157155
/usr/bin/xz rm,

0 commit comments

Comments
 (0)