Do not drop effective&permitted set
Currently moby drops ep sets before the entrypoint is executed.
This does mean that with combination of no-new-privileges the
file capabilities stops working with non-root containers.
This is undesired as the usability of such containers is harmed
comparing to running root containers.
This commit therefore sets the effective/permitted set in order
to allow use of file capabilities or libcap(3)/prctl(2) respectively
with combination of no-new-privileges and without respectively.
For no-new-privileges the container will be able to obtain capabilities
that are requested.
Signed-off-by: Luboslav Pivarc <lpivarc@redhat.com>
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
(cherry picked from commit 3aef732e61
)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
5cc1736418
commit
09b65e0082
1 changed files with 4 additions and 13 deletions
17
oci/oci.go
17
oci/oci.go
|
@ -23,19 +23,10 @@ func SetCapabilities(s *specs.Spec, caplist []string) error {
|
|||
if s.Process == nil {
|
||||
s.Process = &specs.Process{}
|
||||
}
|
||||
// setUser has already been executed here
|
||||
if s.Process.User.UID == 0 {
|
||||
s.Process.Capabilities = &specs.LinuxCapabilities{
|
||||
Effective: caplist,
|
||||
Bounding: caplist,
|
||||
Permitted: caplist,
|
||||
}
|
||||
} else {
|
||||
// Do not set Effective and Permitted capabilities for non-root users,
|
||||
// to match what execve does.
|
||||
s.Process.Capabilities = &specs.LinuxCapabilities{
|
||||
Bounding: caplist,
|
||||
}
|
||||
s.Process.Capabilities = &specs.LinuxCapabilities{
|
||||
Effective: caplist,
|
||||
Bounding: caplist,
|
||||
Permitted: caplist,
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue