pkg/cri/server: remove dependency on libcontainer/apparmor, libcontainer/utils
recent versions of libcontainer/apparmor simplified the AppArmor
check to only check if the host supports AppArmor, but no longer
checks if apparmor_parser is installed, or if we're running
docker-in-docker;
bfb4ea1b1b
> The `apparmor_parser` binary is not really required for a system to run
> AppArmor from a runc perspective. How to apply the profile is more in
> the responsibility of higher level runtimes like Podman and Docker,
> which may do the binary check on their own.
This patch copies the logic from libcontainer/apparmor, and
restores the additional checks.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
			
			
This commit is contained in:
		| @@ -32,7 +32,6 @@ import ( | ||||
| 	"github.com/containerd/containerd/mount" | ||||
| 	"github.com/containerd/containerd/pkg/seccomp" | ||||
| 	"github.com/containerd/containerd/pkg/seutil" | ||||
| 	runcapparmor "github.com/opencontainers/runc/libcontainer/apparmor" | ||||
| 	"github.com/opencontainers/runtime-spec/specs-go" | ||||
| 	"github.com/opencontainers/selinux/go-selinux/label" | ||||
| 	"github.com/pkg/errors" | ||||
| @@ -141,8 +140,13 @@ func checkSelinuxLevel(level string) error { | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| // apparmorEnabled returns true if apparmor is enabled, supported by the host, | ||||
| // if apparmor_parser is installed, and if we are not running docker-in-docker. | ||||
| func (c *criService) apparmorEnabled() bool { | ||||
| 	return runcapparmor.IsEnabled() && !c.config.DisableApparmor | ||||
| 	if c.config.DisableApparmor { | ||||
| 		return false | ||||
| 	} | ||||
| 	return hostSupportsAppArmor() | ||||
| } | ||||
|  | ||||
| func (c *criService) seccompEnabled() bool { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Sebastiaan van Stijn
					Sebastiaan van Stijn