This vendors in new spec/runc that supports
setting readonly and masked paths in the
configuration. Using this allows us to make an
exception for `—-privileged`.
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit 3f81b4935292d5daedea9de4e2db0895986115da)
| ... | ... |
@@ -248,7 +248,7 @@ RUN set -x \ |
| 248 | 248 |
&& rm -rf "$GOPATH" |
| 249 | 249 |
|
| 250 | 250 |
# Install runc |
| 251 |
-ENV RUNC_COMMIT 0c1c615ebd6a15545b6a82ead01d2745ea49b242 |
|
| 251 |
+ENV RUNC_COMMIT 6c88a526cdd74aab90cc88018368c452c7294a06 |
|
| 252 | 252 |
RUN set -x \ |
| 253 | 253 |
&& export GOPATH="$(mktemp -d)" \ |
| 254 | 254 |
&& git clone git://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ |
| ... | ... |
@@ -181,7 +181,7 @@ RUN set -x \ |
| 181 | 181 |
&& rm -rf "$GOPATH" |
| 182 | 182 |
|
| 183 | 183 |
# Install runc |
| 184 |
-ENV RUNC_COMMIT 0c1c615ebd6a15545b6a82ead01d2745ea49b242 |
|
| 184 |
+ENV RUNC_COMMIT 6c88a526cdd74aab90cc88018368c452c7294a06 |
|
| 185 | 185 |
RUN set -x \ |
| 186 | 186 |
&& export GOPATH="$(mktemp -d)" \ |
| 187 | 187 |
&& git clone git://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ |
| ... | ... |
@@ -198,7 +198,7 @@ RUN set -x \ |
| 198 | 198 |
&& rm -rf "$GOPATH" |
| 199 | 199 |
|
| 200 | 200 |
# Install runc |
| 201 |
-ENV RUNC_COMMIT 0c1c615ebd6a15545b6a82ead01d2745ea49b242 |
|
| 201 |
+ENV RUNC_COMMIT 6c88a526cdd74aab90cc88018368c452c7294a06 |
|
| 202 | 202 |
RUN set -x \ |
| 203 | 203 |
&& export GOPATH="$(mktemp -d)" \ |
| 204 | 204 |
&& git clone git://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ |
| ... | ... |
@@ -74,13 +74,12 @@ WORKDIR /go/src/github.com/docker/docker |
| 74 | 74 |
ENV DOCKER_BUILDTAGS apparmor seccomp selinux |
| 75 | 75 |
|
| 76 | 76 |
# Install runc |
| 77 |
-ENV RUNC_COMMIT 0c1c615ebd6a15545b6a82ead01d2745ea49b242 |
|
| 77 |
+ENV RUNC_COMMIT 6c88a526cdd74aab90cc88018368c452c7294a06 |
|
| 78 | 78 |
RUN set -x \ |
| 79 | 79 |
&& export GOPATH="$(mktemp -d)" \ |
| 80 | 80 |
&& git clone git://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ |
| 81 | 81 |
&& cd "$GOPATH/src/github.com/opencontainers/runc" \ |
| 82 | 82 |
&& git checkout -q "$RUNC_COMMIT" \ |
| 83 |
- && (find . -name "*_ffjson.go" | xargs rm) \ |
|
| 84 | 83 |
&& make static BUILDTAGS="seccomp apparmor selinux" \ |
| 85 | 84 |
&& cp runc /usr/local/bin/docker-runc |
| 86 | 85 |
|
| ... | ... |
@@ -199,7 +199,7 @@ RUN set -x \ |
| 199 | 199 |
&& rm -rf "$GOPATH" |
| 200 | 200 |
|
| 201 | 201 |
# Install runc |
| 202 |
-ENV RUNC_COMMIT 0c1c615ebd6a15545b6a82ead01d2745ea49b242 |
|
| 202 |
+ENV RUNC_COMMIT 6c88a526cdd74aab90cc88018368c452c7294a06 |
|
| 203 | 203 |
RUN set -x \ |
| 204 | 204 |
&& export GOPATH="$(mktemp -d)" \ |
| 205 | 205 |
&& git clone git://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ |
| ... | ... |
@@ -178,7 +178,7 @@ RUN set -x \ |
| 178 | 178 |
&& rm -rf "$GOPATH" |
| 179 | 179 |
|
| 180 | 180 |
# Install runc |
| 181 |
-ENV RUNC_COMMIT 0c1c615ebd6a15545b6a82ead01d2745ea49b242 |
|
| 181 |
+ENV RUNC_COMMIT 6c88a526cdd74aab90cc88018368c452c7294a06 |
|
| 182 | 182 |
RUN set -x \ |
| 183 | 183 |
&& export GOPATH="$(mktemp -d)" \ |
| 184 | 184 |
&& git clone git://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ |
| ... | ... |
@@ -30,7 +30,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 30 | 30 |
&& rm -rf /var/lib/apt/lists/* |
| 31 | 31 |
|
| 32 | 32 |
# Install runc |
| 33 |
-ENV RUNC_COMMIT 0c1c615ebd6a15545b6a82ead01d2745ea49b242 |
|
| 33 |
+ENV RUNC_COMMIT 6c88a526cdd74aab90cc88018368c452c7294a06 |
|
| 34 | 34 |
RUN set -x \ |
| 35 | 35 |
&& export GOPATH="$(mktemp -d)" \ |
| 36 | 36 |
&& git clone git://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ |
| ... | ... |
@@ -536,6 +536,8 @@ func setMounts(daemon *Daemon, s *specs.Spec, c *container.Container, mounts []c |
| 536 | 536 |
} |
| 537 | 537 |
} |
| 538 | 538 |
} |
| 539 |
+ s.Linux.ReadonlyPaths = nil |
|
| 540 |
+ s.Linux.MaskedPaths = nil |
|
| 539 | 541 |
} |
| 540 | 542 |
|
| 541 | 543 |
// TODO: until a kernel/mount solution exists for handling remount in a user namespace, |
| ... | ... |
@@ -660,10 +662,10 @@ func (daemon *Daemon) createSpec(c *container.Container) (*libcontainerd.Spec, e |
| 660 | 660 |
|
| 661 | 661 |
if apparmor.IsEnabled() {
|
| 662 | 662 |
appArmorProfile := "docker-default" |
| 663 |
- if c.HostConfig.Privileged {
|
|
| 664 |
- appArmorProfile = "unconfined" |
|
| 665 |
- } else if len(c.AppArmorProfile) > 0 {
|
|
| 663 |
+ if len(c.AppArmorProfile) > 0 {
|
|
| 666 | 664 |
appArmorProfile = c.AppArmorProfile |
| 665 |
+ } else if c.HostConfig.Privileged {
|
|
| 666 |
+ appArmorProfile = "unconfined" |
|
| 667 | 667 |
} |
| 668 | 668 |
s.Process.ApparmorProfile = appArmorProfile |
| 669 | 669 |
} |
| ... | ... |
@@ -60,7 +60,7 @@ clone git github.com/docker/go v1.5.1-1-1-gbaf439e |
| 60 | 60 |
clone git github.com/agl/ed25519 d2b94fd789ea21d12fac1a4443dd3a3f79cda72c |
| 61 | 61 |
|
| 62 | 62 |
clone git github.com/opencontainers/runc 7b6c4c418d5090f4f11eee949fdf49afd15838c9 # libcontainer |
| 63 |
-clone git github.com/opencontainers/specs 3ce138b1934bf227a418e241ead496c383eaba1c # specs |
|
| 63 |
+clone git github.com/opencontainers/specs 93ca97e83ca7fb4fba6d9e30d5470f99ddc02d11 # specs |
|
| 64 | 64 |
clone git github.com/seccomp/libseccomp-golang 1b506fc7c24eec5a3693cdcbed40d9c226cfc6a1 |
| 65 | 65 |
# libcontainer deps (see src/github.com/opencontainers/runc/Godeps/Godeps.json) |
| 66 | 66 |
clone git github.com/coreos/go-systemd v4 |
| ... | ... |
@@ -1109,7 +1109,7 @@ func (s *DockerSuite) TestRunProcNotWritableInNonPrivilegedContainers(c *check.C |
| 1109 | 1109 |
func (s *DockerSuite) TestRunProcWritableInPrivilegedContainers(c *check.C) {
|
| 1110 | 1110 |
// Not applicable for Windows as there is no concept of --privileged |
| 1111 | 1111 |
testRequires(c, DaemonIsLinux, NotUserNamespace) |
| 1112 |
- if _, code := dockerCmd(c, "run", "--privileged", "busybox", "sh", "-c", "umount /proc/sysrq-trigger && touch /proc/sysrq-trigger"); code != 0 {
|
|
| 1112 |
+ if _, code := dockerCmd(c, "run", "--privileged", "busybox", "sh", "-c", "touch /proc/sysrq-trigger"); code != 0 {
|
|
| 1113 | 1113 |
c.Fatalf("proc should be writable in privileged container")
|
| 1114 | 1114 |
} |
| 1115 | 1115 |
} |
| ... | ... |
@@ -79,6 +79,20 @@ func DefaultSpec() specs.Spec {
|
| 79 | 79 |
} |
| 80 | 80 |
|
| 81 | 81 |
s.Linux = specs.Linux{
|
| 82 |
+ MaskedPaths: []string{
|
|
| 83 |
+ "/proc/kcore", |
|
| 84 |
+ "/proc/latency_stats", |
|
| 85 |
+ "/proc/timer_stats", |
|
| 86 |
+ "/proc/sched_debug", |
|
| 87 |
+ }, |
|
| 88 |
+ ReadonlyPaths: []string{
|
|
| 89 |
+ "/proc/asound", |
|
| 90 |
+ "/proc/bus", |
|
| 91 |
+ "/proc/fs", |
|
| 92 |
+ "/proc/irq", |
|
| 93 |
+ "/proc/sys", |
|
| 94 |
+ "/proc/sysrq-trigger", |
|
| 95 |
+ }, |
|
| 82 | 96 |
Namespaces: []specs.Namespace{
|
| 83 | 97 |
{Type: "mount"},
|
| 84 | 98 |
{Type: "network"},
|
| ... | ... |
@@ -96,9 +96,10 @@ type Mount struct {
|
| 96 | 96 |
|
| 97 | 97 |
// Hook specifies a command that is run at a particular event in the lifecycle of a container |
| 98 | 98 |
type Hook struct {
|
| 99 |
- Path string `json:"path"` |
|
| 100 |
- Args []string `json:"args,omitempty"` |
|
| 101 |
- Env []string `json:"env,omitempty"` |
|
| 99 |
+ Path string `json:"path"` |
|
| 100 |
+ Args []string `json:"args,omitempty"` |
|
| 101 |
+ Env []string `json:"env,omitempty"` |
|
| 102 |
+ Timeout *int `json:"timeout,omitempty"` |
|
| 102 | 103 |
} |
| 103 | 104 |
|
| 104 | 105 |
// Hooks for container setup and teardown |
| ... | ... |
@@ -128,13 +129,17 @@ type Linux struct {
|
| 128 | 128 |
// If resources are specified, the cgroups at CgroupsPath will be updated based on resources. |
| 129 | 129 |
CgroupsPath *string `json:"cgroupsPath,omitempty"` |
| 130 | 130 |
// Namespaces contains the namespaces that are created and/or joined by the container |
| 131 |
- Namespaces []Namespace `json:"namespaces"` |
|
| 131 |
+ Namespaces []Namespace `json:"namespaces,omitempty"` |
|
| 132 | 132 |
// Devices are a list of device nodes that are created for the container |
| 133 |
- Devices []Device `json:"devices"` |
|
| 133 |
+ Devices []Device `json:"devices,omitempty"` |
|
| 134 | 134 |
// Seccomp specifies the seccomp security settings for the container. |
| 135 | 135 |
Seccomp *Seccomp `json:"seccomp,omitempty"` |
| 136 | 136 |
// RootfsPropagation is the rootfs mount propagation mode for the container. |
| 137 | 137 |
RootfsPropagation string `json:"rootfsPropagation,omitempty"` |
| 138 |
+ // MaskedPaths masks over the provided paths inside the container. |
|
| 139 |
+ MaskedPaths []string `json:"maskedPaths,omitempty"` |
|
| 140 |
+ // ReadonlyPaths sets the provided paths as RO inside the container. |
|
| 141 |
+ ReadonlyPaths []string `json:"readonlyPaths,omitempty"` |
|
| 138 | 142 |
} |
| 139 | 143 |
|
| 140 | 144 |
// Namespace is the configuration for a Linux namespace |
| ... | ... |
@@ -6,12 +6,12 @@ const ( |
| 6 | 6 |
// VersionMajor is for an API incompatible changes |
| 7 | 7 |
VersionMajor = 0 |
| 8 | 8 |
// VersionMinor is for functionality in a backwards-compatible manner |
| 9 |
- VersionMinor = 4 |
|
| 9 |
+ VersionMinor = 5 |
|
| 10 | 10 |
// VersionPatch is for backwards-compatible bug fixes |
| 11 | 11 |
VersionPatch = 0 |
| 12 | 12 |
|
| 13 | 13 |
// VersionDev indicates development branch. Releases will be empty string. |
| 14 |
- VersionDev = "" |
|
| 14 |
+ VersionDev = "-dev" |
|
| 15 | 15 |
) |
| 16 | 16 |
|
| 17 | 17 |
// Version is the specification version that the package types support. |