summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-01-07 09:44:37 -0500
committerGitHub <noreply@github.com>2021-01-07 09:44:37 -0500
commit3cf41c4a7349d2f2529ce94801de2de9898ae27f (patch)
tree0982a64d3ffd90561a8f1465be0581edfca489d3 /pkg
parent74af9254b98eb21e25c9776b0cf0664d3cb2c46e (diff)
parentdb71759b1aa575633649091b97ea9b856aebc687 (diff)
downloadpodman-3cf41c4a7349d2f2529ce94801de2de9898ae27f.tar.gz
podman-3cf41c4a7349d2f2529ce94801de2de9898ae27f.tar.bz2
podman-3cf41c4a7349d2f2529ce94801de2de9898ae27f.zip
Merge pull request #8821 from rhatdan/caps
Containers should not get inheritable caps by default
Diffstat (limited to 'pkg')
-rw-r--r--pkg/specgen/generate/security.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/pkg/specgen/generate/security.go b/pkg/specgen/generate/security.go
index 9fceec7b3..390b19beb 100644
--- a/pkg/specgen/generate/security.go
+++ b/pkg/specgen/generate/security.go
@@ -133,13 +133,13 @@ func securityConfigureGenerator(s *specgen.SpecGenerator, g *generate.Generator,
configSpec := g.Config
configSpec.Process.Capabilities.Ambient = []string{}
configSpec.Process.Capabilities.Bounding = caplist
- configSpec.Process.Capabilities.Inheritable = caplist
user := strings.Split(s.User, ":")[0]
if (user == "" && s.UserNS.NSMode != specgen.KeepID) || user == "root" || user == "0" {
configSpec.Process.Capabilities.Effective = caplist
configSpec.Process.Capabilities.Permitted = caplist
+ configSpec.Process.Capabilities.Inheritable = caplist
} else {
userCaps, err := capabilities.MergeCapabilities(nil, s.CapAdd, nil)
if err != nil {
@@ -147,6 +147,7 @@ func securityConfigureGenerator(s *specgen.SpecGenerator, g *generate.Generator,
}
configSpec.Process.Capabilities.Effective = userCaps
configSpec.Process.Capabilities.Permitted = userCaps
+ configSpec.Process.Capabilities.Inheritable = userCaps
// Ambient capabilities were added to Linux 4.3. Set ambient
// capabilities only when the kernel supports them.