This is an important thing you can do to monitor which some processes are trying to connect with, and there seems to be no convenient way to do this on Linux. However, some workarounds are possible, and so I think they are worth mentioning.
There is a program called nonet that allows you to run the program without Internet access (I have most of the software launchers in my system configured with it). It uses setguid to start the process in the nonet group and sets the iptables rule to refuse all connections from this group.
Update: now I use an even simpler system, you can easily have an readable iptables configuration with ferm and just use the sg program to run the program with a specific group. Iptables also offers you to redirect traffic so that you can even redirect it to a separate interface or local proxy server to a port that allows you to filter wirehark or LOG packets directly from iptables if you do not want to disconnect the entire Internet while you check the traffic .
Itβs not very difficult to adapt it to run the program in a group and cut out all other traffic using iptables for runtime, and then you can capture traffic only from this process.
If I ever start writing, I'll post a link here.
On the other hand, you can always start the process in a virtual machine and sniff the correct interface to isolate the connections it makes, but that would be a good solution ...
user1115652 Nov 19 '13 at 5:22 2013-11-19 05:22
source share