-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Rootless podman using --device and --group-add keep-groups not working as expected #10166
Comments
The |
There has been an open PR for many months on this, but no movement. |
Yes. |
I tested swapping out to "crun" and this actually worked! A slight note, the trouble shooting page still says: But it should be: See here for details: #4477 But also I do have 2 followup questions as well.
|
Basically, the annotation is causing the OCI runtime to skip one of the normal steps of setting up a container, which involves dropping additional group memberships. I'm actually writing a blog that includes many details on this at the moment. |
It does definitely increase the privileges allowed to the container - the container process, if it breaks out of the container, now has access to the groups of the user that launched Podman, which could potentially include important ones (wheel, for example) |
But note, this is only for Group Access via GID. SELinux, Dropped Capabilities, User Namespace, SECCOMP are still in effect. So taking advantage of WHEEL from the perspective of sudo access, is still going to be blocked. |
Fixes: containers#10166 Signed-off-by: Daniel J Walsh <[email protected]>
Not that this needs to remain open, but is there a way to see how the groups are 'kept' and where they are mapped? |
@vrothberg Is this something that psgo does (or could do)? |
This would seem like a good job for psgo. |
--hgroups |
To rephrase my question, because I don't need to view the mappings per se. (Though it would be nice) Essentially, is there a way I can map the groups myself with podman? However, when I tried to do |
When you do grep video /etc/group So now inside of the container the process will have group 39, BUT this is not the same as group 39 on the host. When running rootless containers you are using user namespace, so that the group is offset by the usernamespace you have joined. $ podman unshare cat /proc/self/gid_map Which means that the video group inside of the container is going to be GID 100038 on the host.
In order to access the video device on the host the process needs GID=39, so it fails. When you run with --group-add keep-groups, the oci container runtime (crun), does not call the setgroups call, so the new container process, maintains the groups of it's parent process. If the parent process had access to GID=39, the processes inside of the container will maintain still have that GID. Note that inside of the container the GID 39 is not mapped, so the processes within the container will see this as the
|
Sorry for asking in an already closed issue, but I cannot find more information about this. Does |
Description
I am trying to understand how to properly use
--device
in a rootless podman container.Currently, when I added a device to the rootless container I see that the device is owned by:
nobody nogroup
I have seen this on the troubleshooting: https://github.com/containers/podman/blob/master/troubleshooting.md#20-passed-in-device-cant-be-accessed-in-rootless-container
But this is only a solition for
crun
is there one for runc?I have pulled the latest
podman
and have attempted to use:http://docs.podman.io/en/latest/markdown/podman-run.1.html#device-host-device-container-device-permissions
--group-add keep-groups
But this does not seem to change behavior, I still see the device is owned by:
nobody nogroup
I believe this issue is preventing me from accessing my GPU in a rootless container.
See here if you want specific details: NVIDIA/nvidia-container-runtime#85 (comment)
What are my options? Do I need to migrate to crun? Will that work? Should this be working with runc and --group-add?
Steps to reproduce the issue:
podman run -it --device </dev/some-mnt>:</dev/some-mnt> --group-add keep-groups
$ ls -la /dev
Output will show device is owned by
nobody nogroup
I have also tried with
--group-add video
with no luck either.Describe the results you received:
Describe the results you expected:
I would expect to be able to see the
video
group.Additional information you deem important (e.g. issue happens only occasionally):
Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/master/troubleshooting.md)
Yes
Additional environment details (AWS, VirtualBox, physical, etc.):
Physical
The text was updated successfully, but these errors were encountered: