-
Notifications
You must be signed in to change notification settings - Fork 584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document the high-level architecture of firejail #985
Comments
Man I'm a great fan of bash but firejail in bash script? O_o I was wondering the same related issue, there's need for some architecture documentation. |
I can't comment on this specifically.
LXD/LXC and Docker aren't sandbox technologies, they're container software that happens to use sandboxing technology. Containers require sandbox technology, but sandboxes (like firejail) aren't inherently containers because they don't require partitioning of resources (nad firejail explicitly does not partition system resources). Last I checked, firejail uses a combination of:
Notably missing from this list are cgroups, and they're not involved for a couple of reasons:
As far as the nesting, I'm pretty sure the order is:
Namespaces have to come first because you need an independent mount namespace to be able to manipulate the filesystems without affecting the rest of the system. Seccomp-BPF has to come last, since it may be filtering some of the system calls needed to set everything up.
I can't exactly comment on this either.
From a practical perspective, when discussing Linux, there really aren't any alternatives to any of the things Firejail uses if you want it to be usable in the same way. In theory, it's possible with the VServer functionality in iptables to do the same kind of network isolation, but that's way more difficult to set up and provides less complete isolation. There really aren't any practical alternatives to Seccomp-BPF or the other stuff that firejail uses though.
This is actually really easy to explain, but begets a discussion all it's own. Among other reasons though:
|
@Ferroin : Thanks - that's a very good explanation, IMHO! Regarding
Do you think that rewriting Firejail in Rust would be beneficial in order to make it even more secure? Rewriting it from scratch would be a lot of work, of course, and certainly not reasonable for @netblue30. I wonder, though, if it would be worth considering once corrode is mature enough. |
I really don't know. I have very limited knowledge of Rust (I'm mostly a Python person myself, the primary reason I know C is more for my resume (although it has been useful on quite a few occasions)). Firejail has (from what I can see) very well written code in terms of secure design, so I don't think that much could be gained by using Rust. The two big things to really worry about with firejail or any sandbox tool for Linux are the kernel (if the kernel side has bugs, you generally can't do anything about it from userspace, and it's generally a much bigger security issue) and the high level structure. |
@Ferroin : Thanks for your reply!
That's good to read!
Yes, agreed, but seccomp-bpf mitigates this problem to some extent as it reduces the attack surface of the kernel (unless that part of the code is broken itself). (EDIT: I think there was once a kernel bug using the futex syscall) |
I meant "Why was overlayfs chosen from a bunch of different cow FSs (unionfs, aufs)?" |
@KOLANICH Ah, I misunderstood that that's what you meant. That's a pretty easy one too though, OverlayFS is supported upstream as part of the mainline kernel, so you can depend on it being in pretty much every distro with a new enough kernel, AUFS and UnionFS are both out-of-tree modules, so they lag a bit relative to kernel releases and aren't guaranteed to be around on any arbitrary distro. Also, just to clarify, the term you're looking for is 'overlay filesystem', not 'COW filesystem'. Overlay filesystems are inherently COW, but not all COW filesystems are overlay filesystems (both ZFS and BTRFS, among others, are COW, but not overlay filesystems). @curiosity-seeker Yeah, seccomp-BPF does help, but like you said, it's not bulletproof. There have been many bugs over the years in system calls that functionally can't be blocked by firejail simply because too many things need them (such as futex(), which is used all over the place by the glibc threading implementation). |
I think this can be wrapped into #2090. |
I mean it'd be nice to have a doc describing:
0 what threat model we have;
1 what isolation technologies and their components are (not) used and why: lxc, lxd, docker, cgroups, different filesystems, firewalls;
2 how exactly they are used and what the goals to use each of them are;
3 in what sequence they are used, what is nested in what;
4 plans on what technology it should/canworth//would be nice to use and what the gains are;
5 what the alternatives to the technologies already used are and what their pros and cons for firejail are;
6 why we use C instead of bash scripts and cli tools.
The text was updated successfully, but these errors were encountered: