Commit Graph

188 Commits

Author SHA1 Message Date
59f2aefefe remove docker-unconfined profile we were not using it and it breaks apparmor on wheezy
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
Upstream-commit: e542238f2a4ba9d77bf8ebc77e319dd6b321925f
Component: engine
2015-08-06 16:51:01 -07:00
e46c794117 revert apparmor changes back to how it was in 1.7.1, but keep tests
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
Upstream-commit: ed248207d74ac59fb190be31dee96c6a8cef68da
Component: engine
2015-08-06 12:49:25 -07:00
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
7623ba5e39 Fix network with -b none
* Don't AllocateNetwork when network is disabled
* Don't createNetwork in execdriver when network is disabled

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: 3cb14df68c1a59981907fec3bccab80a1d0dda59
Component: engine
2015-05-24 08:26:59 -07:00
13426de5e6 Docker integration with libnetwork
- Updated Dockerfile to satisfy libnetwork GOPATH requirements.
    - Reworked daemon to allocate network resources using libnetwork.
    - Reworked remove link code to also update network resources in libnetwork.
    - Adjusted the exec driver command population to reflect libnetwork design.
    - Adjusted the exec driver create command steps.
    - Updated a few test cases to reflect the change in design.
    - Removed the dns setup code from docker as resolv.conf is entirely managed
      in libnetwork.
    - Integrated with lxc exec driver.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
Upstream-commit: d18919e304c240df84502cdcc5ed655d92d12d4f
Component: engine
2015-05-19 22:40:19 +00:00
dc9bbf77b5 Add --uts=host to allow sharing the UTS namespace
Signed-off-by: Darren Shepherd <darren@rancher.com>
Upstream-commit: f2e5207fc989288ad136d48222df8e7754eb0e9b
Component: engine
2015-05-13 17:56:32 -07:00
c578ab5fb7 Fix race between execdriver.Kill and execdriver.Run
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: ca7219f5daa194ae714c3a3396703e08d8a137c8
Component: engine
2015-05-11 13:23:50 -07:00
1d2b89b8ee Merge pull request #13062 from Microsoft/10662-nativedriver
Fix os.MkdirAll in native driver
Upstream-commit: b4dc101d746e657ab84547ae28d41d86fb6e4d34
Component: engine
2015-05-07 16:34:31 -07:00
ac6f208e83 Allow libcontainer to eval symlink destination
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Add tests for mounting into /proc and /sys

These two locations should be prohibited from mounting volumes into
those destinations.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: f25bbedc85e8a99c1389dbe8f48436907ce24526
Component: engine
2015-05-07 14:43:39 -07:00
c87ab46f22 Mask reads from timer_stats and latency_stats
These files in /proc should not be able to be read as well
as written to.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: a7a51306b1459a67da3a9cbbe8c9f80d3950c084
Component: engine
2015-05-07 14:42:23 -07:00
54739fa6d1 Mount RO for timer_stats and latency_stats in proc
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 27ae108b4eda48a621afc5bf2157ef11c314a858
Component: engine
2015-05-07 14:42:23 -07:00
f9ca327070 Mount /proc/fs as readonly
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 42c8c1b0b884c91efa518568181d276afd9d866f
Component: engine
2015-05-07 14:42:23 -07:00
50f626562d Prevent write access to /proc/asound
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Conflicts:
	integration-cli/docker_cli_run_test.go
Upstream-commit: d87da59c79eabb794087f731d3ad51ea98f7a3cc
Component: engine
2015-05-07 14:42:23 -07:00
2ee6387cbc Merge pull request #12165 from icecrime/optional_userland_proxy
Optional userland proxy
Upstream-commit: 74bfa3675353aaf10ca760e82a79d758bea0ff6b
Component: engine
2015-05-07 14:01:16 -07:00
91089ecbb8 Fix os.MkdirAll in native driver
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 390f3c99d3a6fd5e9802a675a7c1618d40e3af26
Component: engine
2015-05-07 12:09:30 -07:00
d7e8665b03 Add --userland-proxy daemon flag
The `--userland-proxy` daemon flag makes it possible to rely on hairpin
NAT and additional iptables routes instead of userland proxy for port
publishing and inter-container communication.

Usage of the userland proxy remains the default as hairpin NAT is
unsupported by older kernels.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Upstream-commit: f42348e18f73d1d775d77ac75bc96466aae56d7c
Component: engine
2015-05-04 16:07:45 -07:00
fccc1b566d Update libcontainer and make it the source of truth on logrus version
To help avoid version mismatches between libcontainer and Docker, this updates libcontainer to be the source of truth for which version of logrus the project is using.  This should help avoid potential incompatibilities in the future, too. 👍

Signed-off-by: Andrew "Tianon" Page <admwiggin@gmail.com>
Upstream-commit: 80a895142e7101b44ff71910bb2da994b1cc4f5f
Component: engine
2015-05-04 11:02:44 -06:00
809dae68ab Remove unused error return
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
Upstream-commit: 4aff563282c4d467575aed006642a22d673d4cb7
Component: engine
2015-05-02 15:57:57 +02:00
1a116000d5 option to configure cgroups
Signed-off-by: Jessica Frazelle <jess@docker.com>
Upstream-commit: 2afcd10202283478cbafb21e8c5f90f1236acccc
Component: engine
2015-04-27 17:50:39 -07:00
0bd2f00743 reuse same code for setting pipes in run/exec
This also moves `exec -i` test to _unix_test.go because it seems to need a
pty to reliably reproduce the behavior.

Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com>
Upstream-commit: ade8146aa82baa88bacdcf2d9c2559e8f47d71e4
Component: engine
2015-04-23 21:54:21 +00:00
925bb7aac9 remove unused utils
Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com>
Upstream-commit: 71b5a754cec09b2f1bcef986bdd6fd109451b8f2
Component: engine
2015-04-22 21:53:45 +00:00
8b9e25d786 clenaup: delete unused function getEnv
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
Upstream-commit: e607bb49c48e0478b07fceb640d3e765151050e4
Component: engine
2015-04-20 16:32:42 +08:00