|
@@ -3,46 +3,46 @@
|
|
|
package seccomp // import "github.com/docker/docker/profiles/seccomp"
|
|
|
|
|
|
import (
|
|
|
- "github.com/docker/docker/api/types"
|
|
|
+ "github.com/opencontainers/runtime-spec/specs-go"
|
|
|
"golang.org/x/sys/unix"
|
|
|
)
|
|
|
|
|
|
-func arches() []types.Architecture {
|
|
|
- return []types.Architecture{
|
|
|
+func arches() []Architecture {
|
|
|
+ return []Architecture{
|
|
|
{
|
|
|
- Arch: types.ArchX86_64,
|
|
|
- SubArches: []types.Arch{types.ArchX86, types.ArchX32},
|
|
|
+ Arch: specs.ArchX86_64,
|
|
|
+ SubArches: []specs.Arch{specs.ArchX86, specs.ArchX32},
|
|
|
},
|
|
|
{
|
|
|
- Arch: types.ArchAARCH64,
|
|
|
- SubArches: []types.Arch{types.ArchARM},
|
|
|
+ Arch: specs.ArchAARCH64,
|
|
|
+ SubArches: []specs.Arch{specs.ArchARM},
|
|
|
},
|
|
|
{
|
|
|
- Arch: types.ArchMIPS64,
|
|
|
- SubArches: []types.Arch{types.ArchMIPS, types.ArchMIPS64N32},
|
|
|
+ Arch: specs.ArchMIPS64,
|
|
|
+ SubArches: []specs.Arch{specs.ArchMIPS, specs.ArchMIPS64N32},
|
|
|
},
|
|
|
{
|
|
|
- Arch: types.ArchMIPS64N32,
|
|
|
- SubArches: []types.Arch{types.ArchMIPS, types.ArchMIPS64},
|
|
|
+ Arch: specs.ArchMIPS64N32,
|
|
|
+ SubArches: []specs.Arch{specs.ArchMIPS, specs.ArchMIPS64},
|
|
|
},
|
|
|
{
|
|
|
- Arch: types.ArchMIPSEL64,
|
|
|
- SubArches: []types.Arch{types.ArchMIPSEL, types.ArchMIPSEL64N32},
|
|
|
+ Arch: specs.ArchMIPSEL64,
|
|
|
+ SubArches: []specs.Arch{specs.ArchMIPSEL, specs.ArchMIPSEL64N32},
|
|
|
},
|
|
|
{
|
|
|
- Arch: types.ArchMIPSEL64N32,
|
|
|
- SubArches: []types.Arch{types.ArchMIPSEL, types.ArchMIPSEL64},
|
|
|
+ Arch: specs.ArchMIPSEL64N32,
|
|
|
+ SubArches: []specs.Arch{specs.ArchMIPSEL, specs.ArchMIPSEL64},
|
|
|
},
|
|
|
{
|
|
|
- Arch: types.ArchS390X,
|
|
|
- SubArches: []types.Arch{types.ArchS390},
|
|
|
+ Arch: specs.ArchS390X,
|
|
|
+ SubArches: []specs.Arch{specs.ArchS390},
|
|
|
},
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// DefaultProfile defines the allowed syscalls for the default seccomp profile.
|
|
|
-func DefaultProfile() *types.Seccomp {
|
|
|
- syscalls := []*types.Syscall{
|
|
|
+func DefaultProfile() *Seccomp {
|
|
|
+ syscalls := []*Syscall{
|
|
|
{
|
|
|
Names: []string{
|
|
|
"accept",
|
|
@@ -382,68 +382,68 @@ func DefaultProfile() *types.Seccomp {
|
|
|
"write",
|
|
|
"writev",
|
|
|
},
|
|
|
- Action: types.ActAllow,
|
|
|
- Args: []*types.Arg{},
|
|
|
+ Action: specs.ActAllow,
|
|
|
+ Args: []*specs.LinuxSeccompArg{},
|
|
|
},
|
|
|
{
|
|
|
Names: []string{"ptrace"},
|
|
|
- Action: types.ActAllow,
|
|
|
- Includes: types.Filter{
|
|
|
+ Action: specs.ActAllow,
|
|
|
+ Includes: Filter{
|
|
|
MinKernel: "4.8",
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
Names: []string{"personality"},
|
|
|
- Action: types.ActAllow,
|
|
|
- Args: []*types.Arg{
|
|
|
+ Action: specs.ActAllow,
|
|
|
+ Args: []*specs.LinuxSeccompArg{
|
|
|
{
|
|
|
Index: 0,
|
|
|
Value: 0x0,
|
|
|
- Op: types.OpEqualTo,
|
|
|
+ Op: specs.OpEqualTo,
|
|
|
},
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
Names: []string{"personality"},
|
|
|
- Action: types.ActAllow,
|
|
|
- Args: []*types.Arg{
|
|
|
+ Action: specs.ActAllow,
|
|
|
+ Args: []*specs.LinuxSeccompArg{
|
|
|
{
|
|
|
Index: 0,
|
|
|
Value: 0x0008,
|
|
|
- Op: types.OpEqualTo,
|
|
|
+ Op: specs.OpEqualTo,
|
|
|
},
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
Names: []string{"personality"},
|
|
|
- Action: types.ActAllow,
|
|
|
- Args: []*types.Arg{
|
|
|
+ Action: specs.ActAllow,
|
|
|
+ Args: []*specs.LinuxSeccompArg{
|
|
|
{
|
|
|
Index: 0,
|
|
|
Value: 0x20000,
|
|
|
- Op: types.OpEqualTo,
|
|
|
+ Op: specs.OpEqualTo,
|
|
|
},
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
Names: []string{"personality"},
|
|
|
- Action: types.ActAllow,
|
|
|
- Args: []*types.Arg{
|
|
|
+ Action: specs.ActAllow,
|
|
|
+ Args: []*specs.LinuxSeccompArg{
|
|
|
{
|
|
|
Index: 0,
|
|
|
Value: 0x20008,
|
|
|
- Op: types.OpEqualTo,
|
|
|
+ Op: specs.OpEqualTo,
|
|
|
},
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
Names: []string{"personality"},
|
|
|
- Action: types.ActAllow,
|
|
|
- Args: []*types.Arg{
|
|
|
+ Action: specs.ActAllow,
|
|
|
+ Args: []*specs.LinuxSeccompArg{
|
|
|
{
|
|
|
Index: 0,
|
|
|
Value: 0xffffffff,
|
|
|
- Op: types.OpEqualTo,
|
|
|
+ Op: specs.OpEqualTo,
|
|
|
},
|
|
|
},
|
|
|
},
|
|
@@ -451,9 +451,9 @@ func DefaultProfile() *types.Seccomp {
|
|
|
Names: []string{
|
|
|
"sync_file_range2",
|
|
|
},
|
|
|
- Action: types.ActAllow,
|
|
|
- Args: []*types.Arg{},
|
|
|
- Includes: types.Filter{
|
|
|
+ Action: specs.ActAllow,
|
|
|
+ Args: []*specs.LinuxSeccompArg{},
|
|
|
+ Includes: Filter{
|
|
|
Arches: []string{"ppc64le"},
|
|
|
},
|
|
|
},
|
|
@@ -466,9 +466,9 @@ func DefaultProfile() *types.Seccomp {
|
|
|
"cacheflush",
|
|
|
"set_tls",
|
|
|
},
|
|
|
- Action: types.ActAllow,
|
|
|
- Args: []*types.Arg{},
|
|
|
- Includes: types.Filter{
|
|
|
+ Action: specs.ActAllow,
|
|
|
+ Args: []*specs.LinuxSeccompArg{},
|
|
|
+ Includes: Filter{
|
|
|
Arches: []string{"arm", "arm64"},
|
|
|
},
|
|
|
},
|
|
@@ -476,9 +476,9 @@ func DefaultProfile() *types.Seccomp {
|
|
|
Names: []string{
|
|
|
"arch_prctl",
|
|
|
},
|
|
|
- Action: types.ActAllow,
|
|
|
- Args: []*types.Arg{},
|
|
|
- Includes: types.Filter{
|
|
|
+ Action: specs.ActAllow,
|
|
|
+ Args: []*specs.LinuxSeccompArg{},
|
|
|
+ Includes: Filter{
|
|
|
Arches: []string{"amd64", "x32"},
|
|
|
},
|
|
|
},
|
|
@@ -486,9 +486,9 @@ func DefaultProfile() *types.Seccomp {
|
|
|
Names: []string{
|
|
|
"modify_ldt",
|
|
|
},
|
|
|
- Action: types.ActAllow,
|
|
|
- Args: []*types.Arg{},
|
|
|
- Includes: types.Filter{
|
|
|
+ Action: specs.ActAllow,
|
|
|
+ Args: []*specs.LinuxSeccompArg{},
|
|
|
+ Includes: Filter{
|
|
|
Arches: []string{"amd64", "x32", "x86"},
|
|
|
},
|
|
|
},
|
|
@@ -498,9 +498,9 @@ func DefaultProfile() *types.Seccomp {
|
|
|
"s390_pci_mmio_write",
|
|
|
"s390_runtime_instr",
|
|
|
},
|
|
|
- Action: types.ActAllow,
|
|
|
- Args: []*types.Arg{},
|
|
|
- Includes: types.Filter{
|
|
|
+ Action: specs.ActAllow,
|
|
|
+ Args: []*specs.LinuxSeccompArg{},
|
|
|
+ Includes: Filter{
|
|
|
Arches: []string{"s390", "s390x"},
|
|
|
},
|
|
|
},
|
|
@@ -508,9 +508,9 @@ func DefaultProfile() *types.Seccomp {
|
|
|
Names: []string{
|
|
|
"open_by_handle_at",
|
|
|
},
|
|
|
- Action: types.ActAllow,
|
|
|
- Args: []*types.Arg{},
|
|
|
- Includes: types.Filter{
|
|
|
+ Action: specs.ActAllow,
|
|
|
+ Args: []*specs.LinuxSeccompArg{},
|
|
|
+ Includes: Filter{
|
|
|
Caps: []string{"CAP_DAC_READ_SEARCH"},
|
|
|
},
|
|
|
},
|
|
@@ -532,9 +532,9 @@ func DefaultProfile() *types.Seccomp {
|
|
|
"umount2",
|
|
|
"unshare",
|
|
|
},
|
|
|
- Action: types.ActAllow,
|
|
|
- Args: []*types.Arg{},
|
|
|
- Includes: types.Filter{
|
|
|
+ Action: specs.ActAllow,
|
|
|
+ Args: []*specs.LinuxSeccompArg{},
|
|
|
+ Includes: Filter{
|
|
|
Caps: []string{"CAP_SYS_ADMIN"},
|
|
|
},
|
|
|
},
|
|
@@ -542,16 +542,16 @@ func DefaultProfile() *types.Seccomp {
|
|
|
Names: []string{
|
|
|
"clone",
|
|
|
},
|
|
|
- Action: types.ActAllow,
|
|
|
- Args: []*types.Arg{
|
|
|
+ Action: specs.ActAllow,
|
|
|
+ Args: []*specs.LinuxSeccompArg{
|
|
|
{
|
|
|
Index: 0,
|
|
|
Value: unix.CLONE_NEWNS | unix.CLONE_NEWUTS | unix.CLONE_NEWIPC | unix.CLONE_NEWUSER | unix.CLONE_NEWPID | unix.CLONE_NEWNET | unix.CLONE_NEWCGROUP,
|
|
|
ValueTwo: 0,
|
|
|
- Op: types.OpMaskedEqual,
|
|
|
+ Op: specs.OpMaskedEqual,
|
|
|
},
|
|
|
},
|
|
|
- Excludes: types.Filter{
|
|
|
+ Excludes: Filter{
|
|
|
Caps: []string{"CAP_SYS_ADMIN"},
|
|
|
Arches: []string{"s390", "s390x"},
|
|
|
},
|
|
@@ -560,20 +560,20 @@ func DefaultProfile() *types.Seccomp {
|
|
|
Names: []string{
|
|
|
"clone",
|
|
|
},
|
|
|
- Action: types.ActAllow,
|
|
|
- Args: []*types.Arg{
|
|
|
+ Action: specs.ActAllow,
|
|
|
+ Args: []*specs.LinuxSeccompArg{
|
|
|
{
|
|
|
Index: 1,
|
|
|
Value: unix.CLONE_NEWNS | unix.CLONE_NEWUTS | unix.CLONE_NEWIPC | unix.CLONE_NEWUSER | unix.CLONE_NEWPID | unix.CLONE_NEWNET | unix.CLONE_NEWCGROUP,
|
|
|
ValueTwo: 0,
|
|
|
- Op: types.OpMaskedEqual,
|
|
|
+ Op: specs.OpMaskedEqual,
|
|
|
},
|
|
|
},
|
|
|
Comment: "s390 parameter ordering for clone is different",
|
|
|
- Includes: types.Filter{
|
|
|
+ Includes: Filter{
|
|
|
Arches: []string{"s390", "s390x"},
|
|
|
},
|
|
|
- Excludes: types.Filter{
|
|
|
+ Excludes: Filter{
|
|
|
Caps: []string{"CAP_SYS_ADMIN"},
|
|
|
},
|
|
|
},
|
|
@@ -581,9 +581,9 @@ func DefaultProfile() *types.Seccomp {
|
|
|
Names: []string{
|
|
|
"reboot",
|
|
|
},
|
|
|
- Action: types.ActAllow,
|
|
|
- Args: []*types.Arg{},
|
|
|
- Includes: types.Filter{
|
|
|
+ Action: specs.ActAllow,
|
|
|
+ Args: []*specs.LinuxSeccompArg{},
|
|
|
+ Includes: Filter{
|
|
|
Caps: []string{"CAP_SYS_BOOT"},
|
|
|
},
|
|
|
},
|
|
@@ -591,9 +591,9 @@ func DefaultProfile() *types.Seccomp {
|
|
|
Names: []string{
|
|
|
"chroot",
|
|
|
},
|
|
|
- Action: types.ActAllow,
|
|
|
- Args: []*types.Arg{},
|
|
|
- Includes: types.Filter{
|
|
|
+ Action: specs.ActAllow,
|
|
|
+ Args: []*specs.LinuxSeccompArg{},
|
|
|
+ Includes: Filter{
|
|
|
Caps: []string{"CAP_SYS_CHROOT"},
|
|
|
},
|
|
|
},
|
|
@@ -603,9 +603,9 @@ func DefaultProfile() *types.Seccomp {
|
|
|
"init_module",
|
|
|
"finit_module",
|
|
|
},
|
|
|
- Action: types.ActAllow,
|
|
|
- Args: []*types.Arg{},
|
|
|
- Includes: types.Filter{
|
|
|
+ Action: specs.ActAllow,
|
|
|
+ Args: []*specs.LinuxSeccompArg{},
|
|
|
+ Includes: Filter{
|
|
|
Caps: []string{"CAP_SYS_MODULE"},
|
|
|
},
|
|
|
},
|
|
@@ -613,9 +613,9 @@ func DefaultProfile() *types.Seccomp {
|
|
|
Names: []string{
|
|
|
"acct",
|
|
|
},
|
|
|
- Action: types.ActAllow,
|
|
|
- Args: []*types.Arg{},
|
|
|
- Includes: types.Filter{
|
|
|
+ Action: specs.ActAllow,
|
|
|
+ Args: []*specs.LinuxSeccompArg{},
|
|
|
+ Includes: Filter{
|
|
|
Caps: []string{"CAP_SYS_PACCT"},
|
|
|
},
|
|
|
},
|
|
@@ -626,9 +626,9 @@ func DefaultProfile() *types.Seccomp {
|
|
|
"process_vm_writev",
|
|
|
"ptrace",
|
|
|
},
|
|
|
- Action: types.ActAllow,
|
|
|
- Args: []*types.Arg{},
|
|
|
- Includes: types.Filter{
|
|
|
+ Action: specs.ActAllow,
|
|
|
+ Args: []*specs.LinuxSeccompArg{},
|
|
|
+ Includes: Filter{
|
|
|
Caps: []string{"CAP_SYS_PTRACE"},
|
|
|
},
|
|
|
},
|
|
@@ -637,9 +637,9 @@ func DefaultProfile() *types.Seccomp {
|
|
|
"iopl",
|
|
|
"ioperm",
|
|
|
},
|
|
|
- Action: types.ActAllow,
|
|
|
- Args: []*types.Arg{},
|
|
|
- Includes: types.Filter{
|
|
|
+ Action: specs.ActAllow,
|
|
|
+ Args: []*specs.LinuxSeccompArg{},
|
|
|
+ Includes: Filter{
|
|
|
Caps: []string{"CAP_SYS_RAWIO"},
|
|
|
},
|
|
|
},
|
|
@@ -649,9 +649,9 @@ func DefaultProfile() *types.Seccomp {
|
|
|
"stime",
|
|
|
"clock_settime",
|
|
|
},
|
|
|
- Action: types.ActAllow,
|
|
|
- Args: []*types.Arg{},
|
|
|
- Includes: types.Filter{
|
|
|
+ Action: specs.ActAllow,
|
|
|
+ Args: []*specs.LinuxSeccompArg{},
|
|
|
+ Includes: Filter{
|
|
|
Caps: []string{"CAP_SYS_TIME"},
|
|
|
},
|
|
|
},
|
|
@@ -659,9 +659,9 @@ func DefaultProfile() *types.Seccomp {
|
|
|
Names: []string{
|
|
|
"vhangup",
|
|
|
},
|
|
|
- Action: types.ActAllow,
|
|
|
- Args: []*types.Arg{},
|
|
|
- Includes: types.Filter{
|
|
|
+ Action: specs.ActAllow,
|
|
|
+ Args: []*specs.LinuxSeccompArg{},
|
|
|
+ Includes: Filter{
|
|
|
Caps: []string{"CAP_SYS_TTY_CONFIG"},
|
|
|
},
|
|
|
},
|
|
@@ -671,9 +671,9 @@ func DefaultProfile() *types.Seccomp {
|
|
|
"mbind",
|
|
|
"set_mempolicy",
|
|
|
},
|
|
|
- Action: types.ActAllow,
|
|
|
- Args: []*types.Arg{},
|
|
|
- Includes: types.Filter{
|
|
|
+ Action: specs.ActAllow,
|
|
|
+ Args: []*specs.LinuxSeccompArg{},
|
|
|
+ Includes: Filter{
|
|
|
Caps: []string{"CAP_SYS_NICE"},
|
|
|
},
|
|
|
},
|
|
@@ -681,16 +681,16 @@ func DefaultProfile() *types.Seccomp {
|
|
|
Names: []string{
|
|
|
"syslog",
|
|
|
},
|
|
|
- Action: types.ActAllow,
|
|
|
- Args: []*types.Arg{},
|
|
|
- Includes: types.Filter{
|
|
|
+ Action: specs.ActAllow,
|
|
|
+ Args: []*specs.LinuxSeccompArg{},
|
|
|
+ Includes: Filter{
|
|
|
Caps: []string{"CAP_SYSLOG"},
|
|
|
},
|
|
|
},
|
|
|
}
|
|
|
|
|
|
- return &types.Seccomp{
|
|
|
- DefaultAction: types.ActErrno,
|
|
|
+ return &Seccomp{
|
|
|
+ DefaultAction: specs.ActErrno,
|
|
|
ArchMap: arches(),
|
|
|
Syscalls: syscalls,
|
|
|
}
|