-
Notifications
You must be signed in to change notification settings - Fork 165
Description
Hi. I'm trying to run a Podman container on Debian 13 with SELinux that needs access to the podman socket. By default this access is blocked by SELinux on debian when running in the container_t domain. I would like to create a custom domain for this container to allow it access.
I'm trying to use Udica with the refpolicy templates added here. This results in the cil file below:
(block socket-proxy
(blockinherit container)
(allow process process ( capability ( chown dac_override fowner fsetid kill net_bind_service setfcap setgid setpcap setuid sys_chroot )))
(allow process user_tmp_t ( dir ( getattr ioctl lock open read search )))
(allow process user_tmp_t ( file ( getattr ioctl lock open read )))
(allow process user_tmp_t ( fifo_file ( getattr open read lock ioctl )))
(allow process user_tmp_t ( sock_file ( getattr open read )))
(allow process sysfs_t ( file ( open read )))
(allow process urandom_device_t ( chr_file ( open read )))
(allow process sysfs_t ( lnk_file ( read )))
(allow process node_t ( tcp_socket ( node_bind )))
(allow process socket-proxy.process ( udp_socket ( create connect )))
(allow process unreserved_port_t ( tcp_socket ( name_bind )))
(allow process socket-proxy.process ( process ( setrlimit )))
(allow process user_tmp_t ( sock_file ( write )))
(allow process unconfined_t ( unix_stream_socket ( connectto )))
(allow process unconfined_t ( fifo_file ( write ioctl )))
(allow process socket-proxy.process ( tcp_socket ( create getopt setopt bind getattr listen accept read write shutdown )))
)
Running the container with this profile however does not resolve the denial:
type=AVC msg=audit(1754898743.082:141): avc: denied { connectto } for pid=1336 comm="haproxy" path="/run/user/1000/podman/podman.sock" scontext=system_u:system_r:socket-proxy.process:s0:c398,c705 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tclass=unix_stream_socket permissive=0
Am I missing a configuration setting? The Debian setup is stock. The module builds and installs without errors but gives a libsemanage.add_user: user sddm not in password file message. I have labels=true set in ~/.config/containers.containers.conf and I'm running the container rootless using the Podman quadlet syntax with SecurityLabelType=socket-proxy.process.
Thank you.