[Software] programs accessing internet only with permission firewall
[Software] programs accessing internet only with permission firewall
debian 11
ufw
ufw is installed and enabled. My perception is, any program installed, ufw
gives it permission to access the internet. I want that no program
accesses the internet without getting a permission. How is
that done? Is there a program having a graphical user interface, such
that you can grant or deny a given program access
to the internet?
Thank you.
ufw
ufw is installed and enabled. My perception is, any program installed, ufw
gives it permission to access the internet. I want that no program
accesses the internet without getting a permission. How is
that done? Is there a program having a graphical user interface, such
that you can grant or deny a given program access
to the internet?
Thank you.
- dilberts_left_nut
- Administrator
- Posts: 5474
- Joined: 2009-10-05 07:54
- Location: enzed
- Has thanked: 21 times
- Been thanked: 93 times
Re: [Software] programs accessing internet only with permission firewall
No.
AdrianTM wrote:There's no hacker in my grandma...
- Trihexagonal
- df -h | participant
- Posts: 210
- Joined: 2022-03-29 20:53
- Location: Land of the Dead
- Has thanked: 32 times
- Been thanked: 24 times
- Contact:
Re: [Software] programs accessing internet only with permission firewall
Stateful Packet Inspection, or SPI, is a firewall technology that monitors the state of active connections and uses this information to determine which network packets to allow through the firewall.hthi wrote: 2022-10-15 18:36 My perception is, any program installed, ufw gives it permission to access the internet.
Only network traffic that is in response to traffic initiated on your machine is allowed to pass through UFW.
You would have to block everything and make rules to allow outgoing traffic as it happened.hthi wrote: 2022-10-15 18:36 I want that no program accesses the internet without getting a permission. How is that done?
If you don't trust it not to phone home, get rid of it.
ZoneAlarm for Windows.hthi wrote: 2022-10-15 18:36 Is there a program having a graphical user interface, such that you can grant or deny a given program access to the internet?
Thank you.
But you're a Linux user and that's all hokum you're learning to shake off now.
In time you will grow to love your Robot Overlords. Worship me in their stead as their Herald that it may be well with thee in their benevolent electric eyes...and your personal data file.
-
- Posts: 487
- Joined: 2009-07-04 06:32
- Location: Home: Barrackpore and Mysore
- Has thanked: 6 times
Re: [Software] programs accessing internet only with permission firewall
I sincerely apologise, Trihexagonal and hthi, for seeking further elaboration.Trihexagonal wrote: 2022-11-20 16:57 ... You would have to block everything and make rules to allow outgoing traffic as it happened.
If you don't trust it not to phone home, get rid of it.
Please allow me to reframe the question a bit differently. Is it possible to disallow a particular program from accessing the internet connection that my system has access to, irrespective of whether the connection is active or inactive? So that any program, even if it has such algorithms to have data packets stored in queue and send them when it can access a connection over the internet, can't do so?
I believe that there is one called firejail, that could be used with a command line:
Code: Select all
firejail --net=none <program>
Then there is another more involved way: that of using iptables and creating a user-group without internet connection. Then programs could be added to this group to bar them from internet access. Usually server administrators are the competent ones to understand the method and its finer nuances.
Last edited by bkpsusmitaa on 2022-12-15 05:47, edited 1 time in total.
Freedom is impossible to conceive.
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home
-
- Posts: 932
- Joined: 2020-05-03 14:16
- Has thanked: 7 times
- Been thanked: 68 times
Re: [Software] programs accessing internet only with permission firewall
Not really - ip tables are only able to work with internet packets, and groups can only use application path/names, which can be spoofed (like changing the executable name) -> firejail is using kernel's seccomp and namespaces -> this is IMO the easiest solution.bkpsusmitaa wrote: 2022-12-12 09:23 Then there is another more involved way: that of using iptables and creating a user-group without internet connection. Then programs could be added to this group to bar them from internet access.
Regards
Bill Gates: "(...) In my case, I went to the garbage cans at the Computer Science Center and I fished out listings of their operating system."
The_full_story and Nothing_have_changed
The_full_story and Nothing_have_changed
-
- Global Moderator
- Posts: 3049
- Joined: 2017-09-17 07:12
- Has thanked: 5 times
- Been thanked: 133 times
Re: [Software] programs accessing internet only with permission firewall
Yes really. Check iptables' "owner" match.
Nonsense.
-
- Posts: 932
- Joined: 2020-05-03 14:16
- Has thanked: 7 times
- Been thanked: 68 times
Re: [Software] programs accessing internet only with permission firewall
Not really - applications can change their PID/GID, ( f.e using setpgid(2) ) especially that:
such "nonsense' is actually possible - by replacing content of executable file with some modified code.
Seccomp + namespaces configuration can simply block all the *forbidden* kernel calls and access to some defined resources, so it doesn't matter what credentials have been granted to the program (binary file)
Regards
Bill Gates: "(...) In my case, I went to the garbage cans at the Computer Science Center and I fished out listings of their operating system."
The_full_story and Nothing_have_changed
The_full_story and Nothing_have_changed
-
- Global Moderator
- Posts: 3049
- Joined: 2017-09-17 07:12
- Has thanked: 5 times
- Been thanked: 133 times
Re: [Software] programs accessing internet only with permission firewall
I suspect that we are not talking about the same thing. The iptables owner match uses effective user/group. setpgid(2) manages the process group which seem to be unrelated. An unprivileged process cannot change its effective user or group arbitrarily.LE_746F6D617A7A69 wrote: 2022-12-14 22:01 applications can change their PID/GID, ( f.e using setpgid(2) )
What does this have to do with effective user/group ?LE_746F6D617A7A69 wrote: 2022-12-14 22:01 such "nonsense' is actually possible - by replacing content of executable file with some modified code.
- kent_dorfman766
- Posts: 581
- Joined: 2022-12-16 06:34
- Location: socialist states of america
- Has thanked: 75 times
- Been thanked: 76 times
Re: [Software] programs accessing internet only with permission firewall
I won't say "google is your friend" becuase they clearly are not, but a simple web search yields the following that seems to be directly applicable.
http://linuxpoison.blogspot.com/2010/11 ... -user.html
http://linuxpoison.blogspot.com/2010/11 ... -user.html
-
- Posts: 932
- Joined: 2020-05-03 14:16
- Has thanked: 7 times
- Been thanked: 68 times
Re: [Software] programs accessing internet only with permission firewall
See setreuid(2) and setregid(2)
But You're right - only privileged process can do this.
Bill Gates: "(...) In my case, I went to the garbage cans at the Computer Science Center and I fished out listings of their operating system."
The_full_story and Nothing_have_changed
The_full_story and Nothing_have_changed
-
- Posts: 487
- Joined: 2009-07-04 06:32
- Location: Home: Barrackpore and Mysore
- Has thanked: 6 times
Re: [Software] programs accessing internet only with permission firewall
I have been reading your posts, you three. Initially, I thought I would request LE_746F6D617A7A69 and p.H to post an elaborate tutorial for us to set up iptables and allow specific programs access to the internet.
Also, how to add a particular program to a group that iptables allows? man is too cryptic for me to delve into.
However, perhaps kent_dorfman766's link might be helpful. I am not certain. I have an added query however: how to control the bandwidth given to each programs? Could this objective be accomplished?
I have posted your salient observations. I think it would be better if you work collaboratively to have an easy tutorial posted for us users.
Thanking you in anticipation, and best wishes.
---------------------------------------------------------------------------------
Also, how to add a particular program to a group that iptables allows? man is too cryptic for me to delve into.
However, perhaps kent_dorfman766's link might be helpful. I am not certain. I have an added query however: how to control the bandwidth given to each programs? Could this objective be accomplished?
I have posted your salient observations. I think it would be better if you work collaboratively to have an easy tutorial posted for us users.
Thanking you in anticipation, and best wishes.
---------------------------------------------------------------------------------
p.H wrote: 2022-12-16 13:48 ...
I suspect that we are not talking about the same thing. The iptables owner match uses effective user/group. setpgid(2) manages the process group which seem to be unrelated. An unprivileged process cannot change its effective user or group arbitrarily ...
Freedom is impossible to conceive.
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home
-
- Debian Developer
- Posts: 628
- Joined: 2022-07-12 14:10
- Has thanked: 2 times
- Been thanked: 128 times
Re: [Software] programs accessing internet only with permission firewall
The main problem here is that a "program" is not well defined in Debian. In Android, each app is running as a separate user in a sandbox. In this context it is meaningful to talk about limiting the ability of a program to access the internet. In Debian, a program can simply use another program to make requests to the Internet on its behalf. It is not clear where one program starts and another one begins (for example shell scripts all just call other programs).
To come up with a meaningful solution we'd first need to understand what is the reason for limiting internet access. Is this about running malicious programs and wanting to limit their possibility to access the Internet?
To come up with a meaningful solution we'd first need to understand what is the reason for limiting internet access. Is this about running malicious programs and wanting to limit their possibility to access the Internet?
- kent_dorfman766
- Posts: 581
- Joined: 2022-12-16 06:34
- Location: socialist states of america
- Has thanked: 75 times
- Been thanked: 76 times
Re: [Software] programs accessing internet only with permission firewall
linux kernel does provide network bandwidth shaping but confiuring such is extremely advanced and the documentation is nowhere near comprehensive. network interfaces can have bandwidth policies attached to them to do "data dribbling" or "data burst" control within alloted buckets. The command used is "tc".
-
- Posts: 487
- Joined: 2009-07-04 06:32
- Location: Home: Barrackpore and Mysore
- Has thanked: 6 times
Re: [Software] programs accessing internet only with permission firewall
Perhaps you'd meant "... where one program starts (sic, ends) and another one begins ...". Okay. Would hand over the issues to Linux systems software specialists to elaborate on this.lindi wrote: 2022-12-24 11:41 ⋯ "program" is not well defined in Debian. In Android, each app is running as a separate user in a sandbox. ⋯ limiting the ability of a program to access the internet. In Debian, a program can simply use another program to make requests to the Internet on its behalf. It is not clear where one program starts and another one begins (for example shell scripts all just call other programs).
Let's just widen the scope for users' control over how their extensions (computers and programs running there) are allowed to share his personal, private information and data with servers and other systems.lindi wrote: 2022-12-24 11:41 ⋯ we'd first need to understand what is the reason for limiting internet access. ⋯ running malicious programs ⋯ limit their ⋯ access ⋯ Internet?
opensnitch, portmaster. They don't appear to be from Debian Universe. So alternatives?craigevil wrote: 2022-12-24 14:30 ⋯ opensnitch ⋯ portmaster.
https://github.com/evilsocket/opensnitch/releases
https://github.com/safing/portmaster/
Raed the tc man page. Doesn't appear to offer program-wise controls individually. Please advise.kent_dorfman766 wrote: 2022-12-24 19:23 linux kernel ⋯ network bandwidth shaping ⋯ confiuring ⋯ extremely advanced ⋯ documentation ⋯ nowhere near comprehensive ⋯ network interfaces ⋯ bandwidth policies attached ⋯ "data dribbling" or "data burst" control ⋯ alloted buckets. ⋯ command used is "tc".
May this post be raed in conjunction with the post earlier on program-wise control of their internet access.
Freedom is impossible to conceive.
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home
-
- Debian Developer
- Posts: 628
- Joined: 2022-07-12 14:10
- Has thanked: 2 times
- Been thanked: 128 times
Re: [Software] programs accessing internet only with permission firewall
I don't think Debian offers a ready-made solution for this. If you know how to write programs it is possible to imagine various different ways how this can be implemented, but this solution would still not be part of Debian unless you'd also package it.
Have you considered simply creating a virtual machine that does not have access to the Internet and then just running the programs that shouldn't access the Internet inside that virtual machine?
Have you considered simply creating a virtual machine that does not have access to the Internet and then just running the programs that shouldn't access the Internet inside that virtual machine?
-
- Global Moderator
- Posts: 3049
- Joined: 2017-09-17 07:12
- Has thanked: 5 times
- Been thanked: 133 times
Re: [Software] programs accessing internet only with permission firewall
You do not need a virtual machine for this, it can be done with a container or a network namespace without any real network interface.
-
- Posts: 487
- Joined: 2009-07-04 06:32
- Location: Home: Barrackpore and Mysore
- Has thanked: 6 times
Re: [Software] programs accessing internet only with permission firewall
This is the issue which generally accompanies extraordinary gentlemen. What they say is too little for most of the rest.p.H wrote: 2023-01-05 22:31 You do not need a virtual machine for this, it can be done with a container or a network namespace without any real network interface.
Please, p.H,, please take up the responsibility to educate the lesser gifted.
Please begin by educating on what did you mean by "container" and "network namespace". How can real "network interface" be assigned?
Freedom is impossible to conceive.
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home
-
- Global Moderator
- Posts: 3243
- Joined: 2018-06-20 15:16
- Location: Colorado
- Has thanked: 69 times
- Been thanked: 287 times
Re: [Software] programs accessing internet only with permission firewall
Code: Select all
$ man ip-netns
The methods really don't compete, they are a resource question.
I prefer the full vm approach, and would flip it, give the vm's the internet, and keep it from the host.
Mottainai
-
- Posts: 487
- Joined: 2009-07-04 06:32
- Location: Home: Barrackpore and Mysore
- Has thanked: 6 times
Re: [Software] programs accessing internet only with permission firewall
Raed the containers link. From there to REST, or representational state transfer architectural style API.These remain abstract ideas unless implemented for personal experience. Like the DESCRIPTION section of the ip-netns. Abstract until individual aspects of it are explored personally. A detailed idea on network concepts and protocols is expected.
What is the scope for containers and REST APIs in Debian? How are these implemented? How are then the resources like internet access by individual programs controlled? Checked the packages in Debian (mine is the old verson): lxd, lxd-client and the python libraries to implement LXD-REST APIs.
So the next set of questions would be: Why full VM? Why not containers like LXD? What benefits do these provide if I am using a laptop and want to control the internet access for individual programs running there?
Freedom is impossible to conceive.
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home