I'm developing a small tool to record some sensors in GNU/Linux. Some of the sensors transmit their data over UDP, so I'm using libtins to capture it.
I would like to control the sensors start/stop from a webapp, but listening to a network interface requires root privileges. I don't like the idea of hard-coding a sudo-password to run the sniffer every time a button is clicked and I would rather avoid running all my processes as root, but surely must be a proper way to give interface access permissions to a process so the sniffing can be started from, let's say, a python or bash script.
Can someone give me any hint?
CAP_NET_ADMIN
allows us to set an interface to promiscuous mode, andCAP_NET_RAW
permits raw access to an interface for capturing directly off the wire" (source). Unfortunately capabilities won't work if set to a script. But if you used a binary executable and granted the capabilities during installation once, then I guess this might work. – Kamil Maciorowski Apr 27 '20 at 09:22