Repository navigation
Rootless podman with SELinux #1824
Copy link
Copy link
Open
Labels
Description
OS Rocky Linux 9.5 (Blue Onyx)
podman-compose version 1.3.0
podman version 5.2.2
I managed to deploy Wazuh on a rootless podman setup with just little modifications. I would like to share it, also in hope that these modifications will be incorporated, as they shouldn't introduce a breaking change. With further testing, this could lead to official rootless podman support.
System setup
# as root
vi /etc/sysctl.conf
# add the follwing line
# vm.max_map_count=262144
reboot
# check if updated
sysctl -a |grep vm.max_map_count
# install new packages
dnf upgrade
dnf install podman python3-pip netavark aardvark-dns
vi /usr/share/containers/containers.conf # set network_backend = "netavark"
# The systemd user instance is killed after the last session for the user is closed.
# The systemd user instance can be started at boot and kept running even after the
# user logs out by enabling lingering using
loginctl enable-linger myuser# as regular user
pip3 install --user podman-compose
pip3 install --upgrade podman-compose pip
sudop mkdir -p /opt/wazuh
sudo chown -R myuser:mygroup /opt/wazuh
cd /opt/wazuh
# as root
restorecon -vv -F -r /Unprivileged Ports
sudo su -
# if needed to bind to ports < 1024, will be reset after reboot!
echo 443 > /proc/sys/net/ipv4/ip_unprivileged_port_start
# if needed permanently
echo "net.ipv4.ip_unprivileged_port_start=443" >> /etc/sysctl.conf
ulimit -aH
ulimit -aS
vi /etc/security/limits.conf
# Exit and re-login from the terminal for the change to take effect.#<domain> <type> <item> <value>
...
myuser hard memlock -1
myuser hard nofile 655360Firewall on VM
sudo su -
firewall-cmd --list-all
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
firewall-cmd --list-allInitial Deployment
podman-compose --in-pod=true up -d without file changes:
cp: cannot create regular file '/certificates/admin-key.pem': Permission denied
cp: cannot create regular file '/certificates/admin.pem': Permission denied
cp: cannot create regular file '/certificates/root-ca.key': Permission denied
cp: cannot create regular file '/certificates/root-ca.pem': Permission denied
...Modifications
add :z to generate-indexer-certs.yml bind mounts:
...
volumes:
- ./config/wazuh_indexer_ssl_certs/:/certificates/:z
- ./config/certs.yml:/config/certs.yml:zalso add :z to all bind mounts inside docker-compose.yml (for nginx bind mounts :ro,z)
Final Deployment
podman-compose --in-pod=true up -dEverything should come up as usual.
Reactions are currently unavailable
Activity
c-bordon commentedon May 20, 2025
Hello, thank you for your contribution. We will analyze what was proposed and try to incorporate the changes for our version 5.0.0.
leonidas-o commentedon May 20, 2025
@c-bordon no thank you! I submitted a PR: #1834
Wazuh manager in rootless podman seems to work so far.
FYI: I'm looking into the agent right now. The plan is to create a daemonSet for Openshifts restricted env. The idea is to have a rootless image based on rockylinux:9-ubi-micro. Will see how that works out, so far
SETGIDcap is causing some issues.DevDorrejo commentedon Oct 18, 2025
Hello, I have quadlet setup, it runs, but need some tunning with the host where is installed, because not finish run because /proc and /sys, right now I don't have time to continue until next week, but if you found the solution here is the script [rootless] (My system use selinux enforce):
@leonidas-o @c-bordon
leonidas-o commentedon Oct 19, 2025
don't know why you are building that bash script, I simply use a systemd service file and podman-compose to utilize the already existing docker-compose.yml files (either in multi-node or single-node dir):
luckylinux commentedon Feb 15, 2026
@leonidas-o: probably because just like I had to deal with
podman-compose, in some Situations and Configurations it turned out to be completely unreliable 😕. I was getting random Containers Crashes at Boot Time for one ...Anyways, after around 2 Days of messing around with Podman, I had to give up on using a Pod (which is my preferred Solution) because some People decided to use 2 different UID/GID within the multi Node Stack of Containers 👎:
999/ GID999:wazuh-master: USERwazuhwazuh-worker-01: USERwazuh1000/ GID1000:wazuh-indexer-01: USERwazuh-indexerwazuh-indexer-02: USERwazuh-indexerwazuh-indexer-03: USERwazuh-indexerwazuh-dashboard: USERwazuh-dashboardAs such, in a Pod Configuration, it's NOT possible to remap different UID in the Container to the same UID on the HOST (using either
UIDMaporUserNS=keep-id).Now I "took" each Container out of the Pod and switched to Bridge Networking instead, which has the additional Issue to require Systemd Socket Activation in Case you want to see the correct Remote (Source) IP Address and not just some random
10.x.y.zBridge Gateway Address.You can see a bit more about Systemd Socket Activation in Podman here:
Anyway, my Problem right now is that, even though the Permissions seem "kind of" OK, I have Containers trying to reach to
[::1]:9200for whatever weird Reason 😕.Furthermore on the Master for Instance there is in
/etc/filebeat/filebeat.yml:While my
wazuh-master.containerConfiguration contains this:On the other Hand
wazuh-dashboardshows this (repeated several Times):I cannot exclude that I initialized the entire Container Stack once with the wrong Settings for some Environment Variables. But given that
'/etc/filebeatis not bind-mounted from something on the Host, that also makes little sense 😕.For some Reason, the Dashboard is trying to reach Localhost.
Did I miss some Part of the Docker Multi Node Setup 😕 ?
EDIT 1: some Files have been deleted from the
mainBranch and the only way to find them is to manually select the4.14.3Tag:https://github.com/wazuh/wazuh-docker/blob/40c88305bc2454109ac1a4a6f89ddbda64bdad54/docs/ref/configuration/configuration-files.md
https://github.com/wazuh/wazuh-docker/blob/v4.14.3/multi-node/docker-compose.yml
EDIT 2: seems like all Environment Variables are ignored for the Indexer, I needed to mount a
/usr/share/wazuh-indexer/config/opensearch.ymlinto the Container to set the correct Node's NameAdd SELinux relabel labels for rootless Podman support
Add SELinux relabel labels for rootless Podman support
docs: address review feedback on rootless Podman guide
Add SELinux relabel labels for rootless Podman support
Add SELinux relabel labels for rootless Podman support