Skip to content

Commit

Permalink
interfaces: adjust docker-support test to handle mqueue
Browse files Browse the repository at this point in the history
Signed-off-by: Zygmunt Krynicki <[email protected]>
  • Loading branch information
zyga committed Jul 8, 2024
1 parent c52a550 commit 6ff315b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion interfaces/builtin/docker_support_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,11 @@ func (s *DockerSupportInterfaceSuite) TestGenerateAAREExclusionPatterns(c *C) {
const dockerSupportConnectedPlugAppArmorUserNS = `
# allow use of user namespaces
userns,
`

const dockerSupportConnectedPlugAppArmorMqueue = `
# allow unrestricted use of posix message queues
mqueue,
`

const dockerSupportConnectedPlugAppArmor = `
Expand Down Expand Up @@ -845,17 +850,22 @@ ptrace (read, trace) peer=unconfined,
// Generate profile to compare with
privilegedProfile := dockerSupportPrivilegedAppArmor + dockerSupportConnectedPlugAppArmor

// if apparmor supports userns mediation then add this too
if (apparmor_sandbox.ProbedLevel() != apparmor_sandbox.Partial) && (apparmor_sandbox.ProbedLevel() != apparmor_sandbox.Full) {
c.Skip(apparmor_sandbox.Summary())
}

// if apparmor supports userns mediation then add this too
features, err := apparmor_sandbox.ParserFeatures()
c.Assert(err, IsNil)
if strutil.ListContains(features, "userns") {
privilegedProfile += dockerSupportConnectedPlugAppArmorUserNS
}

// if apparmor supports mqueue mediation then add this too
if strutil.ListContains(features, "mqueue") {
privilegedProfile += dockerSupportConnectedPlugAppArmorMqueue
}

// Profile existing profile
expectedHash, err := testutil.AppArmorParseAndHashHelper("#include <tunables/global> \nprofile docker_support {" + privilegedProfile + "}")
c.Assert(err, IsNil)
Expand Down

0 comments on commit 6ff315b

Please sign in to comment.