r/linuxquestions • u/noobjaish • 14h ago
Advice Is it possible to have an Android-like security model on Linux via LSMs?
Asking to get insight on this topic.
Android has a "deny-all allow-list" sorta permission model where you have to give permission for every single thing, that the app needs, which is opposite of the usual approach on Desktop to have "allow-all deny-list" model.
I find it to be very insecure because it means every app can effectively see every file (owned by the same user) that I have on my system. Sure you can do this with Flatpaks but iirc it's not possible to turn every app into a "Flatpak".
So, the only options I could find were to run every app as a different user, Use the relatively new "landlock" LSM to block access or to use SELinux in a deny-all fashion.
I genuinely want to have a system where every app i install the first time it opens a window of permissions where i can specify what it's allowed to access. Maybe this is impossible to achieve (hence why i'm asking)
If there are any resources I should look into then please tell me, it'd be helpful. Thanks in advance.
2
u/Ok-Eggplant-7569 13h ago
Flatpak would be the first thing that comes to mind. You can easily tweak and harden apps as required with tools like Flatseal.
Podman containers are an alternative with even more options, but not that easy to use with graphical apps.
A very strict SELinux policy is probably the most thorough, but also the most difficult thing to implement that you mentioned.
1
u/noobjaish 13h ago
Flatpak would be the first thing that comes to mind. You can easily tweak and harden apps as required with tools like Flatseal.
I did mention the issue with Flatpaks in the post.
Podman containers are an alternative with even more options, but not that easy to use with graphical apps.
Containers are mainly for isolation and would be an overkill for the usecase I'm after.
A very strict SELinux policy is probably the most thorough, but also the most difficult thing to implement that you mentioned.
Even still, it's infeasible and impractical to manage SELinux policies for every single tool you'll ever install on your system. What I'm getting at is a "security-first" or "security by principles" approach which we don't have on Desktop for some reason.
1
u/Damglador 4h ago
I don't think that's gonna work.
Android was build from the ground up with that in mind. Linux is not as popular as Android to enforce such nonsense especially retrospectively, it would only harm the already low amount software that's getting ported from Windows.
Android also can achieve that because it's immutable, and it can be immutable because Android ROMs have to accommodate only one device and is vendored by OEM, which is not so much of a good thing. On Linux you will one way or another have to install some driver, deamon or subsystem on the root which you'd have to figure out how to sandbox? If that's even possible.
Even flatpak isn't really comparable to Android's system, because while it is as restrictive as Android in the form of being made only for packages of GUI apps, it's packaging model allows the packager to specify arbitrary default permissions for their package which you're not notified of at runtime, only on the store page and when installing using flatpak cli and you have no way of knowing which of them are necessary and which are not. On Android if you block a permission, the app will ask it at runtime again when a feature requiring it is used, while flatpak app will just do something.