-
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
Unable to run systemd container with custom SELinux policy #11100
Comments
This is an issue with udica not with Podman. Transfering to udica repo. |
@wrabcak PTAL |
Hi All, This needs to be solved on both sides, udica and also podman. It looks like container_init_t label is hard coded in the podman code. Correct, @rhatdan ? From udica POV, it should be simple to catch if systemd is inside the container. We'll look "--systemd always" parameter is used. But how to fix it from podman side? @rhatdan WDYT? FYI: @vmojzis |
@rhatdan Is there any way to override the "container_init_t" label for init containers? |
|
Hi @rhatdan, I've repeated "Steps to reproduce the issue" on
On the other hand, I managed to run another container (without
This time, So it seems like if I run with |
Currently we override the SELinux labels specified by the user if the container is runing a kata container or systemd container. This PR fixes to use the label specified by the user. Fixes: containers#11100 Signed-off-by: Daniel J Walsh <[email protected]>
Currently we override the SELinux labels specified by the user if the container is runing a kata container or systemd container. This PR fixes to use the label specified by the user. Fixes: containers#11100 Signed-off-by: Daniel J Walsh <[email protected]>
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind feature
Description
I've been playing around with
podman
andudica
, and it seems that while it is possible to run most containers with custom policy modules (--security-opt label=type:my_policy.process
), it is not possible for containers runningsystemd
. This is because containers runningsystemd
are run with thecontainer_init_t
label, and it cannot be overwritten (to the best of my knowledge) with--security-opt label
.This is a limitation for those who'd like to run a
systemd
container with a custom SELinux policy. Some ideas:init_container.cil
template toudica
(this should be under the udica project).podman
allow a custom policy when runningsystemd
containers.Steps to reproduce the issue:
Run
podman run -d --name init_ctr --systemd always registry.access.redhat.com/ubi8/ubi-init
Use udica to generate a policy module:
podman inspect init_ctr | sudo udica test_policy
. The actual contents of the module are irrelevant.Load the policy module:
sudo semodule -i test_policy.cil /usr/share/udica/templates/base_container.cil
.Stop the container:
podman stop init_ctr && podman rm init_ctr
.Run the container with the new policy:
podman run -d --name init_ctr --systemd always --security-opt label=type:test_policy.process registry.access.redhat.com/ubi8/ubi-init
.Describe the results you received:
ps -efZ | grep init
shows that theinit
process runs with thecontainer_init_t
label.systemd
is running in the container.Describe the results you expected:
Expected the
test_policy.process
label withsystemd
running in the container.Additional information:
Running
podman
3.2.0 on Fedora 34 Workstation.The text was updated successfully, but these errors were encountered: