Skip to content
This repository was archived by the owner on Feb 1, 2020. It is now read-only.

Commit 9bfd34c

Browse files
fvoznikashentubot
authored andcommitted
Error if container requires AppArmor, SELinux or seccomp
Closes google#35 PiperOrigin-RevId: 195840128 Change-Id: I31c1ad9b51ec53abb6f0b485d35622d4e9764b29 Upstream-commit: e1b412d
1 parent 7bad53c commit 9bfd34c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

runsc/sandbox/sandbox.go

+19
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,22 @@ func validateID(id string) error {
5353
return nil
5454
}
5555

56+
func validateSpec(spec *specs.Spec) error {
57+
if spec.Process.SelinuxLabel != "" {
58+
return fmt.Errorf("SELinux is not supported: %s", spec.Process.SelinuxLabel)
59+
}
60+
61+
// Docker uses AppArmor by default, so just log that it's being ignored.
62+
if spec.Process.ApparmorProfile != "" {
63+
log.Warningf("AppArmor profile %q is being ignored", spec.Process.ApparmorProfile)
64+
}
65+
// TODO: Apply seccomp to application inside sandbox.
66+
if spec.Linux != nil && spec.Linux.Seccomp != nil {
67+
log.Warningf("Seccomp spec is being ignored")
68+
}
69+
return nil
70+
}
71+
5672
// Sandbox wraps a child sandbox process, and is responsible for saving and
5773
// loading sandbox metadata to disk.
5874
//
@@ -110,6 +126,9 @@ func Create(id string, spec *specs.Spec, conf *boot.Config, bundleDir, consoleSo
110126
if err := validateID(id); err != nil {
111127
return nil, err
112128
}
129+
if err := validateSpec(spec); err != nil {
130+
return nil, err
131+
}
113132

114133
sandboxRoot := filepath.Join(conf.RootDir, id)
115134
if exists(sandboxRoot) {

0 commit comments

Comments
 (0)