You are not logged in.

#1 2014-10-10 21:34:55

Xwang
Member
Registered: 2012-05-14
Posts: 377

How to disable network connections for an application

Hi to all,
I would like to know if there is any way a user can disable network connections for a specific application.
Thank you,
Xwang

Offline

#2 2014-10-11 03:09:37

exadrid
Member
From: Ottawa, Ontario, Canada
Registered: 2010-01-27
Posts: 29

Re: How to disable network connections for an application

Offline

#3 2014-10-11 05:27:58

Jwebb
Member
From: Sydney
Registered: 2014-10-11
Posts: 1
Website

Re: How to disable network connections for an application

Blocking port at a firewall is one way, probably the best one. Depending on the application, you can edit /etc/hosts file and replace domain1.com externalIPaddress with 127.0.0.1
This way your application will not be able to reach specific URL/s.


Computer Forensic Expert

“The truth is rarely pure and never simple.”
― Oscar Wilde

Offline

#4 2014-10-11 07:56:52

Xwang
Member
Registered: 2012-05-14
Posts: 377

Re: How to disable network connections for an application

Yes, but I would like to block only a specific application, not all the traffic from the PC.
I've found this "solution" which uses iptables on the net:

"Add a group to your system (I use nonet myself), then add a rule to your output chain like this: -A OUTPUT -m owner --gid-owner nonet -j REJECT --reject-with icmp-net-unreachable Run the program for which you know in advance that you want to block, with sg (sg nonet "your_prog your_args")."

Do you think is it right?

Another suggestion was to use unshare to call the program disabling the net for that program only.
The problem is that unshare is runnable only by root so, in case, I should turn on its setuid flag in order to execute the program as a normal user, but I don't know if it is safe to do that.

Last edited by Xwang (2014-10-11 08:06:16)

Offline

Board footer

Powered by FluxBB