Merge pull request #2241 from justincormack/ambient_seccomp
The set of bounding capabilities is the largest group
This commit is contained in:
commit
cbfc9223a9
@ -444,25 +444,8 @@ func DefaultProfile(sp *specs.Spec) *specs.LinuxSeccomp {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// make a map of enabled capabilities
|
admin := false
|
||||||
caps := make(map[string]bool)
|
|
||||||
for _, c := range sp.Process.Capabilities.Bounding {
|
for _, c := range sp.Process.Capabilities.Bounding {
|
||||||
caps[c] = true
|
|
||||||
}
|
|
||||||
for _, c := range sp.Process.Capabilities.Effective {
|
|
||||||
caps[c] = true
|
|
||||||
}
|
|
||||||
for _, c := range sp.Process.Capabilities.Inheritable {
|
|
||||||
caps[c] = true
|
|
||||||
}
|
|
||||||
for _, c := range sp.Process.Capabilities.Permitted {
|
|
||||||
caps[c] = true
|
|
||||||
}
|
|
||||||
for _, c := range sp.Process.Capabilities.Ambient {
|
|
||||||
caps[c] = true
|
|
||||||
}
|
|
||||||
|
|
||||||
for c := range caps {
|
|
||||||
switch c {
|
switch c {
|
||||||
case "CAP_DAC_READ_SEARCH":
|
case "CAP_DAC_READ_SEARCH":
|
||||||
s.Syscalls = append(s.Syscalls, specs.LinuxSyscall{
|
s.Syscalls = append(s.Syscalls, specs.LinuxSyscall{
|
||||||
@ -471,6 +454,7 @@ func DefaultProfile(sp *specs.Spec) *specs.LinuxSeccomp {
|
|||||||
Args: []specs.LinuxSeccompArg{},
|
Args: []specs.LinuxSeccompArg{},
|
||||||
})
|
})
|
||||||
case "CAP_SYS_ADMIN":
|
case "CAP_SYS_ADMIN":
|
||||||
|
admin = true
|
||||||
s.Syscalls = append(s.Syscalls, specs.LinuxSyscall{
|
s.Syscalls = append(s.Syscalls, specs.LinuxSyscall{
|
||||||
Names: []string{
|
Names: []string{
|
||||||
"bpf",
|
"bpf",
|
||||||
@ -558,7 +542,7 @@ func DefaultProfile(sp *specs.Spec) *specs.LinuxSeccomp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !caps["CAP_SYS_ADMIN"] {
|
if !admin {
|
||||||
switch runtime.GOARCH {
|
switch runtime.GOARCH {
|
||||||
case "s390", "s390x":
|
case "s390", "s390x":
|
||||||
s.Syscalls = append(s.Syscalls, specs.LinuxSyscall{
|
s.Syscalls = append(s.Syscalls, specs.LinuxSyscall{
|
||||||
|
Loading…
Reference in New Issue
Block a user