-
Notifications
You must be signed in to change notification settings - Fork 43
Description
Component
Agent
Description
Environment
OS: Fedora 42 (also affects RHEL/CentOS/Rocky Linux)
SELinux: Enforcing
Podman: Running as root with socket enabled
beszel-agent: 0.12.12
Issue
When running beszel-agent on a system with SELinux enforcing, the agent cannot access the Podman socket and fails with:
Containers err="Get \"http://localhost/containers/json\": dial unix /run/podman/podman.sock: connect: permission denied"
Root Cause
SELinux blocks the connection because the container runs in the container_t context, while the Podman socket requires container_runtime_t context. This is visible in audit logs:
sudo ausearch -m avc -ts recent | grep podman
# Shows: avc: denied { connectto } for comm="agent" path="/run/podman/podman.sock"
# scontext=system_u:system_r:container_t:s0 tcontext=system_u:system_r:container_runtime_t:s0
Solution
Explicitly define the selinux context by dding security_opt to the compose configuration:
beszel-agent:
image: henrygd/beszel-agent
container_name: beszel-agent
restart: always
network_mode: host
security_opt:
- label=type:container_runtime_t # Required for SELinux
volumes:
- /run/podman/podman.sock:/run/podman/podman.sock:ro
- ./beszel_agent_data:/var/lib/beszel-agent:Z
environment:
DOCKER_HOST: unix:///run/podman/podman.sock
Note: No :Z label for the podman.sock mount because we use security_opt explicitly.
Expected Behavior
This could be mentioned in the documentation. Also, for running podman as root, the socket path is /run/podman/podman.sock.
Steps to Reproduce
sudo systemctl start podman.socket (not persistent) or sudo systemctl enable --now podman.socket (persistent)
beszel-agent:
image: henrygd/beszel-agent
container_name: beszel-agent
restart: always
network_mode: host
volumes:
- /run/podman/podman.sock:/run/podman/podman.sock:ro,Z
- ./beszel_agent_data:/var/lib/beszel-agent:Z
environment:
DOCKER_HOST: unix:///run/podman/podman.sock
Category
Charts & Visualization
Affected Metrics
Containers
OS / Architecture
Fedora 42 (also affects RHEL/CentOS/Rocky Linux)
Beszel version
0.12.12
Installation method
Docker
Configuration
beszel-agent:
image: henrygd/beszel-agent
container_name: beszel-agent
restart: always
network_mode: host
security_opt:
- label=type:container_runtime_t # Required for SELinux
volumes:
- /run/podman/podman.sock:/run/podman/podman.sock:ro
- ./beszel_agent_data:/var/lib/beszel-agent:Z
environment:
DOCKER_HOST: unix:///run/podman/podman.sockHub Logs
Agent Logs
Containers err="Get \"http://localhost/containers/json\": dial unix /run/podman/podman.sock: connect: permission denied"