How can I restrict all internet access on Linux except for one specific app?

0
30
Asked By TechyGamer99 On

Hi everyone! I'm using Ubuntu 24.04 and I want to completely block internet access for all apps on my system except for one particular app, like Brave Browser (located at /opt/brave.com/brave/brave). I've tried setting up some iptables rules, but they didn't work to whitelist Brave as I expected. Can anyone help me with this?

5 Answers

Answered By SandboxWizard42 On

You could use Firejail to sandbox the applications. This tool allows you to restrict which apps can access the internet. You can whitelist Brave or even specify which domains it can connect to, but don’t forget you’ll need apt to have internet access for system updates.

Answered By AppMaster3000 On

One cool solution is to install all your apps through Flatpak and then use Flatseal to block internet access for all apps except Brave. This can be a straightforward way to manage internet access without too much hassle.

Answered By NetSavant88 On

Just block all inbound connections, and make sure only the necessary outbound ports (like 443) are open for Brave. Just know that blocking all access might lead to unexpected issues later, like DNS resolution problems or update failures.

Answered By FiredUpUser On

Another option is using fapolicyd, which allows granular control over which executables can run and access the network. It’s mainly available for Red Hat distros, but check if there’s a version for Ubuntu.

Answered By KernelNerd89 On

Keep in mind that iptables isn’t application-aware; it manages connections based on protocols, ports, and addresses, not specific applications. You might need to explore a tool that offers more granular control.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.