You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am finding the default, immutable approach to capabilities that Docker takes ends up forcing users to use privileged containers. Docker removes many capabilities by default, and the only way to get them back is to use privileged containers which is most often overkill. Running privileged containers is recommended so frequently I think the implications are lost, leaving many users vulnerable. For instance, Apparmor is bypassed when using privileged containers...
It'd be nice to be able to turn on capabilities manually when running containers, this way it is obvious what users are doing, easier to reason about, and easier to manage the container security via other tools like Apparmor.
Also for this issue I would like 'security' label.
@danbeaulieu have you checked how LXC works? one should see if it's possible to expose functionality you intend through libcontainer...and keep in mind the portability plans of Docker development team...
So yes, at one point there was even an "--opt" command flag in master which allowed configuring this stuff but was taken out due to UI/API discussions since it didn't seem polished enough.
Specification of capabilities at container instantiation time would be very useful, but not sufficient, however. Often applications will not run correctly if not granted the capabilities they require. We should adopt a principle that the container should specify its requirements/prerequisites for correct operation. Therefore, there should be Dockerfile syntax for required capabilities.
Variable, optional, and context-specific configuration should be provided at instantiation time.
Agreed, but decisions about whether to allow a given container need to be
performed at a different layer, especially in a multi-user, multi-host,
policy-rich environment.
It would be fine by me if the capabilities granted also had to be specified
at container instantiation time.
Ideally privileged mode would be a special case of a more general feature: being able to blacklist capabilities. Dockers default now is to whitelist. Would be nice to have a mode which is explicitly blacklisting capabilities (but otherwise allowing things).
User driven whitelisting would also be acceptable but perhaps less practical to use.
Is anyone aware of any PRs working on this?
Perhaps it is also worth surveying what people use priv mode for. For me it is usually VPN (eg openvpn) and systemd.
@michaelneale I'm not sure if anyone is working on this, but something similar has been alluded to on IRC and on the google group. @shykes mentioned a driver opts which would allow users to pass options directly down to the driver, not sure where that is in dev.
I need privileged mode to allow mounting of a filesystem. Really the only capability I need is sys_admin, and I'd like to use AppArmor to limit the mounting capabilities, which I can do if I re enable AppArmor for privileged containers, but, like I said privileged is overkill for what I need. As it is now, I'm going to end up tuning AppArmor a lot more to prevent all the things in privileged I don't actually want.
Can whoever has the power add the security label? It might get more attention from the community.
Yes, this is being worked on, it's just a matter of people agreeing on the UI of it. The main work is already done and was even merged into master a few releases ago, but it got pulled because of UI concerns.
@michaelneale: why not just have some system where you can use wildcards so you can specify "allow all, except these". That is far more explicitly specifying that you are blacklisting. We should, at no point, be using blacklists for security features in Docker. That's just a bad idea.
@cyphar - agree re blacklists. Just as thing stands now - --privileged is being used almost by default just to get things working (which is worse than blacklisting - not saying blacklisting should be used!).
@michaelneale I understand that, That's why I like the way which #6687 is going. It's a whitelist, but you can also do wildcards and remove perms (thus allowing for admins to do blacklists).
Activity
gdm85 commentedon Jun 23, 2014
Also for this issue I would like 'security' label.
@danbeaulieu have you checked how LXC works? one should see if it's possible to expose functionality you intend through libcontainer...and keep in mind the portability plans of Docker development team...
cpuguy83 commentedon Jun 23, 2014
So yes, at one point there was even an "--opt" command flag in master which allowed configuring this stuff but was taken out due to UI/API discussions since it didn't seem polished enough.
Lots of people want this.
bgrant0607 commentedon Jun 25, 2014
+1 to the principle of least privilege.
Specification of capabilities at container instantiation time would be very useful, but not sufficient, however. Often applications will not run correctly if not granted the capabilities they require. We should adopt a principle that the container should specify its requirements/prerequisites for correct operation. Therefore, there should be Dockerfile syntax for required capabilities.
Variable, optional, and context-specific configuration should be provided at instantiation time.
cpuguy83 commentedon Jun 25, 2014
And that would also require user authorization to allow said capabilities.
bgrant0607 commentedon Jun 25, 2014
Agreed, but decisions about whether to allow a given container need to be
performed at a different layer, especially in a multi-user, multi-host,
policy-rich environment.
It would be fine by me if the capabilities granted also had to be specified
at container instantiation time.
michaelneale commentedon Jun 26, 2014
+1.
Ideally privileged mode would be a special case of a more general feature: being able to blacklist capabilities. Dockers default now is to whitelist. Would be nice to have a mode which is explicitly blacklisting capabilities (but otherwise allowing things).
User driven whitelisting would also be acceptable but perhaps less practical to use.
Is anyone aware of any PRs working on this?
Perhaps it is also worth surveying what people use priv mode for. For me it is usually VPN (eg openvpn) and systemd.
danbeaulieu commentedon Jun 26, 2014
@michaelneale I'm not sure if anyone is working on this, but something similar has been alluded to on IRC and on the google group. @shykes mentioned a driver opts which would allow users to pass options directly down to the driver, not sure where that is in dev.
I need privileged mode to allow mounting of a filesystem. Really the only capability I need is sys_admin, and I'd like to use AppArmor to limit the mounting capabilities, which I can do if I re enable AppArmor for privileged containers, but, like I said privileged is overkill for what I need. As it is now, I'm going to end up tuning AppArmor a lot more to prevent all the things in privileged I don't actually want.
Can whoever has the power add the security label? It might get more attention from the community.
cpuguy83 commentedon Jun 26, 2014
Yes, this is being worked on, it's just a matter of people agreeing on the UI of it. The main work is already done and was even merged into master a few releases ago, but it got pulled because of UI concerns.
danbeaulieu commentedon Jun 26, 2014
@cpuguy83 is there a discussion somewhere hashing out these concerns? I'd like to add my comments if possible and if it helps the discussion.
cpuguy83 commentedon Jun 26, 2014
It's probably on the docker-dev mailing list, I haven't looked at it though.
cpuguy83 commentedon Jun 26, 2014
#6687
cyphar commentedon Jul 7, 2014
@michaelneale: why not just have some system where you can use wildcards so you can specify "allow all, except these". That is far more explicitly specifying that you are blacklisting. We should, at no point, be using blacklists for security features in Docker. That's just a bad idea.
michaelneale commentedon Jul 7, 2014
@cyphar - agree re blacklists. Just as thing stands now - --privileged is being used almost by default just to get things working (which is worse than blacklisting - not saying blacklisting should be used!).
cyphar commentedon Jul 7, 2014
@michaelneale I understand that, That's why I like the way which #6687 is going. It's a whitelist, but you can also do wildcards and remove perms (thus allowing for admins to do blacklists).
michaelneale commentedon Jul 7, 2014
Sounds great to me, very happy with that.
On Monday, July 7, 2014, Aleksa Sarai [email protected] wrote:
Michael D Neale
home: www.michaelneale.net
blog: michaelneale.blogspot.com
crosbymichael commentedon Jul 16, 2014
This has now been implemented in
--cap-addand--cap-drop. It's currently in master and should be out in the next docker release