Skip to content

Commit c4c5468

Browse files
committed
Revert "apparmor: Check if apparmor_parser is available"
This reverts commit ab3fa46. This fix was partial, and is not needed with the proper fix in containerd. Signed-off-by: Bjorn Neergaard <[email protected]>
1 parent 174802e commit c4c5468

File tree

1 file changed

+1
-22
lines changed

1 file changed

+1
-22
lines changed

daemon/apparmor_default.go

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,9 @@ package daemon // import "github.com/docker/docker/daemon"
55

66
import (
77
"fmt"
8-
"os"
9-
"sync"
108

119
"github.com/containerd/containerd/pkg/apparmor"
1210
aaprofile "github.com/docker/docker/profiles/apparmor"
13-
"github.com/sirupsen/logrus"
1411
)
1512

1613
// Define constants for native driver
@@ -19,11 +16,6 @@ const (
1916
defaultAppArmorProfile = "docker-default"
2017
)
2118

22-
var (
23-
checkAppArmorOnce sync.Once
24-
isAppArmorAvailable bool
25-
)
26-
2719
// DefaultApparmorProfile returns the name of the default apparmor profile
2820
func DefaultApparmorProfile() string {
2921
if apparmor.HostSupports() {
@@ -33,20 +25,7 @@ func DefaultApparmorProfile() string {
3325
}
3426

3527
func ensureDefaultAppArmorProfile() error {
36-
checkAppArmorOnce.Do(func() {
37-
if apparmor.HostSupports() {
38-
// Restore the apparmor_parser check removed in containerd:
39-
// https://github.com/containerd/containerd/commit/1acca8bba36e99684ee3489ea4a42609194ca6b9
40-
// Fixes: https://github.com/moby/moby/issues/44900
41-
if _, err := os.Stat("/sbin/apparmor_parser"); err == nil {
42-
isAppArmorAvailable = true
43-
} else {
44-
logrus.Warn("AppArmor enabled on system but \"apparmor_parser\" binary is missing, so profile can't be loaded")
45-
}
46-
}
47-
})
48-
49-
if isAppArmorAvailable {
28+
if apparmor.HostSupports() {
5029
loaded, err := aaprofile.IsLoaded(defaultAppArmorProfile)
5130
if err != nil {
5231
return fmt.Errorf("Could not check if %s AppArmor profile was loaded: %s", defaultAppArmorProfile, err)

0 commit comments

Comments
 (0)