Skip to content

Commit 57b2290

Browse files
committed
seccomp: block socket calls to AF_VSOCK in default profile
This syncs the seccomp-profile with the latest changes in containerd's profile, applying the same changes as containerd/containerd@17a9324 Some background from the associated ticket: > We want to use vsock for guest-host communication on KubeVirt > (https://github.com/kubevirt/kubevirt). In KubeVirt we run VMs in pods. > > However since anyone can just connect from any pod to any VM with the > default seccomp settings, we cannot limit connection attempts to our > privileged node-agent. > > ### Describe the solution you'd like > We want to deny the `socket` syscall for the `AF_VSOCK` family by default. > > I see in [1] and [2] that AF_VSOCK was actually already blocked for some > time, but that got reverted since some architectures support the `socketcall` > syscall which can't be restricted properly. However we are mostly interested > in `arm64` and `amd64` where limiting `socket` would probably be enough. > > ### Additional context > I know that in theory we could use our own seccomp profiles, but we would want > to provide security for as many users as possible which use KubeVirt, and there > it would be very helpful if this protection could be added by being part of the > DefaultRuntime profile to easily ensure that it is active for all pods [3]. > > Impact on existing workloads: It is unlikely that this will disturb any existing > workload, becuase VSOCK is almost exclusively used for host-guest commmunication. > However if someone would still use it: Privileged pods would still be able to > use `socket` for `AF_VSOCK`, custom seccomp policies could be applied too. > Further it was already blocked for quite some time and the blockade got lifted > due to reasons not related to AF_VSOCK. > > The PR in KubeVirt which adds VSOCK support for additional context: [4] > > [1]: moby#29076 (comment) > [2]: moby@dcf2632 > [3]: https://kubernetes.io/docs/tutorials/security/seccomp/#enable-the-use-of-runtimedefault-as-the-default-seccomp-profile-for-all-workloads > [4]: kubevirt/kubevirt#8546 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 5fd603c commit 57b2290

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

‎profiles/seccomp/default.json‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,6 @@
356356
"signalfd4",
357357
"sigprocmask",
358358
"sigreturn",
359-
"socket",
360359
"socketcall",
361360
"socketpair",
362361
"splice",
@@ -420,6 +419,19 @@
420419
"minKernel": "4.8"
421420
}
422421
},
422+
{
423+
"names": [
424+
"socket"
425+
],
426+
"action": "SCMP_ACT_ALLOW",
427+
"args": [
428+
{
429+
"index": 0,
430+
"value": 40,
431+
"op": "SCMP_CMP_NE"
432+
}
433+
]
434+
},
423435
{
424436
"names": [
425437
"personality"

‎profiles/seccomp/default_linux.go‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,6 @@ func DefaultProfile() *Seccomp {
348348
"signalfd4",
349349
"sigprocmask",
350350
"sigreturn",
351-
"socket",
352351
"socketcall",
353352
"socketpair",
354353
"splice",
@@ -415,6 +414,19 @@ func DefaultProfile() *Seccomp {
415414
MinKernel: &KernelVersion{4, 8},
416415
},
417416
},
417+
{
418+
LinuxSyscall: specs.LinuxSyscall{
419+
Names: []string{"socket"},
420+
Action: specs.ActAllow,
421+
Args: []specs.LinuxSeccompArg{
422+
{
423+
Index: 0,
424+
Value: unix.AF_VSOCK,
425+
Op: specs.OpNotEqual,
426+
},
427+
},
428+
},
429+
},
418430
{
419431
LinuxSyscall: specs.LinuxSyscall{
420432
Names: []string{"personality"},

0 commit comments

Comments
 (0)