diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-04-16 05:29:19 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-16 05:29:19 -0700 |
commit | 09e821a8eae603174c809bcc4af641d4ed5dc35c (patch) | |
tree | 6f2d4a5361cca06dce3b902ce7c71336f1cbf7d1 /libpod/container_internal.go | |
parent | 084cfb81da4f3f3e06ad35bfb3ea52027f62273b (diff) | |
parent | c4ca3c71ffe3c08bc74158340b3427d00efdfe32 (diff) | |
download | podman-09e821a8eae603174c809bcc4af641d4ed5dc35c.tar.gz podman-09e821a8eae603174c809bcc4af641d4ed5dc35c.tar.bz2 podman-09e821a8eae603174c809bcc4af641d4ed5dc35c.zip |
Merge pull request #5690 from rhatdan/selinux
Add support for selecting kvm and systemd labels
Diffstat (limited to 'libpod/container_internal.go')
-rw-r--r-- | libpod/container_internal.go | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go index c930017a4..50bd9bc25 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -19,6 +19,7 @@ import ( "github.com/containers/libpod/pkg/hooks" "github.com/containers/libpod/pkg/hooks/exec" "github.com/containers/libpod/pkg/rootless" + "github.com/containers/libpod/pkg/util" "github.com/containers/storage" "github.com/containers/storage/pkg/archive" "github.com/containers/storage/pkg/mount" @@ -430,7 +431,22 @@ func (c *Container) setupStorage(ctx context.Context) error { c.config.IDMappings.UIDMap = containerInfo.UIDMap c.config.IDMappings.GIDMap = containerInfo.GIDMap - c.config.ProcessLabel = containerInfo.ProcessLabel + + processLabel := containerInfo.ProcessLabel + switch { + case c.ociRuntime.SupportsKVM(): + processLabel, err = util.SELinuxKVMLabel(processLabel) + if err != nil { + return err + } + case c.config.Systemd: + processLabel, err = util.SELinuxInitLabel(processLabel) + if err != nil { + return err + } + } + + c.config.ProcessLabel = processLabel c.config.MountLabel = containerInfo.MountLabel c.config.StaticDir = containerInfo.Dir c.state.RunDir = containerInfo.RunDir |