mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #31] --noroot does not allow to start urxvt/rxvt-unicode #18
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#18
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 @blueyed on GitHub (Aug 17, 2015).
Original GitHub issue: https://github.com/netblue30/firejail/issues/31
I am using Vimperator in Firefox and have
set editor=vim-in-term, which is a script that callsurxvt ... vim.The
norootoption in/etc/firejail/firefox.profilecauses urxvt to fail:From reading the description of
norootthis does not seem to be obvious:The code from rxvt-unicode is this, where
ptyappears to come from libptytty (CVS at:pserver:anonymous@cvs.schmorp.de/schmorpforge):It can be reproduced using:
Using
firejail --noroot strace -f /usr/bin/rxvt-unicodeshows this at the end (group 5 beingtty):Is this a issue with rxvt-unicode, or is there anything firejail can do to allow this still?
@ghost commented on GitHub (Aug 17, 2015):
From your error messages, it seems that
urxvtis trying to start thept_chownprogram to set the permissions on the new pty. This will fail under--norootaspt_chownneeds to be SUID root to run. With the--norootoption, there is no root user to SUID to!The manual page for
pt_chownsays: "If you are using a 2.1 or newer Linux kernel with the 'devptsfs' or 'devfs' filesystems providing pty slaves, you don't need this program".Therefore it might be possible to compile urxvt without pt_chown support. I'm not an expert in urxvt so you'd have to do some research.
@blueyed commented on GitHub (Aug 17, 2015):
The call to
pt_chownseems to happen throughgrantptinget_pty(in libptytty/src/ptytty.C) (I have added theprintf):errno is
EAGAIN 11 Resource temporarily unavailable, and while it is not in my manpage forgrantpta search appears to indicate that it means[EAGAIN] The system has no available pseudo-terminal devices.btw: with
firejail --noroot groupsI am only in my user's group andnogroup. Is this expected?It seems like the name
--norootis a bit misleading, because it apparently does much more?!@ghost commented on GitHub (Aug 17, 2015):
Personally, I think the
--norootoption isn't misleading - it removes the root user. Thept_chownprogram is attempting to change to the root user (as it's installed SUID root), but firejail has removed the root user! Therefore thept_chownprogram can't run, and the program can't allocate a pty.This is basically exactly what
firejail --norootis meant to do! You've told firejail to remove the root user and block anything it does, for security. All modern Linuxes can work perfectly fine without a SUID program managing pseudo-terminals, whereas your Linux is running a SUID binary in the background without your knowledge. This is a potential security hole and is exactly the kind of thing that firejail was written for.TL;DR you told firejail to block root, it succeeded.
@blueyed commented on GitHub (Aug 17, 2015):
Well,
grantptcomes from glibc (so it should be pretty common?!).And it uses
pt_chownas a (fallback) helper based on HAVE_PT_CHOWN.It looks to me like the
pt_chowncall gets only done, because the regularchownfails, which is because with--norootthettygroup does not exist anymore:chgrp(andchmod) succeed if the group is already set as expected.@netblue30 commented on GitHub (Aug 18, 2015):
Not all programs run in "firejail --noroot". In fact, lots of them crash. SUID programs will fail trying to execute root-only operations, because there is no root user in the namespace.
rxvt example on a Debian system:
rxvt is a SUID binary. Just don't use --noroot with SUID binaries.
@blueyed commented on GitHub (Aug 19, 2015):
Neither
rxvt-unicodenorgnome-terminalis SUID on my system (I have not checkedrxvt-/etc/alternatives/rxvtpoints at/usr/bin/urxvthere, but I use/usr/local/bin/urxvtusually).gnome-terminalfails withgrantpt failed: Exec format errorwhen used in thevim-in-termscript (which gets called from Firefox via Vimperator). That appears to indicate the same issue.The workaround seems to be using
norootfrom the Firefox profile, but I've hoped that there was a better fix for this.I still think that if the
ttygroup (id) was provided with--norootthen it might work.@blueyed commented on GitHub (Aug 19, 2015):
For what it's worth, my hack / workaround for this is currently this:
@ghost commented on GitHub (Aug 19, 2015):
A simple solution would be to use
xterminstead ofrxvt, asxtermworks fine in--norootmode. Is there any reason you can't use xterm instead? It would seem to be more secure than rxvt.@netblue30 commented on GitHub (Aug 20, 2015):
The issue with --noroot is like this:
I instruct the kernel to create a user namespace, with no root user in the namespace, just the current user and the group associated with the current user. I don't add any supplementary group to the namespace. The kernel code decides what is permitted or not, and it will crash the process according to its own rules. The easy fix is not to use --noroot with some programs. The real fix would be to argue with the kernel people and convince them to change user namespace code - good luck with that!
tty group: users in this group have permission to open /dev/tty. If I add tty group to noroot namespace, everybody will have permission to access /dev/tty directly. I don't think is a good idea
.
gnome-terminal has lots of problems related with the way they handle the terminal. Like Firefox, they also run a single instance of the program. I usually stay with xterm and lxterminal (from LXDE).
@blueyed commented on GitHub (Aug 20, 2015):
Thanks for your explanation and suggestion to use
xterm, which works.However, my config is tailored for rxvt-unicode and its features in general, and therefore will keep using my above patch instead for now.