Commit Graph

480 Commits

Author SHA1 Message Date
f69322b472 Merge pull request #5556 from crosbymichael/no-restrict-lxc
Don't restrict lxc because of apparmor
Upstream-commit: 3a1f0dedc71712403c591dd9e552f7a906c2e4ea
Component: engine
2014-05-02 17:20:27 -07:00
ac76593583 Month devpts before mounting subdirs
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume@charmes.net> (github: creack)
Upstream-commit: a7ccbfd5f143af8a7accc69803b1588e568328ac
Component: engine
2014-05-02 13:55:45 -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
4d667fa77e Merge pull request #5529 from crosbymichael/restrict-proc
Mount /proc and /sys read-only, except in privileged containers
Upstream-commit: 1c5a3123cc6ac396656b1027504748bd8dcd65e9
Component: engine
2014-05-02 10:52:53 -07:00
6e316a7be9 Apply apparmor before restrictions
There is not need for the remount hack, we use aa_change_onexec so the
apparmor profile is not applied until we exec the users app.
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 76fa7d588adfe644824d9a00dafce2d2991a7013
Component: engine
2014-05-01 19:09:12 -07:00
634dd08b53 Adding Rohit Jnagal and Victor Marmol to pkg/libcontainer maintainers.
Docker-DCO-1.1-Signed-off-by: Victor Marmol <vmarmol@google.com> (github: vmarmol)
Upstream-commit: 71e3757174c3c1617d636ddd7462c39617ba5a77
Component: engine
2014-05-01 15:51:38 -07:00
4decb81304 Fix /proc/kcore mount of /dev/null
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 24e0df8136c238cb3e231b939a82058950e6eb02
Component: engine
2014-05-01 15:26:58 -07:00
6012a16a9d Mount attr and task as rw for selinux support
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 3f74bdd93f08b3001f11a137210ee67a6d23c084
Component: engine
2014-05-01 15:26:58 -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
2184511acc Update to enable cross compile
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 83982e8b1d0cd825e1762b5540db8ae77c34f065
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
675ce830a9 skip apparmor with dind
Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
Upstream-commit: de191e86321f7d3136ff42ff75826b8107399497
Component: engine
2014-05-01 22:22:08 +00: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
ec54d1dc2d Merge pull request #5515 from crosbymichael/refactor-libcontainer2
Remove CommandFactory and NsInit interface
Upstream-commit: fe4a25546a434eb0299bdc7f61a3cfcc3752fb33
Component: engine
2014-05-01 11:41:54 -07:00
a4471696ab beam: Add simple framing system for UnixConn
This is needed for Send/Recieve to correctly handle borders between
the messages.

The framing uses a single 32bit uint32 length for each frame, of which
the high bit is used to indicate whether the message contains a file
descriptor or not. This is enough to separate out each message sent
and to decide to which message each file descriptors belongs, even
though multiple Sends may be coalesced into a single read, and/or one
Send can be split into multiple writes.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 24f9187a0467ca66c30e26c3d9e3ee58daeb720f
Component: engine
2014-05-01 11:06:01 -07:00
c94cce9900 Remove container.json from readme
No need to duplicate this information when we already have a
container.json file in the root of libcontainer
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: d0bee7939482b982462c5848f24b2e5e9ad897ea
Component: engine
2014-04-30 18:52:15 -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
c0992a66d2 Fix execin with environment and Enabled support
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: aa9705f832d847d6e6ce76e19f3c952c194c167e
Component: engine
2014-04-30 18:24:47 -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
8cf0bc757c Remove command factory and NsInit interface from libcontainer
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 176c49d7a9e5a81b6c80e18dea84864148360597
Component: engine
2014-04-30 17:55:15 -07:00
3b07a6b498 Export more functions from libcontainer
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: b6b0dfdba7bda13d630217830423580c3152899d
Component: engine
2014-04-30 17:18:07 -07:00
04ee258620 Split term files to make it easier to manage
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: aecb9c39ab0eb5f09ebab40001fe0ff639ef617b
Component: engine
2014-04-30 17:04:24 -07:00
2b44341c25 Export syncpipe fields
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: a3e96abb5aacaa763f3f9205316dd0aef1977f16
Component: engine
2014-04-30 17:02:45 -07:00
3c350a7bfd Merge pull request #5511 from crosbymichael/refactor-libcontainer
Refactor: remove statewriter type and all callback for process start
Upstream-commit: 26ac05c8bce47fd37c35e43b98cdbcfb65a5c9bb
Component: engine
2014-04-30 16:50:57 -07:00
47e64912c0 Merge pull request #5512 from crosbymichael/set-freezer
Add ability to set cgroups freezer
Upstream-commit: be013c7820747af5e3696ad306b817aa437dd3c4
Component: engine
2014-04-30 16:50:01 -07:00
4188748bd6 Add ability to set cgroups freezer
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 5f6fda8cfd05dec002894d3e2214a04a58b62bed
Component: engine
2014-04-30 16:07:12 -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
c5e3da18ab Export SetupUser
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: cd8cec854be33a74179618864cd528acf5129cd9
Component: engine
2014-04-30 15:27:59 -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
2bc0a4b67c Merge pull request #5498 from tianon/better-apparmor-missing-error
Upstream-commit: bfedf247a46acc6deceeaef5703b76026691d42b
Component: engine
2014-04-30 15:16:43 -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
6835a0cd51 Merge pull request #5506 from crosbymichael/add-system-maintainer
Add system maintainers
Upstream-commit: 2fc5bed61d14d22a5d50afc5416c87930c5fbd96
Component: engine
2014-04-30 14:14:21 -07:00
bf18e83e5d Merge pull request #5464 from tianon/close-leftover-fds
Upstream-commit: e88ef454b7a8705570623e6d26f51731b8300e0f
Component: engine
2014-04-30 12:27:52 -07:00
b55f9defa8 Add system maintainers
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 6203d8b462ee9dbc42b651ac8b6b2d83b9eef963
Component: engine
2014-04-30 12:01:06 -07:00
bde45636d6 Fix various MAINTAINERS format inconsistencies
Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
Upstream-commit: defecac2799ca0c72532b7e6ed6005cc54ee2e25
Component: engine
2014-04-30 11:22:11 -06:00
23a6b19cdc beam: Add more tests to unix_test.go
These are failing, and indicate things that need to be fixed.  The
primarily problem is the lack of framing between beam messages.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
[solomon@docker.com: rebased on master]
Signed-off-by: Solomon Hykes <solomon@docker.com>
Upstream-commit: e802b69146ac7a008d943a3a289fba56150b4f81
Component: engine
2014-04-30 02:10:09 -07:00
2256dd9cdf Update pkg/apparmor to provide a better error message when apparmor_parser cannot be found
Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
Upstream-commit: a1a9baf926ff8ec2bd7ba0dd39cf3a9eb5fab1d3
Component: engine
2014-04-29 23:19:21 -06: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
fdcad5e0a4 Merge pull request #5476 from rjnagal/libcontainer-fixes
Cleanup cgroups on Set failures
Upstream-commit: bf59e6723274c6d20d7c78c683b5c8923a6d910e
Component: engine
2014-04-29 12:27:31 -07:00
3267a2a3bd Cleanup existing controllers when cleanup fails mid-way.
Docker-DCO-1.1-Signed-off-by: Rohit Jnagal <jnagal@google.com> (github: rjnagal)
Upstream-commit: 070747a21365959d3179d8df627d3e614318e202
Component: engine
2014-04-29 18:59:20 +00:00
a55ecec598 Add mountlabel to dev
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 0c7143b32386c62cccd529de69abf88df938757d
Component: engine
2014-04-29 03:41:44 -07:00
b1dafd91c1 Update process labels to be set at create not start
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 46e05ed2d96efca9bdb466d20138fde1994769ba
Component: engine
2014-04-29 03:40:05 -07:00
58dae079fd Fix SELinux errors caused by multi-threading
Occasionally the selinux_test program will fail because we are setting file
context based on the Process ID but not the TID.  THis change will always
use the TID to set SELinux labels.

Docker-DCO-1.1-Signed-off-by: Daniel Walsh <dwalsh@redhat.com> (github: rhatdan)
Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: crosbymichael)
Upstream-commit: 12934ef3a40d814cb307dfea0cc86124ec997593
Component: engine
2014-04-29 03:40:05 -07:00
a5f91ab172 This patch reworks the SELinux patch to be only run on demand by the daemon
Added --selinux-enable switch to daemon to enable SELinux labeling.

The daemon will now generate a new unique random SELinux label when a
container starts, and remove it when the container is removed.   The MCS
labels will be stored in the daemon memory.  The labels of containers will
be stored in the container.json file.

When the daemon restarts on boot or if done by an admin, it will read all containers json files and reserve the MCS labels.

A potential problem would be conflicts if you setup thousands of containers,
current scheme would handle ~500,000 containers.

Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)
Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: crosbymichael)
Upstream-commit: b7942ec2ca7c7568df0c3b7eb554b05e2c3a3081
Component: engine
2014-04-29 03:40:05 -07: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
d43500e59b Merge pull request #5455 from rjnagal/cgroup-stats
Add throttling stats for cpu cgroup
Upstream-commit: 69d56acd455de019cb324c4607c629be8d6fcad5
Component: engine
2014-04-28 17:53:37 -07:00
f2e5f328eb Another test to check for invalid stats.
Docker-DCO-1.1-Signed-off-by: Rohit Jnagal <jnagal@google.com> (github: rjnagal)
Upstream-commit: d724242297bf2981ad9c7745e5b130ab7fa8f067
Component: engine
2014-04-29 00:32:05 +00:00
28c69597af Add cpu throttling stats.
Docker-DCO-1.1-Signed-off-by: Rohit Jnagal <jnagal@google.com> (github: rjnagal)
Upstream-commit: 61f156d5215b2c9d38e26bbd732c6e9cb9a3208e
Component: engine
2014-04-29 00:18:18 +00:00
efc42748f5 Merge pull request #5451 from vmarmol/add-memory-stats
Adding a unit test for stats in pkg/cgroup/fs/memory.go
Upstream-commit: 5b3f7851d89be189c8daf2fa02d6bc39317c466a
Component: engine
2014-04-28 16:38:34 -07:00
b3f05f4dd1 Merge pull request #5449 from tianon/remove-libcontainer-root-special-case
Remove "root" and "" special cases in libcontainer
Upstream-commit: eb6a1c9f499b5e0abbc1f5e040d69f1802deeb2f
Component: engine
2014-04-28 16:29:08 -07:00