cap_net_raw rootless #21079
Replies: 5 comments 4 replies
-
I have the same question. But I am configuring several systems as root, for my users. Some users will need the cap_net_raw capability for their rootless containers. How can I configure the systems to extend their capabilities in rootless? |
Beta Was this translation helpful? Give feedback.
-
No CAP_NET_RAW is required on the process running podman, nothing in rootless containers allows you to get around this. The best you can do is run with sudo. |
Beta Was this translation helpful? Give feedback.
-
By the way, we have a demo in seitan where the supervisor (seitan) opens a socket on behalf of the target process (a process in the container) and replaces it in its file table atomically. You could change that demo to open a raw(7) socket (or AF_PACKET, depending on the application). It's entirely experimental and not production-ready, but I thought that somebody might feel like playing with it and contributing back. The related Podman demo uses OCI annotations to load the BPF filter and it's intended exactly for cases like that, where a rootless container needs just one specific privileged operation and you would like to avoid granting the whole runtime a capability (or run it as root). |
Beta Was this translation helpful? Give feedback.
-
I also bumped into needing this capability (DHCP packet sniffing for home assistant), and I don't see any obvious way forward, other than to switch to rootful containers. If anyone is aware of any movement on the topic, feel free to let me know. |
Beta Was this translation helpful? Give feedback.
-
And to be clear CAP_NET_RAW is network namespace aware, a rootless container can run things like tcpdump in its own privately created network namesapce. However you can never do that on the host network namesapce because that would mean you could snoop all traffic which logically cannot ever be allowed by the kernel for security reasons. This works:
While this will not work:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is there anyway to make this work containerized and capture a host interface? trying to setup a tcpdump container as we save some pcaps for certain traffic. tried various things (setting cap on podman itself, adding cap-add cap_net_raw), but always end up with operation not permitted for the interface
Beta Was this translation helpful? Give feedback.
All reactions