diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2020-11-02 14:45:54 +0100 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2020-11-02 15:46:56 +0100 |
commit | afa4ec0db01b620be540e72e25fc86092e2fa303 (patch) | |
tree | 79e8b6fe947e1b817e742eb35a2066bd8231edca /test/e2e | |
parent | 6a9442909869a949d8930b24f9c0021022528333 (diff) | |
download | podman-afa4ec0db01b620be540e72e25fc86092e2fa303.tar.gz podman-afa4ec0db01b620be540e72e25fc86092e2fa303.tar.bz2 podman-afa4ec0db01b620be540e72e25fc86092e2fa303.zip |
specgen: keep capabilities with --userns=keep-id
if --userns=keep-id is specified and not --user is specified, take the
unprivileged capabilities code path so that ambient capabilities are
honored in the container.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'test/e2e')
-rw-r--r-- | test/e2e/run_test.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index 9f86f43aa..deb4419af 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -335,6 +335,19 @@ var _ = Describe("Podman run", func() { session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) Expect(session.OutputToString()).To(ContainSubstring("0000000000000000")) + + if os.Geteuid() > 0 { + if os.Getenv("SKIP_USERNS") != "" { + Skip("Skip userns tests.") + } + if _, err := os.Stat("/proc/self/uid_map"); err != nil { + Skip("User namespaces not supported.") + } + session = podmanTest.Podman([]string{"run", "--userns=keep-id", "--cap-add=DAC_OVERRIDE", "--rm", ALPINE, "grep", "CapAmb", "/proc/self/status"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.OutputToString()).To(ContainSubstring("0000000000000002")) + } }) It("podman run user capabilities test with image", func() { |