summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2017-11-03 14:46:51 +0000
committerAtomic Bot <atomic-devel@projectatomic.io>2017-11-03 20:55:10 +0000
commit098389dc3e7bbba7c266ad24c909f3a5422e2908 (patch)
tree6b060ab5edc032bf63acb37489241b788c0f9381 /libpod
parent79a26cbd6dc5bff97726c4280db45362ddc83881 (diff)
downloadpodman-098389dc3e7bbba7c266ad24c909f3a5422e2908.tar.gz
podman-098389dc3e7bbba7c266ad24c909f3a5422e2908.tar.bz2
podman-098389dc3e7bbba7c266ad24c909f3a5422e2908.zip
Parse SecurityOpts
This should turn on handling of SELinux, NoNewPrivs, seccomp and Apparmor Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #15 Approved by: rhatdan
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container.go4
-rw-r--r--libpod/options.go12
2 files changed, 14 insertions, 2 deletions
diff --git a/libpod/container.go b/libpod/container.go
index 9f9d4ef3e..7c2f921f3 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -95,6 +95,7 @@ type containerConfig struct {
// Information on the image used for the root filesystem
RootfsImageID string `json:"rootfsImageID,omitempty"`
RootfsImageName string `json:"rootfsImageName,omitempty"`
+ MountLabel string `json:"MountLabel,omitempty"`
UseImageConfig bool `json:"useImageConfig"`
// Whether to keep container STDIN open
Stdin bool
@@ -223,8 +224,7 @@ func (c *Container) setupImageRootfs() error {
return errors.Wrapf(ErrInvalidArg, "must provide image ID and image name to use an image")
}
- // TODO SELinux mount label
- containerInfo, err := c.runtime.storageService.CreateContainerStorage(c.runtime.imageContext, c.config.RootfsImageName, c.config.RootfsImageID, c.config.Name, c.config.ID, "")
+ containerInfo, err := c.runtime.storageService.CreateContainerStorage(c.runtime.imageContext, c.config.RootfsImageName, c.config.RootfsImageID, c.config.Name, c.config.ID, c.config.MountLabel)
if err != nil {
return errors.Wrapf(err, "error creating container storage")
}
diff --git a/libpod/options.go b/libpod/options.go
index 982655fc0..10cb605c2 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -255,6 +255,18 @@ func WithRootFSFromPath(path string) CtrCreateOption {
}
}
+// WithSELinuxMountLabel sets the mount label for SELinux
+func WithSELinuxMountLabel(mountLabel string) CtrCreateOption {
+ return func(ctr *Container) error {
+ if ctr.valid {
+ return ErrCtrFinalized
+ }
+
+ ctr.config.MountLabel = mountLabel
+ return nil
+ }
+}
+
// WithRootFSFromImage sets up a fresh root filesystem using the given image
// If useImageConfig is specified, image volumes, environment variables, and
// other configuration from the image will be added to the config