From 831dc488833e055dce1f1ba4c09f09346c85b67d Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Thu, 15 Feb 2018 12:23:36 -0500 Subject: Add support for --no-new-privs Signed-off-by: Daniel J Walsh Closes: #369 Approved by: rhatdan --- test/e2e/run_privileged_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test/e2e') diff --git a/test/e2e/run_privileged_test.go b/test/e2e/run_privileged_test.go index 430698ba1..3df90b218 100644 --- a/test/e2e/run_privileged_test.go +++ b/test/e2e/run_privileged_test.go @@ -1,6 +1,7 @@ package integration import ( + "fmt" "os" . "github.com/onsi/ginkgo" @@ -81,4 +82,26 @@ var _ = Describe("Podman privileged container tests", func() { Expect(session.ExitCode()).To(Equal(0)) Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 20)) }) + + It("run no-new-privileges test", func() { + cap := podmanTest.SystemExec("grep", []string{"NoNewPrivs", "/proc/self/status"}) + cap.WaitWithDefaultTimeout() + if cap.ExitCode() != 0 { + fmt.Println("Can't determine NoNewPrivs") + return + } + + session := podmanTest.Podman([]string{"run", "busybox", "grep", "NoNewPrivs", "/proc/self/status"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + privs := strings.Split(cap.OutputToString(), ":") + + session = podmanTest.Podman([]string{"run", "--security-opt", "no-new-privileges", "busybox", "grep", "NoNewPrivs", "/proc/self/status"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + noprivs := strings.Split(cap.OutputToString(), ":") + + Expect(privs[1]).To(Not(Equal(noprivs[1]))) + }) + }) -- cgit v1.2.3-54-g00ecf