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
A quick search of the lxc utils code shows that it does a reboot
capability check similar to what libvirt does (I think). So it looks
like you should be able to always keep CAP_SYS_BOOT and rely on the
underlying container backend to decide whether to drop it.
Oh wait, it looks like the reboot capability check isn't present in 0.7.5 (which is the version currently recommended to run Docker, since it ships with Ubuntu 12.04 LTS); it was added only in 0.8 it seems.
Oops, sorry @jpetazzo. Though my statement is still always true for libvirt-lxc ;-)
The capability check and drop could be done in dockerinit. In fact my docker libvirt branch (which I'm currently working on rebasing to 0.7-rc4) already drops capabilities from dockerinit, so it's halfway there at least.
I think the reboot capability checking has to be done from within a container. Here's an lxc tools comment describing it:
/*
* reboot(LINUX_REBOOT_CMD_CAD_ON) will return -EINVAL
* in a child pid namespace if container reboot support exists.
* Otherwise, it will either succeed or return -EPERM.
*/
Activity
kiorky commentedon Oct 25, 2013
Basically and obiously, sys_cap_boot is called there and on a container, do not touch to the host....
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/kernel/reboot.c?id=refs/tags/v3.12-rc6#n223
kiorky commentedon Oct 25, 2013
And implementation of the restart is there : https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/kernel/pid_namespace.c#n281
Do not drop sys_boot
jpetazzo commentedon Oct 30, 2013
Good news; according to @jpoimboe:
Green light on this, then!
kiorky commentedon Oct 30, 2013
It is better, nevertheless to have this kind of safeguard at a kernel level, did you suceeded in getting back in touch with rhel ppl ?
jpetazzo commentedon Oct 30, 2013
Josh Poimboeuf is one of the RH guys (specifically, working on libvirt-lxc integration :-))
jpetazzo commentedon Oct 31, 2013
Oh wait, it looks like the reboot capability check isn't present in 0.7.5 (which is the version currently recommended to run Docker, since it ships with Ubuntu 12.04 LTS); it was added only in 0.8 it seems.
This is the check in latest version:
https://github.com/lxc/lxc/blob/cbef6c52bea93130abd8920c4b4dd1780548ac7b/src/lxc/start.c#L441
It's in 0.8:
https://github.com/lxc/lxc/blob/lxc-0.8.0/src/lxc/start.c#L434
But not 0.7.5:
https://github.com/lxc/lxc/blob/lxc-0.7.5/src/lxc/start.c
So back to square one. Maybe Docker could do the capability check somehow... That requires some extra steps.
jpoimboe commentedon Oct 31, 2013
Oops, sorry @jpetazzo. Though my statement is still always true for libvirt-lxc ;-)
The capability check and drop could be done in dockerinit. In fact my docker libvirt branch (which I'm currently working on rebasing to 0.7-rc4) already drops capabilities from dockerinit, so it's halfway there at least.
jpetazzo commentedon Nov 1, 2013
Any reason why it should be done in dockerinit vs. at "runtime detection" (as is done for other things)?
(Just inquiring.)
jpoimboe commentedon Nov 1, 2013
I think the reboot capability checking has to be done from within a container. Here's an lxc tools comment describing it:
jpetazzo commentedon Nov 1, 2013
Right, makes sense. So
dockerinit!