mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #1846] Allow to compile firejail non-setuid #1254
Labels
No labels
LTS merge
LTS merge
bug
bug
converted-to-discussion
doc-todo
documentation
duplicate
enhancement
file-transfer
firecfg
firejail-in-firejail
firetools
graphics
help wanted
information_old
installation
invalid
modif
moved
needinfo
networking
notabug
notourbug
old-version
overlayfs
packaging
profile-request
pull-request
question
question_old
removal
runtime-permissions
sandbox-ipc
security
stale
wiki
wiki
wontfix
wordpress
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/firejail#1254
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Vincent43 on GitHub (Mar 29, 2018).
Original GitHub issue: https://github.com/netblue30/firejail/issues/1846
Currently there are two ways to build sandboxes in linux:
Firejail is traditionally compiled as setuid binary but it can also use user namespaces when they're available. Both have their own security issues.
Some distros like Fedora or Opensuse are reluctant to add setuid binaries to official repos which means no firejail for their users. If we add possibility to compile firejail as non-setuid binary (
--nosetuid?) which uses unprivileged user namespaces to create sandbox then will be more chance that those distros will accept official firejail package. Also all users who are afraid of setuid bit will have alternative. Bubblewrap already provides this choice (on Archlinux and Debian it's compiled as setuid, on Fedora it uses namespaces).@curiosity-seeker commented on GitHub (Mar 30, 2018):
I'm not an expert - but here are some thoughts:
@Fred-Barclay commented on GitHub (Mar 30, 2018):
I think it's worth considering, with a few reservations: 😄
As @chiraag-nataraj points out, in the past we couldn't reliably count on user namespaces alone. It's my understanding that the combination of setuid and namespaces that is helpful here - i.e. they complement each other so that namespace escapes are blocked by the SUID options, and vice versa.
How would this affect sandbox parameters that probably do require setuid? Whitelisting and blacklisting can (I think) be done pretty safely with normal user privileges, but I expect things like seccomp, protocol, dbus control, net control... quite a few of our features rely on setuid or root privs (I believe - please correct if I'm wrong!).
If someone compiles with --nosetuid, might they be lulled into a false sense of security with the belief that seccomp and the other above options are working, when they're really not? Esp. in cases like Fedora, where (if they use this approach) the user may not even be aware that it's running without the setuid bit.
@Vincent43 commented on GitHub (Mar 30, 2018):
@curiosity-seeker
That's true that both approaches can be insecure. Some distros choose namespaces, others setuid. For distros which prefers namespaces firejail is currently unavailable. Bubblewrap approach is just less code, less features. If firejail would mimic this then there would be no point to exist at all.
This is interesting approach. System daemons can still be sandboxed as they're started by root which has always access to firejail binary. However this is packaging issue which still can be unacceptable for some distros.
@Fred-Barclay
I guess non-setuid firejail will have slightly less features which should be documented alongside compile time option. I think this would be still better than nothing.
That would be very helpful to decide if this approach make any sense to follow. Unfortunately I'm unable to compile such list.
@curiosity-seeker commented on GitHub (Mar 30, 2018):
Yes, you're right. of course.
@curiosity-seeker commented on GitHub (Apr 2, 2018):
I've tried what is suggested above in b).
I created the group
firejail, added my user to it and added two lines to the script I use to update the Firejail git version:Works well. No problems so far.
@Vincent43 commented on GitHub (Apr 2, 2018):
You probably mean
sudo chown root:firejail /usr/bin/firejailinstead ofsudo chown root:seeker /usr/bin/firejail.@curiosity-seeker commented on GitHub (Apr 2, 2018):
Yes, sorry - typo :-(
@netblue30 commented on GitHub (Apr 2, 2018):
Non-suid install here:
ff1599f64dYou configure as usuall, and add --disable-suid:
The variant with mode 4750 and group firejail seems to be working fine, but I'll do some more testing. After you add yourself to the group just remember to logout and login again.
@Vincent43 commented on GitHub (Apr 2, 2018):
@netblue30 can you elaborate what are consequences of
--disable-suidfor firejail functionality?BTW: I think we could make mode 4750 and group firejail official recommendation.
@Fred-Barclay commented on GitHub (Apr 2, 2018):
@Vincent43 The issue I see with mode 4750 and group firejail is that every single user on a system (I believe) will have to be manually added to the firejail group. Whereas with the current method, every user can run firejail.
It's certainly a great alternative, but I'm not sure it's suited for official recommendation (at least, not as the default).
Then again, probably a lot of desktop Linux systems are single-user anyway.
@Vincent43 commented on GitHub (Apr 3, 2018):
Yes, it can be an issue on multi-user systems. On Archlinux it can be fixed by using
usersgroup instead offirejailgroup which every real user belongs to by default.@Fred-Barclay commented on GitHub (Apr 3, 2018):
If I'm seeing it correctly, my user doesn't belong to
userson Arch:@Vincent43 commented on GitHub (Apr 3, 2018):
Hm, maybe they changed it recently.
@netblue30 commented on GitHub (Apr 3, 2018):
The sandbox will work only if you start it as root (for example if you run servers).
Will do! However, it will work only for more technical users. For non-technical users I have this plan:
Question: is anybody using --git-install? I intend to remove it.
@Fred-Barclay commented on GitHub (Apr 3, 2018):
I'm not. I just clone and build from source manually.
Good to know! So everything will still work as usual?
What advantages does this offer over the current method?
If I understand correctly this would handle the potential privilege escalation discussed in (b) of https://bugzilla.suse.com/show_bug.cgi?id=1059013#c9 - is that correct?
Can we have an option for people who don't use
sudo firecfgto sandbox programs? Something likesudo firecfg --add-usersso users are added to /etc/firejail/firejail.users but symlinks aren't created.Can we pass a list of users when running the code to add users to /etc/firejail/firejail.users?
sudo firecfg --add-users dustin lucas mike elevenor something like that. That should make it simpler to set up for multi-user machines.If we require each user to run
sudo firecfg, users without admin rights can't add themselves to the file and so can't use firejail. If an admin can specify user accounts to be added to the list, that would solve this potential issue.@netblue30 commented on GitHub (Apr 3, 2018):
Yes.
Yes, it will handle the same problem. It is easier to install than 4750/root:firejail, and we can make it invisible to the users.
Sure, it is very easy to implement. I should also add a --remove-users. Or we can allow root user edit /etc/firejail/firejail.user with a text editor.
@Vincent43 commented on GitHub (Apr 3, 2018):
The
/etc/firejail/firejail.userseems unnecessary to me. We can just makesudo firecfgto add user to firejail group (which can be created during install with sysusers.d) instead. Andsudo firecfg --add-users dustin lucas mike elevenwill add those users to firejail group instead of creating firejail specific files.This way it would be transparent for users but won't need duplication of existing functionality in firejail
@Fred-Barclay commented on GitHub (Apr 4, 2018):
What @Vincent43 said, with the exception that I would prefer us using something other than sysusers.d. There are still some distros out there where systemd isn't necessarily installed (Gentoo) or almost definitely isn't present (Devuan, the Arch and Manjaro OpenRC folks at Artix, and so on).
@curiosity-seeker commented on GitHub (May 28, 2019):
Kees Cook writes in his excellent blog regarding security enhancements in kernel 5.1:
Could this become relevant for Firejail?
@Vincent43 commented on GitHub (May 28, 2019):
No, firejail needs to be root.