5 ms·
Can someone explain the use case for this? If you control the system, you can use SELinux etc to control the same things. In what cases are you running an app o
by 0xbadcafebee 5y ago
Can someone explain the use case for this? If you control the system, you can use SELinux etc to control the same things. In what cases are you running an app on a system, and you don't control the system, and you don't want a user to access parts of the system? If it's about preventing system compromise, it's better to secure the whole system than one application...
- boustrophedon 5y agoI believe the usecase is similar to BSD's pledge. See https://man.openbsd.org/pledge.2 https://man.openbsd.org/pledge.2 It allows you to drop privileges so that in the event there is a vulnerability in your application, it cannot be exploited to cause further damage outside the scope of the application's normal operations.
- wahern 5y agoNot pledge, but unveil: https://man.openbsd.org/unveil.2 https://man.openbsd.org/unveil.2 AFAICT, landlock even uses the same underlying technique in the VFS layer.
- comex 5y agoI think the point is that applications can sandbox (parts of) themselves in a way that works across distros and doesn’t require a specific system configuration. Think of BSD pledge(), or browser sandboxes. (Browser sandboxes currently use seccomp on Linux. seccomp is good for when you want to disallow almost all syscalls, which browser sandboxes can do due to their highly elaborate design, including routing all file and network access through another process. It’s not so good for when you would like to keep interacting with the kernel directly but just want to limit accessible file paths.)
- 0xbadcafebee 5y agoI guess what I'm wondering is, are there cases where there's no other option except a sandbox? I get that you basically are shipping apps to random computers that aren't secure, so this is sort of a big band-aid for apps that can't tightly control for how their apps are used. But in terms of merging something into the kernel, wouldn't the kernel devs prefer to improve adoption of least-privilege/MAC LSMs?
- catern 5y agoSELinux is pretty inflexible and incompatible with multi-user systems that deploy stuff without privileges - it assumes you can have global policy that applies to everything, which doesn't work well with containers, or browsers, or even just running things out of your home directory. Hence, kernel devs would like to increase adoption of something that's a little better designed - not SELinux.
- totony 5y ago>SELinux is pretty inflexible and incompatible with multi-user systems that deploy stuff without privileges IMO that's not true -- Android has done a pretty good job at it.
- deleted 5y ago[deleted]
- gizmo686 5y agoThis is the first I am hearing about Landlock, but a major part of my job is writing SELinux policy. First, it should be possible to use both this and SELinux as they are stackable. The main benefit I see to Landlock over SELinux I see is that it is far more dynamic. With SELinux, you need to know what accesses a program will make when you write the policy. Since Landlock creates the rules at runtime, it can be used in cases where you do not know exactly what it needs to do ahead of time. Obviously, this can also be thought of as a drawback instead of a benefit. For a toy usecase, consider a hex editor. You want to be able to open and edit any file on the system; however you are concerned that a maliciously crafted could compromise the editor. With Landlock, you can let the user select the file they want to use, then dynamically restrict your permissions before you actually open the file. With SELinux, you would need to give the editor access to the entire system because you do not know ahead of time which file the user will want to access. Granted, this toy example is simple enough that I could come up with a workable SELinux solution if I had to, but sometimes the application actually knows best what it needs to do.
- e12e 5y agoI think this and sibling captures the difference quite well. For your hex editor, you could replace it with an image converter service - each image conversion need to open a source file for reading and a destination file for writing. You could limit the converters access to not read /etc/shadow various static ways. But assuming uploads/malicious.jpg blows up, it's tricky to statically say: deny access to uploads/other_user_medical_bill.jpg. So the example isn't all that contrived. Run time dropping of privileges is very useful (and common for network daemons etc for a long time - like apache binding port 80, maybe opening log files, then dropping from root to nobody/www data). But being able to say that "after this point I should never have to open a file" and having that pledge enforced - is really nice. This is a tool for good programs to behave in the face of bugs, while static measures are a way to enforce access on potentially bad programs.
- josephg 5y agoI don’t know if landlock does this, but what I want is safe application sandboxing. I have zoom installed on my Linux machine. I don’t trust the zoom developers, and zoom only really needs a few permissions. Right now there’s nothing stopping zoom from recording key presses, or uploading my sensitive files to their servers. I wouldn’t even notice. With stuff like this, ideally zoom would have limited access to other areas of my computer so it just wouldn’t be able to do anything nasty without my consent or knowledge. I always find it weird - linux’s security model obsesses about user accounts and user security. I don’t care about that - I’m the only user! But on the flip side there’s very little effort put in to application / developer specific access control. All applications I run can read, exfiltrate or ransomware all my stuff. That seems reckless and dangerous. I’m a huge fan of efforts like this - security is never sexy, but it’s extremely important. Let’s make Linux as secure for end users as iOS.
- zvrba 5y agoFor the one occasion I had to use Zoom, I created a separate user account and after the meeting was done, I wiped the account.
- c0l0 5y agoThis right here. For programs that do not require access to an X11 display, you could also work around the problem of not really trusting the code to not do anything that isn't in your best interest by using `sudo` (or `su` or `setpriv` or ...) to change to an unprivileged account. Or by having the (non-script) executable file have the SUID bit set, and owned by an unprivileged account on the system.
- yaantc 5y agoYou can run zoom, and skype for that matter, using firejail [1]. There can be glitches now and then, in my cases only with skype IIRC, but it's rare and usually quickly fixed (just update your local configuration from upstream). [1] https://firejail.wordpress.com/ https://firejail.wordpress.com/
- viraptor 5y agoIt doesn't replace SELinux, but it's similar. There are cases where app-controlled sandbox is easier to implement than selinux rules though. I'd summarise those as: app jails are for things apps know about themselves, selinux/apparmor are for things you know about the environment the app runs in. (not sure if these are possible with landlock) Example 1: You start `tar` to unpack something to /foo/bar. Ideally you'd tell tar that whatever happens, it cannot write outside of /foo/bar. This is not possible to implement at runtime with selinux, without relabeling the filesystem. Example 2: You start an app which will open a socket and then never open another connection again (just accept). You could do it with selinux or apparmor by changing context/hat, but you'd have to actually rely on one of them being enabled and setup with appropriate rules. Instead with things like seccomp and other app jails you can say "from now on, deny any listen/connect syscalls".
- rocqua 5y agoSELinux is for users who have a software package, and want to restrict that software package. Systems like Landlock are meant for developers who want to voluntarily drop what their software can do. So SELinux is meant to say "I am going to run this program, and I want to limit it to these things. Landlock / pledge / unveil are meant to say "I am writing this software, and I want my software to never be able to do X". This way developers can reduce the impact of any vulnerabilities in their own software. It is defense in depth on the development side. SELinux can be used if you don't trust a piece of software. But it is generally applied by people who do not know about the internals of the software. In some sense it is treating the software as a black-box, and limiting what the black-box can do. Landlock / pledge / unveil are implemented by the developer. If you don't trust the developer's intent, then these are not going to help. However, this is a great way for developers with good intentions to limit the impact of any mistakes they made. Notably, since this system is implemented by the developers, the implementers generally have deep knowledge of how their software works. They can consider the internals of their own software. I expect that, on balance, systems like these are probably more useful. Black-box approaches are inherently limited, and notably expensive to implement. Moreover, it seems like exploiting bugs is a bigger problem than software that is intentionally malicious. Both of these points mean it makes sense to help developers limit the impact of bugs. It seems cheaper, and it targets an apparently bigger problem.
- 0xbadcafebee 5y ago> the implementers generally have deep knowledge of how their software works. They can consider the internals of their own software This is the weird part to me: if you're a developer, you already control how your app works. You can put any kind of restriction you want in place without landlock. You just program it. Don't want user to access a character device? Test if the file you're about to open is a character device, refuse to open it. Don't want your user to open something in /etc/? Check the file path, don't open that file. My guess is that Landlock and its ilk are basically abstractions to allow programmers to be lazy? I'm still trying to understand the use case because it feels very much like a "webapp firewall", where the developer doesn't want to be bothered with understanding security, so they slap a thing on their app and tell themselves it's secure, when in reality it's still far from secure. Sandboxes get popped all the time.