Block internet access to a specific software

Hi!
I need to run a portable windows software that needs to run offline. Is there any way to block it's access to internet without unplug my pc?

That's a maybe, as far as I'm aware. It's possible you could use the firewall to block whatever outgoing ports that the software would use, and block them from going out to wherever they want to. However, if the software were to use your standard ports such as http/s (80/443), if you blocked those ports you'd just not be able to use the internet at all essentially.

But if it has special ports that it tries to use (I have no idea what this software is or does so I can't comment, but the manuals will usually have information on what ports it needs to function) you could block those outgoing with the firewall and that should work.

1 Like

(Mainly asking others) If a Windows software is run inside Wine/Bottles, is there no way to firewall that particular bottle?

You could, but it's a little more fiddly to set up. It basically involves creating a group that you then select your windows apps to run as, then deny that group any connection to the internet. More instructions can be found here:
block outgoing internet traffic in wine - WineHQ Forums
Personally I would rather avoid doing that and try to figure out specific ports if possible before doing that.

There is another option of using a different firewall that includes application specific control (there are a few, but I'm not comfortable enough with them to verify whether they're trustworthy or not). That's another third option to go through as well.

Gotcha! Thanks!

1 Like

you could run the software sandboxed in firejail , and restrict internet in firejail

sudo apt install firejail
firejail --net=none wine /path/to/your/software.exe
3 Likes

Thank you, I was just wondering when I saw this question: would it be possible in Firejail? I can't wait till the new year when I actually have time again, and can try out some of these things.

Holidays. Bah humbug hahah.

1 Like

Concur. Brave A.I. search engine delivered:

Block Windows App from Internet in Ubuntu

Since the portable Windows app is running on Ubuntu 22.04, we’ll employ a Linux-based solution to block its internet access. We’ll utilize firejail to sandbox the application and restrict its network connectivity.

Prerequisites:

  1. Install firejail on your Ubuntu 22.04 system:
sudo apt-get install firejail
  1. Ensure the portable Windows app is executable and located in a directory accessible by the Linux system.

Step-by-Step Instructions:

  1. Create a symbolic link to the portable Windows app executable, making it accessible by firejail:
sudo ln -s /path/to/portable/windows/app.exe /usr/local/bin/

Replace /path/to/portable/windows/app.exe with the actual path to the executable.

  1. Run the following command to launch the app within a firejail sandbox, restricting its network access:
sudo firejail --net=none /usr/local/bin/portable_windows_app.exe

This will start the app without internet access.

Explanation:

  • --net=none tells firejail to create a sandbox with no network interfaces, effectively blocking the app’s internet access.
  • /usr/local/bin/portable_windows_app.exe specifies the executable to run within the sandbox.

Additional Tips:

  • If you want to make this configuration persistent, create a systemd service file or modify your desktop environment’s autostart settings to run the firejail command with the app executable.
  • Be aware that some portable Windows apps might rely on internet connectivity for their functionality. Blocking internet access might break the app’s operation.

By using firejail and its --net=none option, you’ve successfully blocked the portable Windows app from accessing the internet on your Ubuntu 22.04 system.

3 Likes

Thank you so much guys!