Firejail vs SELINUX #4786
Replies: 3 comments 3 replies
-
Apparmor doesn't come as a 'regular' package you'd install on Arch Linux. All officially supported Linux kernels have AppArmor available the OS by default, you just need to enable it via kernel params. See this wiki page for details. I've been using it for a while now in combination with Firejail. It works, but the main gripe IMO is that not many apparmor profiles get installed by default. As you have experience in creating those I think you'll be settling in fine once you've enabled apparmor support on your Arch Linux machine(s). |
Beta Was this translation helpful? Give feedback.
-
This is not off topic, so I edited the title and removed '[OFF TOPIC]'. There's previous discussion in #4522 about relative merits of various approaches (bubblewrap, AppArmor, SELinux), it may be good to read that thread also. Firejail uses the methods provided by Linux kernel for sandboxing: seccomp, namespaces (mount, net, pid) and capabilities. SELinux TE rules can also limit access to file system, network and capabilities (and much more) but there's no equivalent to seccomp. Seccomp is very powerful but there are limits what it can control (because pointers to structures or strings can't be dereferenced). SELinux as a MAC system doesn't concern too much about UIDs, which is a DAC concept. There's UBAC though. SELinux is much more fine grained (for example, access to file descriptors passed by the parent process can be controlled) and there are lots of ways to control the system. Not all are very interesting in typical systems, like Infiniband or strange network protocols. Exhaustively checking all TE rules for the browser can be difficult due to indirections like attributes. As for the ~/Downloads, it is labeled as
Notably there are no rules which would allow executing the downloaded files. Other domains can't do it either since If the kernel provided equivalent access control methods to user applications as it provides now to SELinux with LSM hooks, I'm pretty sure we would try to use them all in Firejail. Beefing up seccomp so that the BPF code could access all system call parameters and call lots of kernel functions, would also allow much better control, but this would introduce other problems. Firejail could put the sandboxed process inside a VM with a Firejail nanokernel which could easily intercept system calls without restrictions, but it could be lot of work. It's not impossible, I think gVisor does that. It's entirely possible to use SELinux and Firejail, they complement each other nicely. With AppArmor there seems to be (or there were earlier) some kind problems so it's not recommended. |
Beta Was this translation helpful? Give feedback.
-
The guys from Bind DNS server at ISC did a series of webinars comparing SELinux, AppArmor, Firejail, and the sandbox in SystemD. They talk from a server perspective, not from a desktop app perspective. They say there is an overlap of about 80% among the four of them. Link for AppArmor/Firejail/SystemD presentation: https://www.youtube.com/watch?v=Cez-RkSQEHY - the conclusions are at 39:48. SELinux is discussed in the previous webinar. |
Beta Was this translation helpful? Give feedback.
-
A long time back while I was using Ubuntu I tried learn how to create how to create apparmor profiles. Back then firejail didn't exist. So I have a rough idea how apparmor works. I had used Fedora which comes with selinux by default but I never tried to learn selinux.
Q) How is selinux different in comparison to firejail ? I mean for example the default firejail profile for Firefox restricts FF's access to the ~/Downloads folder only so FF don't have access to other data in user's home. Does selinux do the same ?
I am using Arch which doesn't have selinux or apparmor so I can't experiment and frankly I am not sure if I should replace Arch with Fedora just for selinux.
Beta Was this translation helpful? Give feedback.
All reactions