Erase ambient capabilities.
Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
parent
de84f9c0cd
commit
b367f30097
@ -372,6 +372,11 @@ func (c *criService) generateContainerSpec(id string, sandboxID string, sandboxP
|
|||||||
securityContext.GetCapabilities())
|
securityContext.GetCapabilities())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Clear all ambient capabilities. The implication of non-root + caps
|
||||||
|
// is not clearly defined in Kubernetes.
|
||||||
|
// See https://github.com/kubernetes/kubernetes/issues/56374
|
||||||
|
// Keep docker's behavior for now.
|
||||||
|
g.Spec().Process.Capabilities.Ambient = []string{}
|
||||||
|
|
||||||
g.SetProcessSelinuxLabel(processLabel)
|
g.SetProcessSelinuxLabel(processLabel)
|
||||||
g.SetLinuxMountLabel(mountLabel)
|
g.SetLinuxMountLabel(mountLabel)
|
||||||
|
@ -261,6 +261,7 @@ func TestContainerCapabilities(t *testing.T) {
|
|||||||
assert.NotContains(t, spec.Process.Capabilities.Inheritable, exclude)
|
assert.NotContains(t, spec.Process.Capabilities.Inheritable, exclude)
|
||||||
assert.NotContains(t, spec.Process.Capabilities.Permitted, exclude)
|
assert.NotContains(t, spec.Process.Capabilities.Permitted, exclude)
|
||||||
}
|
}
|
||||||
|
assert.Empty(t, spec.Process.Capabilities.Ambient)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user