Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Iptables to block on application level
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
satanskin
Guru
Guru


Joined: 25 Apr 2005
Posts: 353

PostPosted: Tue Jan 03, 2006 11:43 pm    Post subject: Iptables to block on application level Reply with quote

Could someone help me or tell me how to write an iptable rule to block an entire application from using the net? For example, if i were to want to block firefox completely from using the net at all (including local network as well) how could I do that? Please don't tell me to just block port 80 or any other ports. I'm trying to block on the application level. Thank you.
Back to top
View user's profile Send private message
kamikaze04
Guru
Guru


Joined: 28 Mar 2004
Posts: 366
Location: Valencia-Spain

PostPosted: Wed Jan 04, 2006 12:23 am    Post subject: Reply with quote

You should have looked at google with "iptables block application" you would have found it in the first page for sure...

What you are looking for is using "iptables/netfilter"

Have fun
_________________
Todo lo que quisiste saber sobre google en: www.noticiasgoogle.es
Back to top
View user's profile Send private message
desultory
Bodhisattva
Bodhisattva


Joined: 04 Nov 2005
Posts: 9410

PostPosted: Wed Jan 04, 2006 1:08 am    Post subject: Reply with quote

Like this:
Code:
iptables -I OUTPUT -m owner --cmd-owner firefox -j DROP


Note that according to the man page this is broken on SMP.
Back to top
View user's profile Send private message
satanskin
Guru
Guru


Joined: 25 Apr 2005
Posts: 353

PostPosted: Wed Jan 04, 2006 4:46 am    Post subject: Reply with quote

now does the owner have to be specific name? I mean, how exactly would i find the "owner" name to use. For example, how do i know to use firefox, or mozilla, or mozilla-firefox, or deer park, etc.? Is there a way to find what comes across as the owner string?
Back to top
View user's profile Send private message
slycordinator
Advocate
Advocate


Joined: 31 Jan 2004
Posts: 3065
Location: Korea

PostPosted: Wed Jan 04, 2006 4:53 am    Post subject: Reply with quote

satanskin wrote:
now does the owner have to be specific name? I mean, how exactly would i find the "owner" name to use. For example, how do i know to use firefox, or mozilla, or mozilla-firefox, or deer park, etc.? Is there a way to find what comes across as the owner string?


A quick google search indicates it's the actual program name as in the name of the executable being run.

Like "deer park" would NOT be a correct one because even when you have "deer park" installed you don't have an executable named that.
Back to top
View user's profile Send private message
satanskin
Guru
Guru


Joined: 25 Apr 2005
Posts: 353

PostPosted: Wed Jan 04, 2006 6:02 am    Post subject: Reply with quote

desultory wrote:
Like this:
Code:
iptables -I OUTPUT -m owner --cmd-owner firefox -j DROP


Note that according to the man page this is broken on SMP.


That command gives me the following in return:
Code:
thor satanskin # iptables -I OUTPUT -m owner --cmd-owner firefox -j LOG
iptables: Invalid argument

thor satanskin # iptables -I OUTPUT -m owner --cmd-owner firefox -j DROP
iptables: Invalid argument


And I can't find anything on google so far about iptables and --cmd-owner
Back to top
View user's profile Send private message
slycordinator
Advocate
Advocate


Joined: 31 Jan 2004
Posts: 3065
Location: Korea

PostPosted: Wed Jan 04, 2006 6:39 am    Post subject: Reply with quote

http://www.google.com/search?sourceid=mozclient&ie=utf-8&oe=utf-8&q=iptables+%22--cmd-owner%22
Back to top
View user's profile Send private message
desultory
Bodhisattva
Bodhisattva


Joined: 04 Nov 2005
Posts: 9410

PostPosted: Wed Jan 04, 2006 4:32 pm    Post subject: Reply with quote

It looks as though your kernel lacks owner match support, install one that includes it.

The option to enable in your kernel configuration is located under 'Networking --->' -> 'Networking Options --->' -> 'Network packet filtering (replaces ipchains)' -> 'IP: Netfilter Configuration' as 'Owner match support'.
Back to top
View user's profile Send private message
satanskin
Guru
Guru


Joined: 25 Apr 2005
Posts: 353

PostPosted: Wed Jan 04, 2006 8:53 pm    Post subject: Reply with quote

desultory wrote:
It looks as though your kernel lacks owner match support, install one that includes it.

The option to enable in your kernel configuration is located under 'Networking --->' -> 'Networking Options --->' -> 'Network packet filtering (replaces ipchains)' -> 'IP: Netfilter Configuration' as 'Owner match support'.


It's builtin already.

EDIT: I'm pretty sure it is the --cmd-owner part that it is screwing up on.
Back to top
View user's profile Send private message
jamapii
l33t
l33t


Joined: 16 Sep 2004
Posts: 637

PostPosted: Wed Jan 04, 2006 11:49 pm    Post subject: Reply with quote

mani001 had a good idea, but it didn't seem to work, anyway...

https://forums.gentoo.org/viewtopic-t-417517-highlight-.html
Back to top
View user's profile Send private message
satanskin
Guru
Guru


Joined: 25 Apr 2005
Posts: 353

PostPosted: Thu Jan 05, 2006 4:46 am    Post subject: Reply with quote

alright, i'm an idiot and I should have checked this earlier. But checking /var/log/messages shows this when trying to run that command:
Code:
Jan  4 22:44:05 thor ipt_owner: pid, sid and command matching not supported anymore   


So what's one suppose to do now!? This is a step in the wrong direction guys!
Back to top
View user's profile Send private message
desultory
Bodhisattva
Bodhisattva


Joined: 04 Nov 2005
Posts: 9410

PostPosted: Thu Jan 05, 2006 6:11 pm    Post subject: Reply with quote

Take another step in the wrong direction: downgrade to a supporting kernel, or port the old support into a new kernel (just avoid using that kernel with SMP).
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum