Merge pull request #8863 from mgoltzsche/fix_seccomp_when_privileged
Disable seccomp by default when creating a privileged container.
This commit is contained in:
commit
8e4d19da15
|
|
@ -172,7 +172,7 @@ func securityConfigureGenerator(s *specgen.SpecGenerator, g *generate.Generator,
|
|||
|
||||
// Clear default Seccomp profile from Generator for unconfined containers
|
||||
// and privileged containers which do not specify a seccomp profile.
|
||||
if s.SeccompProfilePath == "unconfined" || (s.Privileged && (s.SeccompProfilePath == config.SeccompOverridePath || s.SeccompProfilePath == config.SeccompDefaultPath)) {
|
||||
if s.SeccompProfilePath == "unconfined" || (s.Privileged && (s.SeccompProfilePath == "" || s.SeccompProfilePath == config.SeccompOverridePath || s.SeccompProfilePath == config.SeccompDefaultPath)) {
|
||||
configSpec.Linux.Seccomp = nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -110,6 +110,15 @@ var _ = Describe("Podman privileged container tests", func() {
|
|||
Expect("0000000000000000").To(Equal(capEff[1]))
|
||||
})
|
||||
|
||||
It("podman privileged should disable seccomp by default", func() {
|
||||
hostSeccomp := SystemExec("grep", []string{"-Ei", "^Seccomp:\\s+0$", "/proc/self/status"})
|
||||
Expect(hostSeccomp.ExitCode()).To(Equal(0))
|
||||
|
||||
session := podmanTest.Podman([]string{"run", "--privileged", ALPINE, "grep", "-Ei", "^Seccomp:\\s+0$", "/proc/self/status"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
})
|
||||
|
||||
It("podman non-privileged should have very few devices", func() {
|
||||
session := podmanTest.Podman([]string{"run", "-t", "busybox", "ls", "-l", "/dev"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
|
|
|||
Loading…
Reference in New Issue