From e61117676034209b6bdfe97a649afae221a080a7 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Fri, 14 Jun 2019 17:33:47 +0200 Subject: pkg/apparmor: fix when AA is disabled Do not try to load the default profile when AppArmor is disabled on the host. Fixes: #3331 Signed-off-by: Valentin Rothberg --- pkg/apparmor/apparmor_linux.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'pkg') diff --git a/pkg/apparmor/apparmor_linux.go b/pkg/apparmor/apparmor_linux.go index 2c5022c1f..0d01f41e9 100644 --- a/pkg/apparmor/apparmor_linux.go +++ b/pkg/apparmor/apparmor_linux.go @@ -225,8 +225,13 @@ func CheckProfileAndLoadDefault(name string) (string, error) { } } - if name != "" && !runcaa.IsEnabled() { - return "", fmt.Errorf("profile %q specified but AppArmor is disabled on the host", name) + // Check if AppArmor is disabled and error out if a profile is to be set. + if !runcaa.IsEnabled() { + if name == "" { + return "", nil + } else { + return "", fmt.Errorf("profile %q specified but AppArmor is disabled on the host", name) + } } // If the specified name is not empty or is not a default libpod one, -- cgit v1.2.3-54-g00ecf