diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2020-11-02 14:39:00 +0100 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2020-11-02 14:39:02 +0100 |
commit | 6a9442909869a949d8930b24f9c0021022528333 (patch) | |
tree | 0321cd657151ebd07fa4102ea3ce19de3bb16b9b /pkg | |
parent | bce8f851c1e891aa6159e61c56ccd712b60c31b7 (diff) | |
download | podman-6a9442909869a949d8930b24f9c0021022528333.tar.gz podman-6a9442909869a949d8930b24f9c0021022528333.tar.bz2 podman-6a9442909869a949d8930b24f9c0021022528333.zip |
specgen: fix check for root user
if the username is specified in the USER:GROUP form, make sure we only
check for USER.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/specgen/generate/security.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pkg/specgen/generate/security.go b/pkg/specgen/generate/security.go index 8a9fd7a41..be6555195 100644 --- a/pkg/specgen/generate/security.go +++ b/pkg/specgen/generate/security.go @@ -135,7 +135,9 @@ func securityConfigureGenerator(s *specgen.SpecGenerator, g *generate.Generator, configSpec.Process.Capabilities.Bounding = caplist configSpec.Process.Capabilities.Inheritable = caplist - if s.User == "" || s.User == "root" || s.User == "0" { + user := strings.Split(s.User, ":")[0] + + if user == "" || user == "root" || user == "0" { configSpec.Process.Capabilities.Effective = caplist configSpec.Process.Capabilities.Permitted = caplist } else { |