Ubuntu Forums Archive Viewer

how to set an outbound firewall that prevents some applications to access to internet

Archived thread 695673 from Security Discussions. Markdown source: Security_Discussions/thread_695673_how_to_set_an_outbound_firewall_that_prevents_some.md

Original URL About this archive
#1

hi I'm using Ubuntu 7.10, and I've already installed firestarter. But is there a software firewall that can limit outbound connections so that only the applications I want can access to the internet (for example only firefox or xmms and not all other applications that are installed)?

#2

This might be possible through iptables, though I am not certain. Here is a tutorial.

#3

It looks like you can match outgoing packets based on their owner. I found this in the same tutorial mentioned above.

I use Shorewall, which isn't all that much easier than controlling iptables directly, but I still don't know exactly how to implement what you're asking for.

#4

Hi,

IPtables is installed by default.

Set your default polict to drop on all chains, then explicitly ACCEPT inbound, outgoing connections, also don't forget to allow connections to the loopback interface.

example rules:

iptables -A OUTPUT -o eth0 \ -s $INT-IP --sports $UNPRIV_PORTS \ -m state ESTABLISHED,RELATED -j ACCEPT

iptables -A INPUT -i eth0 \ -d $INT-IP \ -m state ESTABLISHED,RELATED -j ACCEPT

iptables -A OUTPUT -o eth0 -p tcp \ -s $INT-IP --sports $UNPRIV_PORTS \ -m multiport --dports 80,443 \ -m state --state NEW -j ACCEPT

Regards,

k_grdn

#5

What you want to do can partially be done by tcpwrappers, but is best done with squid-cache.

Cheers,

Herman