Commit Graph

312 Commits

Author SHA1 Message Date
f32fe35a14 Merge pull request #15148 from hqhq/hq_golint_native
Add back golint for daemon/execdriver/native
Upstream-commit: 2d730c93b4010b314f5365b22810823201ea1d58
Component: engine
2015-07-30 15:51:06 -04:00
76f950f781 Merge pull request #15163 from crosbymichael/proc-ro
Don't mount /proc as ro
Upstream-commit: a687448c4dec200336ed28c5ef26c8198cc0505b
Component: engine
2015-07-30 15:12:29 -04:00
114011a355 Only explicitly deny ptrace for container-originated procs
The 'deny ptrace' statement was supposed to only ignore
ptrace failures in the AUDIT log. However, ptrace was implicitly
allowed from unconfined processes (such as the docker daemon and
its integration tests) due to the abstractions/base include.

This rule narrows the definition such that it will only ignore
the failures originating inside of the container and will not
cause denials when the daemon or its tests ptrace inside processes.

Introduces positive and negative tests for ptrace /w apparmor.

Signed-off-by: Eric Windisch <eric@windisch.us>
Upstream-commit: f5c388b35a9ddd699b3dbbe85b80fa02234f8355
Component: engine
2015-07-30 14:40:28 -04:00
8461105dc9 Don't mount /proc as ro
This caused a regression with LSM labeling.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: bfc51cf6605ebcf7a4ec791fb0f3b5ae7b05c6fd
Component: engine
2015-07-30 10:57:50 -07:00
639fd1d44b Add back golint for daemon/execdriver/native
It's broken by #15099 Fix it.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Upstream-commit: e34f562a77276516b81756e9ea620a1625c49093
Component: engine
2015-07-30 08:58:54 +08:00
c5fec26f40 Merge pull request #15138 from ewindisch/apparmor-fix-test-plus-unconfined
Fix the proc integration test & include missing AA profile
Upstream-commit: 2ae174e491a366c4663b4f6ecee83cd6f64bcc3f
Component: engine
2015-07-29 15:32:13 -07:00
36993f8dbd Fix the proc integration test & include missing AA profile
Integration tests were failing due to proc filter behavior
changes with new apparmor policies.

Also include the missing docker-unconfined policy resolving
potential startup errors. This policy is complain-only so
it should behave identically to the standard unconfined policy,
but will not apply system path-based policies within containers.

Signed-off-by: Eric Windisch <eric@windisch.us>
Upstream-commit: 5832715052e9e165cc40a5ac8178fa62685985aa
Component: engine
2015-07-29 17:08:51 -04:00
59df5a01ec make docker compile on freebsd
Signed-off-by: Alexey Guskov <lexag@mail.ru>
Upstream-commit: 26c03d561ab126287bb3034cc23477d18869a888
Component: engine
2015-07-29 21:25:56 +03:00
7b7157591c Merge pull request #15099 from ewindisch/apparmor-restore-en
Restore AppArmor generation + fixes
Upstream-commit: d7661cb48b93978b4b30d2c60f3201d685af7f95
Component: engine
2015-07-29 09:36:59 -07:00
67bf5ba305 Replace GenerateRandomID with GenerateNonCryptoID
This allow us to avoid entropy usage in non-crypto critical places.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: 6bca8ec3c9ccc169c53b3d7060fe5c8ba8670aac
Component: engine
2015-07-28 22:31:01 -07:00
e9b83a5a26 Restore AppArmor profile generation
Will attempt to load profiles automatically. If loading fails
but the profiles are already loaded, execution will continue.

A hard failure will only occur if Docker cannot load
the profiles *and* they have not already been loaded via
some other means.

Also introduces documentation for AppArmor.

Signed-off-by: Eric Windisch <eric@windisch.us>
Upstream-commit: 3edc88f76df6a3bc9d887de8157ec71730c9057a
Component: engine
2015-07-28 17:45:51 -04:00
f2ac9ec822 Fix golint warnings for daemon/execdriver/*
Addresses: #14756

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Upstream-commit: 3d17c3bb663a5d7a65bd39a5ef32cb4668b48c53
Component: engine
2015-07-28 08:43:22 +08:00
d3667a22b6 Merge pull request #14976 from calavera/revert_unconfined_aa_policy
Revert "Introduce a dedicated unconfined AA policy"
Upstream-commit: 542685d856cad45b602e018baf36d7b268cbdfdc
Component: engine
2015-07-24 17:31:28 -07:00
61a71388a8 Revert "Introduce a dedicated unconfined AA policy"
This reverts commit 87376c3add7dcd48830060652554e7ae43d11881.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 94ab0d312fedaf063a6487c6b1b8b7b97221d24a
Component: engine
2015-07-24 16:35:51 -07:00
11ea6871f4 fix memory swappiness lxc
Signed-off-by: Jessica Frazelle <princess@docker.com>
Upstream-commit: a38b544ef082bcea76c4ea13e19d935ac09d3498
Component: engine
2015-07-24 15:46:51 -07:00
7b98273c2e Merge pull request #14887 from Microsoft/10662-stupidtypo
Windows: Stupid copy/paste error
Upstream-commit: 9dcd0cc1ee442ca262491b7738890793be641abc
Component: engine
2015-07-23 14:49:17 -04:00
f26842120f Merge pull request #14855 from ewindisch/apparmor-unconfined
Introduce a dedicated unconfined AA policy
Upstream-commit: ac9fc03c74e65a6a18bc0854d4a2841637fe1acf
Component: engine
2015-07-23 10:21:51 -07:00
c8167142d1 Windows: Stupid copy/paste error
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: cef5cb2dcbe1089f5fde6478a9c0f2ed93ce3c80
Component: engine
2015-07-22 19:30:47 -07:00
9f8e7b5fed Introduce a dedicated unconfined AA policy
By using the 'unconfined' policy for privileged
containers, we have inherited the host's apparmor
policies, which really make no sense in the
context of the container's filesystem.

For instance, policies written against
the paths of binaries such as '/usr/sbin/tcpdump'
can be easily circumvented by moving the binary
within the container filesystem.

Fixes GH#5490

Signed-off-by: Eric Windisch <eric@windisch.us>
Upstream-commit: 87376c3add7dcd48830060652554e7ae43d11881
Component: engine
2015-07-22 11:28:32 -04:00
e5400db724 Remove unused parameter in NewTtyConsole
It's introduced in
68ba5f0b69c9f38 (Execdriver implementation on new libcontainer API)

But I don't see reson why we need it.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Upstream-commit: af3059855c0b59c08b115a70d3f61b0fab3270de
Component: engine
2015-07-22 10:32:31 +08:00
58f999ca51 Windows: Remove erroneous comment
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: bd30d27636718b3ea576caa52807507d57283580
Component: engine
2015-07-21 14:25:08 -07:00
b6a0d280f9 Remove unused TtyTerminal interface
It was used only by integration tests, which now gone.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: 6ae377ffa0c106749db1bcd6cf158f8b0056dea8
Component: engine
2015-07-21 09:56:28 -07:00
74cf202b4f Move AppArmor policy to contrib & deb packaging
The automatic installation of AppArmor policies prevents the
management of custom, site-specific apparmor policies for the
default container profile. Furthermore, this change will allow
a future policy for the engine itself to be written without demanding
the engine be able to arbitrarily create and manage AppArmor policies.

- Add deb package suggests for apparmor.
- Ubuntu postinst use aa-status & fix policy path
- Add the policies to the debian packages.
- Add apparmor tests for writing proc files
Additional restrictions against modifying files in proc
are enforced by AppArmor. Ensure that AppArmor is preventing
access to these files, not simply Docker's configuration of proc.
- Remove /proc/k?mem from AA policy
The path to mem and kmem are in /dev, not /proc
and cannot be restricted successfully through AppArmor.
The device cgroup will need to be sufficient here.
- Load contrib/apparmor during integration tests
Note that this is somewhat dirty because we
cannot restore the host to its original configuration.
However, it should be noted that prior to this patch
series, the Docker daemon itself was loading apparmor
policy from within the tests, so this is no dirtier or
uglier than the status-quo.

Signed-off-by: Eric Windisch <eric@windisch.us>
Upstream-commit: 80d99236c1ef9d389dbaca73c1a949da16b56b42
Component: engine
2015-07-21 11:05:53 -04:00
d9e652a366 Update libcontainer
Replaced github.com/docker/libcontainer with
github.com/opencontainers/runc/libcontaier.
Also I moved AppArmor profile generation to docker.

Main idea of this update is to fix mounting cgroups inside containers.
After updating docker on CI we can even remove dind.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: c86189d554ba14aa04b6314970d3699e5ddbf4de
Component: engine
2015-07-16 16:02:26 -07:00
d192eb2289 Merge pull request #14620 from hqhq/hq_cgroup_ro_optional
Remove cgroup read-only flag when privileged
Upstream-commit: 8801906cedb73f171a8556294e78d649fee3db32
Component: engine
2015-07-16 16:00:02 -07:00
c4cef0431e Merge pull request #14604 from Microsoft/10662-addbridge
Windows: Plumb through -b on daemon
Upstream-commit: 97515a35ca4c91f1a1444f73f5fe9385a94f1dd1
Component: engine
2015-07-16 08:44:40 -07:00
ca53cad1a3 Remove cgroup read-only flag when privileged
Fixes: #14543

It needs libcontainer fix from:
https://github.com/opencontainers/runc/pull/91

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Upstream-commit: a7f5e1c4c3559127758131123242bb54f26da8ce
Component: engine
2015-07-14 15:00:41 +08:00
43c3fe4dbf Windows: Plumb through -b on daemon
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: e0ec0cc115a7b271defc7ab5680eb6836ef71c7a
Component: engine
2015-07-13 12:41:48 -07:00
b0da7fa04d Adds support for specifying additional groups.
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
Upstream-commit: e0d96fb3ef562103690529c34140d04604599497
Component: engine
2015-07-13 14:47:28 -04:00
11e2c4a554 Add the memory swappiness tuning option to docker.
Memory swappiness option takes 0-100, and helps to tune swappiness
behavior per container.
For example, When a lower value of swappiness is chosen
the container will see minimum major faults. When no value is
specified for memory-swappiness in docker UI, it is inherited from
parent cgroup. (generally 60 unless it is changed).

Signed-off-by: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
Upstream-commit: 921da495d24695dda66d3f58e78887dd0bc2402e
Component: engine
2015-07-12 13:16:33 +05:30
9f9bda0c57 Merge pull request #13669 from ewindisch/readonly-proc
Make /proc, /sys, & /dev readonly for readonly containers
Upstream-commit: 703248da20566f707b8290662805a9264629e2e0
Component: engine
2015-07-10 15:32:13 -07:00
576b45a55d Merge pull request #13554 from Microsoft/10662-winexec
Windows: The real Windows exec driver is here.
Upstream-commit: b7e8169274ba4b897601e1025b91ebd361902213
Component: engine
2015-07-10 17:13:10 -04:00
c3450bd95b Windows: Exec driver
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 9ae9d4c87af8b04eb80006aca9f760ffdb1052bb
Component: engine
2015-07-10 13:36:56 -07:00
c770b13f1f Add cgroup bind mount by default
Libcontainer already supported mount container's own cgroup into
container, with this patch, we can see container's own cgroup info
in container.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Upstream-commit: f18fb5b3efd59d54c00d4e1b1d4b88c4b21e96be
Component: engine
2015-07-10 13:12:09 +08:00
793088ed0a Make /proc, /sys, /dev readonly for readonly containers
If a container is read-only, also set /proc, /sys,
& /dev to read-only. This should apply to both privileged and
unprivileged containers.

Note that when /dev is read-only, device files may still be
written to. This change will simply prevent the device paths
from being modified, or performing mknod of new devices within
the /dev path.

Tests are included for all cases. Also adds a test to ensure
that /dev/pts is always mounted read/write, even in the case of a
read-write rootfs. The kernel restricts writes here naturally and
bad things will happen if we mount it ro.

Signed-off-by: Eric Windisch <eric@windisch.us>
Upstream-commit: 5400d8873f730e6099d29af49fe45931665c3b49
Component: engine
2015-07-02 19:08:00 +00:00
842ad32482 Replace latest log by logrus
Related to #11618 and #11614

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 10e114fb956db1b1a8bc9308cc6d14cbf30a5bab
Component: engine
2015-07-02 16:11:52 +02:00
b565b94e85 daemon: lower allocations
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
Upstream-commit: c1477db04fc32621652cf6a8fd2976b6bbf2066e
Component: engine
2015-06-30 01:45:31 +03:00
f74cf65168 Merge pull request #14030 from estesp/init-memory-swappiness
Initialize swappiness in libcontainer cgroups template
Upstream-commit: c2815496101e7523c8bc2e459026f8c5e84cdb08
Component: engine
2015-06-25 11:36:54 -07:00
824de2eaf8 Initialize swappiness in libcontainer cgroups template
By default, the cgroup setting in libcontainer's configs.Cgroup for
memory swappiness will default to 0, which is a valid choice for memory
swappiness, but that means by default every container's memory
swappiness will be set to zero instead of the default 60, which is
probably not what users are expecting.

When the swappiness UI PR comes into Docker, there will be docker run
controls to set this per container, but for now we want to make sure
*not* to change the default, as well as work around an older kernel
issue that refuses to allow it to be set when cgroup hiearchies are in
use.

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
Upstream-commit: 9e9d2276777ba6f48390a33d67ed544b5c183968
Component: engine
2015-06-18 19:27:04 -04:00
7b04b15fbc Fix typo in lxc_template.go
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Upstream-commit: cb979edec0c8a8ba5a874abcbf74eae3a48fe52c
Component: engine
2015-06-16 15:19:43 -07:00
1d551c443c Make LXC exec driver compatible with recent LXC where lxc.autodev is enabled by default
Update LXC to 1.1.2

Signed-off-by: Alex Samorukov <samm@os2.kiev.ua>
Upstream-commit: 6089e679a2fb2494fd3e599a9eab9327e6a509fc
Component: engine
2015-06-16 15:19:00 -07:00
61e1950d67 Correct getEnv split.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 85f895ce681ebbc3a1990ef73875cf94b5c77d17
Component: engine
2015-06-11 14:40:46 -07:00
ebc23891b1 Revert shared container rootfs
This is breaking various setups where the host's rootfs is mount shared
correctly and breaks live migration with bind mounts.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: c9d71317be5fd13ba544a2699442a40ccf2cc3cc
Component: engine
2015-06-10 11:29:27 -07:00
9eb2d545d0 fix lxc build
Signed-off-by: Jessica Frazelle <princess@docker.com>
Upstream-commit: 0adfb908a682e679b54f511fe89e668d6e676dda
Component: engine
2015-06-05 09:50:30 -07:00
8354ab7272 Remove useless debug message
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: f1b59d64d21d5a0f54536b26161a31441697ca61
Component: engine
2015-06-01 11:15:15 -07:00
d9b5b5714d Merge pull request #13491 from jfrazelle/revert-exec-privileged
Revert "Add docker exec run a command in privileged mode"
Upstream-commit: b50e7809254c1d3cc9bd2b94be0c87b68576ed2a
Component: engine
2015-05-26 16:41:50 -07:00
dc2caf8054 Merge pull request #13444 from runcom/fix-race-stats
Fix race in stats cli and native driver
Upstream-commit: 0d445685b8d628a938790e50517f3fb949b300e0
Component: engine
2015-05-26 15:34:50 -07:00
d89704cf56 Revert "Add docker exec run a command in privileged mode"
This reverts commit 72a500e9e5929b038816d8bd18d462a19e571c99.

Signed-off-by: Jessica Frazelle <princess@docker.com>

Conflicts:
	daemon/execdriver/native/exec.go
	integration-cli/docker_cli_exec_test.go
	runconfig/exec.go
Upstream-commit: 40b71adee390e9c06471b89ed845132b4ec80177
Component: engine
2015-05-26 14:12:16 -07:00
e0098fdbb0 Add lock before accessing native driver active containers
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
Upstream-commit: 9e425d56d0ec7d3343dd309500a7fe6e36648f2b
Component: engine
2015-05-26 13:55:02 +02:00
722bcfc109 Fix race in stats cli and native driver
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
Upstream-commit: 77280a87b70d3b2b629cd30ea93464287f346fa1
Component: engine
2015-05-26 13:55:02 +02:00