Commit Graph

40 Commits

Author SHA1 Message Date
4feffb64a0 Don't drop CAP_FOWNER in the container. Also sorts the list of allowed
capabilities.

Docker-DCO-1.1-Signed-off-by: Victor Marmol <vmarmol@google.com> (github: vmarmol)
Upstream-commit: 0abad3ae2290a2b051b8fdaceab17a1ee41ecfb9
Component: engine
2014-05-19 16:52:39 +00:00
e3742d2641 Make libcontainer's CapabilitiesMask into a []string (Capabilities).
Docker-DCO-1.1-Signed-off-by: Victor Marmol <vmarmol@google.com> (github: vmarmol)
Upstream-commit: 92614928cecd48b241011e614fa856c4fdbac1f6
Component: engine
2014-05-17 00:44:10 +00:00
25e8afd42a Merge pull request #5810 from vmarmol/drop-caps
Change libcontainer to drop all capabilities by default.
Upstream-commit: 01d10d6f13d62d74f850fea2a685b24b7983244e
Component: engine
2014-05-16 11:51:41 -07:00
2ef3480938 Typo in execdrivers.go five => give
Docker-DCO-1.1-Signed-off-by: Timothy Hobbs <timothyhobbs@seznam.cz> (github: timthelion)
Upstream-commit: 408f050d648da0b64d353146a1be59827d76bf70
Component: engine
2014-05-16 11:45:20 +00:00
48bd5989f0 Change libcontainer to drop all capabilities by default. Only keeps
those that were specified in the config. This commit also explicitly
adds a set of capabilities that we were silently not dropping and were
assumed by the tests.

Docker-DCO-1.1-Signed-off-by: Victor Marmol <vmarmol@google.com> (github: vmarmol)
Upstream-commit: 9d6875d19d3926faf6287487234ad0b2f1310e9d
Component: engine
2014-05-16 00:57:58 +00:00
910f9d50e2 Move cgroups package into libcontainer
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 3b7a19def609c8fbadc6559e7f47f8a5a7769a5b
Component: engine
2014-05-14 15:21:44 -07:00
94d0641f06 Merge pull request #5756 from crosbymichael/move-units-to-pkg
Move duration and size to units pkg
Upstream-commit: bc22c9948c5380715338aef63fcc6cccd1a16bd7
Component: engine
2014-05-14 11:36:14 -07:00
4926e35bb1 Add cpuset cpus support for docker
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: adbe3096e8c8572925dbae5f19ac2ce2dc84fb1c
Component: engine
2014-05-13 18:17:12 -07:00
d39f282a2b Move duration and size to units pkg
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: d33b4655c4339dcbbf9f78948598e216ac3c06b4
Component: engine
2014-05-12 17:05:07 -07:00
23c5da98b4 Always mount a /run tmpfs in the container
All modern distros set up /run to be a tmpfs, see for instance:
https://wiki.debian.org/ReleaseGoals/RunDirectory

Its a very useful place to store pid-files, sockets and other things
that only live at runtime and that should not be stored in the image.

This is also useful when running systemd inside a container, as it
will try to mount /run if not already mounted, which will fail for
non-privileged container.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 905795ece624675abe2ec2622b0bbafdb9d7f44c
Component: engine
2014-05-12 21:41:04 +02:00
b2601c1b63 Fix bug on LXC container start. Fixes #5718
Docker-DCO-1.1-Signed-off-by: Fernando Mayo <fernando@tutum.co> (github: fermayo)
Upstream-commit: 752c57ae567813f354aca66ff51d8d64100ae01b
Component: engine
2014-05-10 18:05:02 -04:00
1e327c2bc7 Set container pid for process in native driver
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 62e8ddb5791b9ee62c3f4361084dda4a5d7760e1
Component: engine
2014-05-06 17:04:04 -07:00
dfb1a0bff0 Merge pull request #5354 from alexlarsson/cgroups-systemd-fixes
cgroups: Update systemd to match fs backend
Upstream-commit: 0b15944cb047e6467f399ebf5c3f93262fe4c06f
Component: engine
2014-05-05 16:00:56 -07:00
4d22840b79 Move envconfig generation to lxc driver
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 4994b0fe5459996691dde18155a7b712762e8e53
Component: engine
2014-05-05 14:45:14 -07:00
df4270e3f2 Update after namespace refactor
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 01fec73ba4cff45ac08c0330ea0d67aff70ebf8e
Component: engine
2014-05-05 13:56:18 -07:00
d5f89ec02b Merge pull request #4441 from crosbymichael/add-net-flag
Add --net flag to docker run and allow host network stack
Upstream-commit: 70fef1460a9d253bdf164d70d7057ec4ee497e08
Component: engine
2014-05-05 13:54:55 -07:00
41f42a620b Improve libcontainer namespace and cap format
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: db5f6b4aa0b34adbc9ba189a042e77e7bcdee681
Component: engine
2014-05-05 12:34:21 -07:00
074dcc8171 cgroups: Update systemd to match fs backend
This updates systemd.Apply to match the fs backend by:
* Always join blockio controller (for stats)
* Support CpusetCpus
* Support MemorySwap

Also, it removes the generic UnitProperties in favour of a single
option to set the slice.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 5b094530c09bca403819c06635c2f7fbaf98b937
Component: engine
2014-05-05 20:06:44 +02:00
0fcf738183 Setup host networking for lxc and native
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: a785882b29b9f0b24ace8249576c5d8d7f8c1d94
Component: engine
2014-05-05 10:08:59 -07:00
381004dc30 runconfig: add -net container:name option
Docker-DCO-1.1-Signed-off-by: Johan Euphrosine <proppy@google.com> (github: proppy)
Upstream-commit: a60159f3b102244fc5470642bd32eb99d5ac329c
Component: engine
2014-05-05 10:08:59 -07:00
1ed0224965 Don't restrict lxc because of apparmor
We don't have the flexibility to do extra things with lxc because it is
a black box and most fo the magic happens before we get a chance to
interact with it in dockerinit.
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 59fe77bfa638001cbe9af386f350d6e0dbb23398
Component: engine
2014-05-02 11:14:24 -07:00
17870b6e20 Update restrictions for better handling of mounts
This also cleans up some of the left over restriction paths code from
before.
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: f5139233b930e436707a65cc032aa2952edd6e4a
Component: engine
2014-05-01 15:26:58 -07:00
7dc5aa24f0 Mount /proc and /sys read-only, except in privileged containers.
It has been pointed out that some files in /proc and /sys can be used
to break out of containers. However, if those filesystems are mounted
read-only, most of the known exploits are mitigated, since they rely
on writing some file in those filesystems.

This does not replace security modules (like SELinux or AppArmor), it
is just another layer of security. Likewise, it doesn't mean that the
other mitigations (shadowing parts of /proc or /sys with bind mounts)
are useless. Those measures are still useful. As such, the shadowing
of /proc/kcore is still enabled with both LXC and native drivers.

Special care has to be taken with /proc/1/attr, which still needs to
be mounted read-write in order to enable the AppArmor profile. It is
bind-mounted from a private read-write mount of procfs.

All that enforcement is done in dockerinit. The code doing the real
work is in libcontainer. The init function for the LXC driver calls
the function from libcontainer to avoid code duplication.

Docker-DCO-1.1-Signed-off-by: Jérôme Petazzoni <jerome@docker.com> (github: jpetazzo)
Upstream-commit: 1c4202a6142d238d41f10deff1f0548f7591350b
Component: engine
2014-05-01 15:26:58 -07:00
d33d261bde drop CAP_SYSLOG capability
Kernel capabilities for privileged syslog operations are currently splitted into
CAP_SYS_ADMIN and CAP_SYSLOG since the following commit:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=ce6ada35bdf710d16582cc4869c26722547e6f11

This patch drops CAP_SYSLOG to prevent containers from messing with
host's syslog (e.g. `dmesg -c` clears up host's printk ring buffer).

Closes #5491

Docker-DCO-1.1-Signed-off-by: Eiichi Tsukata <devel@etsukata.com> (github: Etsukata)
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: cac0cea03f85191b3d92cdaeae827fdd93fb1b29
Component: engine
2014-05-01 11:43:55 -07:00
b43bfc67a6 Make native driver use Exec func with different CreateCommand
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: da0d6dbd7b5b429b79ae4ea22957e8a14b4ca1ec
Component: engine
2014-04-30 18:49:24 -07:00
4b320ae74d Integrate new structure into docker's native driver
This duplicates some of the Exec code but I think it it worth it because
the native driver is more straight forward and does not have the
complexity have handling the type issues for now.
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 60e4276f5af360dd3292e22993c0c132a86edc2e
Component: engine
2014-04-30 18:20:01 -07:00
e0c447076a Remove statewriter interface, export more libcontainer funcs
This temp. expands the Exec method's signature but adds a more robust
way to know when the container's process is actually released and begins
to run.  The network interfaces are not guaranteed to be up yet but this
provides a more accurate view with a single callback at this time.
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: f1104014372e71e1f8ae7a63d17e18de5e2fa93a
Component: engine
2014-04-30 15:52:40 -07:00
26fc4488a8 Remove logger from nsinit struct
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 162dafbcd5c4d57c7f436e11d90423ee6d7c3ce1
Component: engine
2014-04-30 15:24:18 -07:00
87fcb82bfa Merge pull request #5448 from crosbymichael/selinux-defaults
Add selinux label support for processes and mount
Upstream-commit: 2a711d16e05b69328f2636f88f8eac035477f7e4
Component: engine
2014-04-30 14:14:39 -07:00
614fad87b9 Close extraneous file descriptors in containers
Without this patch, containers inherit the open file descriptors of the daemon, so my "exec 42>&2" allows us to "echo >&42 some nasty error with some bad advice" directly into the daemon log. :)

Also, "hack/dind" was already doing this due to issues caused by the inheritance, so I'm removing that hack too since this patch obsoletes it by generalizing it for all containers.

Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
Upstream-commit: d5d62ff95574a48816890d8d6e0785a79f559c3c
Component: engine
2014-04-29 16:45:28 -06:00
2acb87c29f Initial work on selinux patch
This has every container using the docker daemon's pid for the processes
label so it does not work correctly.
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: f0e6e135a8d733af173bf0b8732c704c9ec716d7
Component: engine
2014-04-29 03:40:05 -07:00
f2b5fc4e3c Merge pull request #5411 from crosbymichael/lockdown
Update default restrictions for exec drivers
Upstream-commit: 44140f7909ac65206d300fa9a39ae06cc27d1847
Component: engine
2014-04-26 03:27:56 +03:00
69a18c6508 Separating cgroup Memory and MemoryReservation.
This will allow for these to be set independently. Keep the current Docker behavior where Memory and MemoryReservation are set to the value of Memory.

Docker-DCO-1.1-Signed-off-by: Victor Marmol <vmarmol@google.com> (github: vmarmol)
Upstream-commit: f188b9f623e23ee624aca8654bf00f49ee3bae29
Component: engine
2014-04-24 11:09:38 -07:00
b3bc92caaf Increment native driver version with these changes
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 2d6c3674349c09318e8d1fb3ce43dbabc15c97da
Component: engine
2014-04-24 10:35:20 -07:00
a750afc31e Mount over dev and only copy allowed nodes in
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 5ba1242bdc309352c2b0b9a1ef9e07fe835e4857
Component: engine
2014-04-24 10:35:20 -07:00
20ba5d97da No not mount sysfs by default for non privilged containers
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 81e5026a6afb282589704fd5f6bcac9ed50108ea
Component: engine
2014-04-24 10:35:20 -07:00
bdab73285c Add lxc support for restricting proc
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 0779a8c3287fbf7ff1938df10897b551b839cbee
Component: engine
2014-04-24 10:35:20 -07:00
9da373d6b1 Add restrictions to proc in libcontainer
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 60a90970bc4add3547064004f08c19ab5027141b
Component: engine
2014-04-24 10:35:19 -07:00
1ea14534fa Merge branch 'master' into load-profile
Conflicts:
	daemon/execdriver/native/create.go
	daemon/execdriver/native/driver.go

Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume@charmes.net> (github: creack)
Upstream-commit: 813cebc64fb4b628e2938405d86144060c330eb9
Component: engine
2014-04-21 10:32:13 -07:00
f7be50364d Rename runtime/* to daemon/*
Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 359b7df5d2af5733b8a1ea6746d062053053b23e
Component: engine
2014-04-17 14:43:01 -07:00