summaryrefslogtreecommitdiff
path: root/vendor/github.com/projectatomic/buildah/config_seccomp.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-06-27 08:55:20 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-06-27 15:16:02 +0000
commite1b47c15076680d318aa6fd0cb650ad89b471022 (patch)
tree4bf24b82c99533645484ce4ea57f75914f73c053 /vendor/github.com/projectatomic/buildah/config_seccomp.go
parentf6c0fc1aa854ae5ce73d57ecb09d47c0d4dd2cc3 (diff)
downloadpodman-e1b47c15076680d318aa6fd0cb650ad89b471022.tar.gz
podman-e1b47c15076680d318aa6fd0cb650ad89b471022.tar.bz2
podman-e1b47c15076680d318aa6fd0cb650ad89b471022.zip
Vendor in latest buildah
Signed-off-by: baude <bbaude@redhat.com> Closes: #1007 Approved by: baude
Diffstat (limited to 'vendor/github.com/projectatomic/buildah/config_seccomp.go')
-rw-r--r--vendor/github.com/projectatomic/buildah/config_seccomp.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/vendor/github.com/projectatomic/buildah/config_seccomp.go b/vendor/github.com/projectatomic/buildah/config_seccomp.go
new file mode 100644
index 000000000..3453a8f00
--- /dev/null
+++ b/vendor/github.com/projectatomic/buildah/config_seccomp.go
@@ -0,0 +1,35 @@
+// +build seccomp
+
+package buildah
+
+import (
+ "io/ioutil"
+
+ "github.com/docker/docker/profiles/seccomp"
+ "github.com/opencontainers/runtime-spec/specs-go"
+ "github.com/pkg/errors"
+)
+
+func setupSeccomp(spec *specs.Spec, seccompProfilePath string) error {
+ switch seccompProfilePath {
+ case "unconfined":
+ spec.Linux.Seccomp = nil
+ case "":
+ seccompConfig, err := seccomp.GetDefaultProfile(spec)
+ if err != nil {
+ return errors.Wrapf(err, "loading default seccomp profile failed")
+ }
+ spec.Linux.Seccomp = seccompConfig
+ default:
+ seccompProfile, err := ioutil.ReadFile(seccompProfilePath)
+ if err != nil {
+ return errors.Wrapf(err, "opening seccomp profile (%s) failed", seccompProfilePath)
+ }
+ seccompConfig, err := seccomp.LoadProfile(string(seccompProfile), spec)
+ if err != nil {
+ return errors.Wrapf(err, "loading seccomp profile (%s) failed", seccompProfilePath)
+ }
+ spec.Linux.Seccomp = seccompConfig
+ }
+ return nil
+}