Repository navigation
Conversation
Rather than only supporting lxc.cap.drop, support should be added for lxc.cap.keep. This would enable the principle of deny-by-default, with an ability to granularly enable capabilities. Allusion to the necessity for this feature is already noted in lxc_template.go Resolves issue moby#2080
|
/cc @jpetazzo |
|
if i understand well this PR, it can also help #2391 ! |
|
FYI - this patch is presently compiling but does not pass the tests it introduces. Until then, consider a WIP. I'll update when the tests are passing. @kiorky yes, this would allow users to granularly control capabilities themselves. I might be overly optimistic that it will reduce bike-shedding over which capabilities should be part of the default set ;-) |
|
My test failures are, not surprisingly, based on the LXC version requirement. This requires running off LXC trunk or their nightly-build PPA. Docker presently requires some updates to work with upstream/trunk LXC (pre-v1). |
|
Hi Eric, Thanks for providing this patch. I don't know exactly how it should be merged, though; my main concern are:
Re/ 1, we could patch Re/ 2, the long term goal is to support other runtime backends than LXC; having the However, capabilities are not LXC specific; they are Linux-specific, so we might be able to map them to other backends (probably not FreeBSD, Solaris, and OS X, but still). What do you think? |
|
@jpetazzo - Thank you. re: 1I had seen this as maintaining a default set of capabilities and simply adding -cap to set an override for special cases and for those with specific security requirements. I'd like to see '-privileged' removed, but that might be too tough on users. Version requirements are nothing really new to software projects. Choices here seem to be: I'm inclined to suggest option D. It is fairly clean, doesn't introduce much cruft to remove later, has little possibility for edge-case failures, quirks, etc. Eventually, LXC 0.9 and below are unsupported and the warning is removed. It also sets a good precedent for supporting underlying platforms that might not support this feature. re: 2FreeBSD jails have "allow.*" parameters which are equivalent. The names are different, of course. Thus, the '-cap' flag would be the same, but the configuration values would be different and platform-specific. Instead of passing '-cap sys_admin', you'd pass '-cap mount' on FreeBSD. Some platforms might not have as much granularity and this flag may just be unsupported as with LXC 0.9 and below. These caps are being set as arguments to 'docker run', they're not going into the Dockerfile. As a result, I'd think platform-specific configuration values should be okay? |
|
For case 1: solution d makes sense. For case 2, well, what can I say—this sounds really tempting :-) Moreover, a Dockerfile may (in the future) explicitly require some caps to be there, and Docker would refuse (or warn) if they are not explicitly given when the container is started. E.g. if a container needs the /cc-ing @crosbymichael @vieux for their feedback as well. |
|
Hi guys, I like option D also. I do want to emphasize the lxc-independence part. Going forward we want to get rid of the dependency on lxc syntax and quirks. We will break Thanks! |
|
The capability names used by lxc nearly match those in the Linux kernel and OpenVZ supports capabilities as well, these names are similarly stripped The FreeBSD analogue for jails are prefixed by 'allow.' such as In FreeBSD, it seems there is less granularly there in favor of less As for -lxc-conf, there also exist various other parameters for FreeBSD
|
|
@shykes, how we should we proceed? Suggestion:
Is that a viable plan? Do you want us to take this to docker-dev? (Or draw attention from docker-dev to this thread since there is some talk already here?) Let us know :) |
|
ping @shykes |
|
+1 for per container capabilities... the existing mitigations described here https://groups.google.com/forum/#!msg/docker-user/T45Kc9vD804/xz7UZk_cilsJ are not viable for service class environments needing different caps per container. even something as simple (hacky) as allowing |
|
We just merged a Pr removing drop caps from LXC and into the docker init. We can discuss a better way to select capabilities on the original issue now that this is no longer dependent on LXC. |
Rather than only supporting lxc.cap.drop, support
should be added for lxc.cap.keep. This would enable
the principle of deny-by-default, with an ability to
granularly enable capabilities.
Allusion to the necessity for this feature is already
noted in lxc_template.go
Resolves issue #2080