The problem going down that route is that implementing this opens a huge can of worms. That stuff is easy to spoof, you have to account for thousands of edge cases. It's not for nothing that the answer to "can I know the full path of the binary that was used to spawn <process>?" is generally "it depends" or "it's complicated". And let's not even bring up what happens for interpreters for instance. Parameters are also often easy to spoof and manipulate, although in this case I suppose the kernel could just keep a protected copy of the original parameters for that purpose.
I completely get why you want that though, and it would be a great feature to have indeed, but I also completely understand why kernel devs don't want to touch that with a ten foot pole.
This is such a killer app it's hard to believe that only recently a linux variation has been developed...
https://github.com/gustavo-iniguez-goya/opensnitch (the original by evilsocket seems to have been abandoned).
Back in the Android 5 (or so) days, I knew what permissions an app I was going to install on my mother's phone was going to ask to be granted _once_, and be done with it. Nowadays, an app might ask for some kind of new permission "on first use", and users on mobile are developing the same habit as users of desktop browsers during the dark ages of expired HTTPS certificates and broken Java Applet signatures had developed out of necessity: "default-ack/OK all the things".
The problem is that these days, even very technical people think that you could realistically expect to lie with dogs, and get up without fleas - i.e., install applications and software you cannot trust, and get away without having something bad (like loss of privacy, or maybe exfiltration of data) happen. All thanks to "modern" security constructs like sandboxing.
But that is not going to happen - sandboxes have been shattered and broken in the past, as they will continue to get circumvented in the future. There simply is no replacement for trust (in an application, its developers, its distributor, and its operator (if any)), and there are no technical solutions that could somehow replace it in full.
Yes, you can make it incrementally less bad to have a hostile agent/app on your machine or phone, but the trouble you're trying to prevent that way will never go away completely.
I guess some people just liked to feel "in control" when clicking away their "Norton Professional Antivirus 95 blocked 17 Viruses from damaging your machine today!" messages back in the day, and some apparently cherish clicking "grant 'Sexy FileManager Free Pro' access to your Photos and Videos" today. Personally, I'm actually rather sick of it, and all the security theatre that "modern" application delivery mechanisms like app stores/mobile platforms or stuff like snaps/appimage/younameit would have you participate in. I'd rather trust my distro's package maintainers to not let developers abuse their users, and have a look at the source if I'm in doubt about the upstream's intentions. I know I can't audit everything, but I feel like I'm much better off with that kind of trade-off, than with the non-solution to the problem I tried to describe above.
Edit: Removed a leftover part of a restructured sentence.
Wanna see a real permission model, look at the BB10 Android Player model. After installation, you could revoke permissions and the player would basically act as if the data from that permission was just empty. App asks for contacts, here's an empty contacts list.
Edit: I just did a small hackathon and ended up having to request full BLUETOOTH Access and LOCATION access to connect to a label printer... how is this long term sustainable.
This is just Android being transparent. "Bluetooth usage may allow apps to track your location." Which is perfectly true.
There has to be a balance between explaining to the user, e.g. that there are multiple ways their location can be tracked, and permission request overload.
I don't imagine explaining to everyday users the details of the Bluetooth protocol is viable.
Trusting 3rd parties to decide what you can trust isn't ideal either. It's what Google and (especially) Apple have for mobile apps now. They decide what you can safely install and we're just supposed to trust them. That's clearly not working.
While you have the added benefit of being able to trawl over thousands of lines of code looking for something suspicious, that's not exactly scalable or even possible for the majority of users. In the end, what exactly are you looking for anyway if not signs that an application is making connections or accessing files that it shouldn't. In that respect, it's far better to have the OS just tell users when an application is doing those things (connecting to the internet, reading their personal files, or activating their cameras). The more transparency in what an app is doing the better because the reality is that we cannot trust every app we install. How could we possibly?
Are you sure you didn't mean "EPOC" pain? Maybe "EPOC32" pain?
;-)
- a Psion owner
Since then, dreamed of some comparable device, basic linux, enough for vi and terminal stuff, wifi/bluetooth and well, happy with the screen. Alas all devoplment of anything close, tend to wack in CPU's that would be classed as a supercomputer of the 5MX time, power hogging colour screens and you end up with devices that will last a day perhaps, but not the month the 5mx would pull with comparable usage with the rs232 adapter.
Hence a cheap terminal, basic local editor wifi device in that form factor and if it could do bluetooth and double as a keyboard for a smartphone, well, a simple device like that would tick my boxes and maybe many others.
It should. Kexts are still allowed, for now. They're almost certainly only a couple of releases away from being deprecated though.
"We expect the deprecation to become effective with the next major release of macOS. There’s no official release date from Apple, but based on the release schedule of recent years it will not be before this fall. Little Snitch 4 will then not be loaded by the operating system, but there will still be an option to allow the loading."
Little Snitch 5 (with NKE) requires a new license.
There is reasonable pricing for upgrades... LS4 bought within a certain time get a free upgrade, older licenses get a reduced price.
You can do that sort of thing with eBPF these days, either at the network level or via process tracing. It's non-trivial still, though. Lots of the various firwewall automation tools have features like this too. It's definitely a solved problem, but not one with a really clean obvious solution yet.
- how do you recognize which applications the packets belongs to? Even if you would get pid in the rules engine (which you normally don't), how do you name it? /proc/$pid/cmdline can be manipulated at will by the process; then you need to recognize additional parameters when you are using applications that run other code, from bash to virtualbox.
- what happens to the connection while the firewall is waiting for the user input in the UI? Linux apps handle long timeouts badly
- what happens to other connections while the firewall is waiting for the user input in the UI? Right now, unfortunately, whey would have to wait too.
- LittleSnitch does interesting heuristic wrt hostname/ip translation - you can get different (or no) hostname via reverse query than the application asked for. You need to monitor what each application is resolving and what answers it get. If you get same IPs for different hostnames for a single application, all bets are off, only application knows which one it connects to (you can eventually learn with DPI, but for that it might be too late). For applications with their own resolvers using DoH/DoT, tough luck.
The first problem could be solved at the level of sandbox runtimes (i.e. flatpak et al), i.e. when you know, that the application is running in the namespace belonging to specific flatpak package, you would present that as that specific application, they cannot lie about that anymore but the price is, that you can handle only sandboxed apps; for scripting and so on you still have to find how to distinguish specific instances. For all the other problems, you would have to figure them out.
iTerm actually ran into this very issue (using the equivalent macOS APIs) and had to treat it as a security bug because the results were controllable in-process as well. And it also ran into the problem of how to deal with interpreters. It basically ended up being all ripped out and the API was redesigned to require authentication tokens rather than trying to figure out a meaningful source for a process.
ETA: and most Linux apps will just sit there blocking in the syscall, or at the very worst, retry/show an error/crash.
You need to implement at least some functionality on the kernel level (what LitleSnitch does with a kernel extension) for this, most of the people who care about desktop apps on Linux (me included) lack kernel developer skills.
[1] works pretty well for me.
[0] https://github.com/nathants/tinysnitch [1] https://github.com/gustavo-iniguez-goya/opensnitch [2] https://github.com/Douane/Douane/
Of course, the naive implementation—giving the app itself control over the system's settings for it—would be a disaster. (I think early iOS had something like that, but quickly got rid of it—right around the time the App Store stopped being so heavily curated.)
I'm suggesting something more like: if you pull up iOS Control Center while an app is open, it'd have either an "app settings" submenu, or merge "app settings" into the view of system settings. Then, within "app settings", you'd have a little privacy-lock, sort of like the one that appears in a browser's address bar—and which would allow you to change very similar things to what clicking said lock allows you to change in a browser: in est, the states of all the system confirmation prompts the app has triggered.
Less on-topic, but contextually-accessible app settings would also allow you to do neat things like provide the ability to set accessibility settings on a per-app basis in an intuitive way, or to start something like Guided Access Mode (https://support.apple.com/en-ca/HT202612) without needing to enable+remember an arcane gesture. I would especially love the idea of being able to change the perceived system font-size/scaling-factor, or the perceived system language/region, on a per-app basis — basically equivalent to Safari's display settings "A" menu. Maybe even a switch to enable that "monochrome to reduce addictiveness" mode, so you can have it on only within social media apps!
Isn't this exactly how Android does it? I long press the app icon, click app info. All permissions, data usage, battery usage, storage usage options and metrics are shown for the app.
Feels so intuitive. Turns the control center into the top bar from macOS or the file/edit/settings bar that many windows apps have. That's so darn obviously the right way to do it!!!!
iptables can filter based on the uid ( -m owner --uid-owner {USERNAME}) then, you have to to create a dummy user and launch your executable as that user (su, runuser, ...)
Every OS should do this, desktop OSes included. For the last 2 decades I've been using personal firewalls on Windows to do just this, now I use LittleSnitch on Mac (I just hope it's going to keep working on ARM macs), AFWall+ and XPrivacy on Android and miss this level of control terribly on Linux (it sort of can be achieved with AppArmor or SELinux but both are nightmares to use).
If only iptables would allow to filter by the executable path and other process parameters - that would be just so awesome. There was such a feature in some 2.x kernel but, sadly, it was deprecated long ago.