prevent an app to connect to a website

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
ckonn
Level 3
Level 3
Posts: 127
Joined: Wed Oct 01, 2014 7:03 pm

prevent an app to connect to a website

Post by ckonn »

hello,

would like to know how can one force an application/s not to connect to its website in internet?

there are such apps, which by default are checking does the pc is connected to the net and if they detect an
internet-connection they automatically connect to their own website.

do not mean 'client-server-architecture' apps, which work only if there is internet connection available,
but apps that can work without internet-connection.

almost sure that this can be done with some short bash script in .bashrc, but what?

thanks in advance!
Last edited by ckonn on Fri Jul 19, 2019 9:24 am, edited 2 times in total.
User avatar
Flemur
Level 19
Level 19
Posts: 9050
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: prevent an app to connect to a website

Post by Flemur »

ckonn wrote:
Sun Aug 05, 2018 1:35 pm
i do not mean client - server architecture apps, which work only if there is internet connection available,
but apps that can work without internet-connection.
It's possible, but much more convoluted than it should be; rather than a simple "internet-block program-name" you make a new group and run a program under that group:

"How to block internet access to certain programs on Linux"
https://serverfault.com/questions/55027 ... s-on-linux
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
User avatar
phd21
Level 19
Level 19
Posts: 9932
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: prevent an app to connect to a website

Post by phd21 »

HI ckonn,

Can you be more specific as to which application(s) you are refering to?

1.) If the application has any update or internet accessing options in their setup, preferences, configurations, turn those off.

2.) I think anyone can use the wonderful "Firejail" sandboxing application to block appplications from accessing the Internet by "black listing" it in the "firejail" configuration file.

How to block a program from accessing the Internet
viewtopic.php?t=216063

Douane is a firewall that filter and limit the outgoing network traffic per application.
https://gitlab.com/douaneapp/Douane

Use the firewall - How to control internet access for each program?
https://askubuntu.com/questions/45072/h ... ch-program

Google search results...
https://www.google.com/search?client=fi ... 29&bih=687

Hope this helps ...
Phd21: Mint 20 and 19.2 Cinnamon & xKDE (Mint Xfce + Kubuntu KDE) & KDE Neon 64-bit (new based on Ubuntu 20.04) Awesome OS's, Dell Inspiron I5 7000 (7573) 2 in 1 touch screen, Dell OptiPlex 780 Core2Duo E8400 3GHz,4gb Ram, Intel 4 Graphics.
ckonn
Level 3
Level 3
Posts: 127
Joined: Wed Oct 01, 2014 7:03 pm

Re: prevent an app to connect to a website

Post by ckonn »

it seems like the simplest way to prevent an app to connect to internet is to close the port/s it use.

in my case i was dealing with a specific plugin additionally installed on a specific app. this specific plugin was opening
a specific port and listening on it.

by the command 'lsof -i' i saw what exactly port that plugin was opening to listen.
then i just type in the terminal 'ufw deny <port_number>'
and since then the plugin does not listen at this port.

for many forum users all this may sound like the oldest news in the world, but for others it may be helpful.
Last edited by ckonn on Sun Aug 12, 2018 6:13 am, edited 1 time in total.
User avatar
catweazel
Level 19
Level 19
Posts: 9883
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: prevent an app to connect to a website

Post by catweazel »

ckonn wrote:
Sun Aug 05, 2018 1:35 pm
there are such apps, which by default are checking does the pc is connected to the net and if they detect an
internet-connection they automatically connect to their own website.
There are several ways. One is to make use of the hosts file so that the site is inaccessible to every application. Another is to run gufw and set up specific rules.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
User avatar
Pjotr
Level 22
Level 22
Posts: 16193
Joined: Mon Mar 07, 2011 10:18 am
Location: The Netherlands (Holland)
Contact:

Re: prevent an app to connect to a website

Post by Pjotr »

phd21 wrote:
Sun Aug 05, 2018 1:50 pm
2.) I think anyone can use the wonderful "Firejail" sandboxing application to block applications from accessing the Internet
Excellent tip! Easy and effective. :)

This is the easiest way to achieve that with Firejail:
https://sites.google.com/site/easylinux ... plications
(item 11, right column)
Tip: 10 things to do after installing Linux Mint 20.1 Ulyssa
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
Post Reply

Return to “Software & Applications”