Skip to content

Commit

Permalink
Revert "apparmor: Check if apparmor_parser is available"
Browse files Browse the repository at this point in the history
This reverts commit ab3fa46.

This fix was partial, and is not needed with the proper fix in
containerd.

Signed-off-by: Bjorn Neergaard <bneergaard@mirantis.com>
  • Loading branch information
neersighted committed Feb 16, 2023
1 parent 174802e commit c4c5468
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions daemon/apparmor_default.go
Expand Up @@ -5,12 +5,9 @@ package daemon // import "github.com/docker/docker/daemon"

import (
"fmt"
"os"
"sync"

"github.com/containerd/containerd/pkg/apparmor"
aaprofile "github.com/docker/docker/profiles/apparmor"
"github.com/sirupsen/logrus"
)

// Define constants for native driver
Expand All @@ -19,11 +16,6 @@ const (
defaultAppArmorProfile = "docker-default"
)

var (
checkAppArmorOnce sync.Once
isAppArmorAvailable bool
)

// DefaultApparmorProfile returns the name of the default apparmor profile
func DefaultApparmorProfile() string {
if apparmor.HostSupports() {
Expand All @@ -33,20 +25,7 @@ func DefaultApparmorProfile() string {
}

func ensureDefaultAppArmorProfile() error {
checkAppArmorOnce.Do(func() {
if apparmor.HostSupports() {
// Restore the apparmor_parser check removed in containerd:
// https://github.com/containerd/containerd/commit/1acca8bba36e99684ee3489ea4a42609194ca6b9
// Fixes: https://github.com/moby/moby/issues/44900
if _, err := os.Stat("/sbin/apparmor_parser"); err == nil {
isAppArmorAvailable = true
} else {
logrus.Warn("AppArmor enabled on system but \"apparmor_parser\" binary is missing, so profile can't be loaded")
}
}
})

if isAppArmorAvailable {
if apparmor.HostSupports() {
loaded, err := aaprofile.IsLoaded(defaultAppArmorProfile)
if err != nil {
return fmt.Errorf("Could not check if %s AppArmor profile was loaded: %s", defaultAppArmorProfile, err)
Expand Down

0 comments on commit c4c5468

Please sign in to comment.