-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Finding the minimal set of privileges for a docker container to spawn rootless containers #1456
Comments
You are already running privileged containers at this point. You'd need to do
None really.
Processes inside the container can access the host's kernel keyring directly (which contains various crypto stuff that some system components use) if a process is running with privileges. Though processes inside the inner container (if you're using user namespaces) might be blocked (I haven't read that kernel code in a while though). In general I would discourage it, but to be honest if you don't specify |
Oh sorry, this too
Rootless containers most definitely cannot do this. The reason that cgroups actually work in the inner container is because your container has |
@cyphar thank you for taking the time. I'm super excited about the whole rootless container story and all the work you've been doing. I've now been able to get a working prototype of the concept described above. The key differences are that I have been unable to get the networking setup without adding Would it be fair to say that the machinery is not yet in place to be able to run rootless containers with networking as children of unprivileged containers themselves? To provide network access, I've picked up @jessfraz' netns to great, frictionless effect and run this as a prestart hook. This also meant mounting the host's Given the lack of granularity in Please feel free to close at any time given that this isn't so much of an issue as it is a discussion. I hope that it helps someone else in their wacky experimentation down the road. |
This was merely not included to prevent people from shooting themselves in the foot, it should be a privileged operation, also if people were using pivot_root they were probably using other things that were blocked as well like mount or chroot so it kinda just went hand in hand, there wasn't an exact reason |
@ggoodman @cyphar Good to see the awesome discussion, I'm also trying to run runc inside a container as a normal user (rootless), where I'm facing much issues, and I do not want to run the base container will all the privileges, I was able to get it working with udocker (https://github.com/indigo-dc/udocker), but I was hoping I could use runc and avoid all the other python dependency, the problem with udocker being it does not support OCI complaint images, so I would like to get your opinions on whats the best approach and the hurdles came across while running them. Thanks. |
@frezbo You can use skopeo to convert a Docker image into an OCI image (I've added support to |
@cyphar I have used both the awesome tools by you, and the relevant issues is here: indigo-dc/udocker#111, udcoker can only understand v1 spec and skopeo copies from oci to v2, so I'm planning to use runc inside a container, with the least possible privilege escalation |
I've been flailing away at the idea to run a pool of
rootless
containers as children of a docker container. My intent is to have the docker container run a web server that will spin up a pool of child, rootless containers to which requests can be proxied. These children would be designed to be isolated from each other and the host system from the side-effects of running untrusted code.I need to pass additional file descriptors to these children which precludes running children as siblings using the host docker daemon. So here I am and I hope I'm not overstepping my bounds by asking for guidance via an issue.
Set up
Create a root filesystem tgz:
Dockerfile with
runc
,libseccomp2
and therootfs
:False starts:
Build and run the container, adding
CAP_SYS_ADMIN
:Same, but mount
/sys/fs/cgroup
asrw
:Same, but invoke
runc
with--no-new-keyring
:Finally 'working':
Same, but also add
--no-pivot
:Removing
pivot_root
seems like a bad idea given my objectives so I created a copy of the default seccomp profile and added thepivot_root
syscall to the big list ofSCMP_ACT_ALLOW
calls. This let me drop--no-pivot
.What kind of exposure am I creating by opening up by whitelisting the
pivot_root
syscall?Also, I'm past my abilities in trying to figure out how I might avoid
--no-new-keyring
What kind of exposure am I creating by using the
--no-new-keyring
flag?The text was updated successfully, but these errors were encountered: