Ubuntu – block internet access to all applications except chosen few

firewallinternetlinuxUbuntu

I have been looking for a way to block all my applications from accessing the internet except for 1 or 2 chosen applications.

I looked into Uncomplicated Firewall (ufw) and its respective Gui (gufw):

enter image description here

but gufw doesn't seem to have the option to block specific programs from accessing the internet (which windows firewall does with outbound rules).

QUESTION: Does anyone know how I might be able to get that done?

Best Answer

gufw and other default-shipped firewalls aren't designed to filter by application - gufw is an uncomplicated GUI frontend to ufw, and isn't designed to filter on the application level, it's simply an uncomplicated front-end for setting up basic filtering rules based on IP, port, etc.

What you're looking for goes beyond the standard firewall-in-linux rulesets which ufw and gufw can accomodate. There are several suggested methods (the linked one is group-based controls, so you have to add applications you want to access the 'net to a specific group), but there's also other applications such as Douane, which may do this at the application layer as well.

Related Question