Skip to content

userns_mode option is not honoured #493

Open
@vmsh0

Description

@vmsh0

Hi,

It seems like userns mode is not honoured by either podman-py or the podman API.

Running podman 4.9.3 on an up-to-date Ubuntu 24.04.1 LTS virtual machine.

$ cat /etc/sub{uid,gid}
[some random username]:100000:65536
containers:2147483647:2147483648
[some random username]:100000:65536
containers:2147483647:2147483648

When creating and running the same exact container with podman-py and with the Podman CLI, it is apparent that in the former case the userns_mode='auto' option is not honoured.

I attach this test case which shows the issue clearly: https://gist.github.com/vmsh0/f32b137b6d4bf1d3dbf5b6745e92911c

One unit test creates a container using podman-py: the test fails as after inspecting the container you can see that UsernsMode is empty. The other unit test creates the same container by calling the podman CLI: in this case, the test succeeds and you can see that UsernsMode is set to 'private' as expected.

As far as I can see, this fails silently. I noticed the issue by pure chance while investigating a different problem. This might potentially have security implications, as users might be expecting their containers to run in a separate user namespace while they are really running in the root namespace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions