mirror of
https://github.com/moby/moby.git
synced 2025-12-04 19:23:06 +03:00
Block obsolete socket families in the default seccomp profile
Linux supports many obsolete address families, which are usually available in common distro kernels, but they are less likely to be properly audited and may have security issues This blocks all socket families in the socket (and socketcall where applicable) syscall except - AF_UNIX - Unix domain sockets - AF_INET - IPv4 - AF_INET6 - IPv6 - AF_NETLINK - Netlink sockets for communicating with the ekrnel - AF_PACKET - raw sockets, which are only allowed with CAP_NET_RAW All other socket families are blocked, including Appletalk (native, not over IP), IPX (remember that!), VSOCK and HVSOCK, which should not generally be used in containers, etc. Note that users can of course provide a profile per container or in the daemon config if they have unusual use cases that require these. Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
@@ -978,7 +978,7 @@ func (s *DockerSuite) TestRunSeccompProfileDenyChmod(c *check.C) {
|
||||
}
|
||||
|
||||
// TestRunSeccompProfileDenyUnshareUserns checks that 'docker run debian:jessie unshare --map-root-user --user sh -c whoami' with a specific profile to
|
||||
// deny unhare of a userns exits with operation not permitted.
|
||||
// deny unshare of a userns exits with operation not permitted.
|
||||
func (s *DockerSuite) TestRunSeccompProfileDenyUnshareUserns(c *check.C) {
|
||||
testRequires(c, SameHostDaemon, seccompEnabled, NotArm, Apparmor)
|
||||
// from sched.h
|
||||
@@ -1015,6 +1015,18 @@ func (s *DockerSuite) TestRunSeccompProfileDenyUnshareUserns(c *check.C) {
|
||||
})
|
||||
}
|
||||
|
||||
// TestRunSeccompProfileDenyUnusualSocketFamilies checks that rarely used socket families such as Appletalk are blocked by the default profile
|
||||
func (s *DockerSuite) TestRunSeccompProfileDenyUnusualSocketFamilies(c *check.C) {
|
||||
testRequires(c, SameHostDaemon, seccompEnabled)
|
||||
ensureSyscallTest(c)
|
||||
|
||||
runCmd := exec.Command(dockerBinary, "run", "syscall-test", "appletalk-test")
|
||||
_, _, err := runCommandWithOutput(runCmd)
|
||||
if err != nil {
|
||||
c.Fatal("expected opening appletalk socket family to fail")
|
||||
}
|
||||
}
|
||||
|
||||
// TestRunSeccompProfileDenyCloneUserns checks that 'docker run syscall-test'
|
||||
// with a the default seccomp profile exits with operation not permitted.
|
||||
func (s *DockerSuite) TestRunSeccompProfileDenyCloneUserns(c *check.C) {
|
||||
|
||||
Reference in New Issue
Block a user