mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #770] [enhancement] Redesign of private-tmp #521
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#521
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 @chiraag-nataraj on GitHub (Sep 6, 2016).
Original GitHub issue: https://github.com/netblue30/firejail/issues/770
I'm wondering if the following is feasible.
-nolisten localto the X initialization script (xserverrc, .desktop file of your favorite login manager). This takes care of the messy situation with X11 abstract sockets and reduces the problem to locking down the ordinary unix socket in/tmp/.X11-unix.--private-tmpto whitelist/tmp/.X11-unixunless X11 isolation is being used so that X will continue to work even if you use--net=noneand--private-tmp.Thoughts?
@netblue30 commented on GitHub (Sep 6, 2016):
It is a good idea, I'll put it in, thanks.
@manevich commented on GitHub (Sep 6, 2016):
It's also possible to block access to X11 without blocking sockets by removing everything from xhost access list, so
MIT-MAGIC-COOKIE-1from.Xauthorityfile is used. And blacklist~/.Xauthorityfile in jail.@xahare commented on GitHub (Sep 8, 2016):
@manevich what distro are you using?
tried the above, xclock still ran. also tried --blacklist=/tmp/.X11-unix xlock still ran. this is on ubunutu-16.04 any idea? id like to be able to disable x11 access for apps that dont need it.
@manevich commented on GitHub (Sep 8, 2016):
@xahare
I am using Debian Stable.
May be my explanation was not so clear.
By default result of
xhostcommand on Debian Stable isto remove entries from access list, run
xhost -somethingcommand for each line, like this:xhost -SI:localuser:userEverything should work after this.
@chiraag-nataraj commented on GitHub (Sep 8, 2016):
@manevich Thanks for that - that's an interesting way to go about it! I guess I don't inherently trust X11's "security" model 😉
@xahare commented on GitHub (Sep 9, 2016):
is there a way to block an apps access to x11 without depending on x11s access control or giving it its own x server?
@chiraag-nataraj commented on GitHub (Sep 9, 2016):
@xahare, you can do what I suggested be the default (i.e. look at the opening post). Basically, you have to disable the abstract socket and then blacklist the regular unix socket in order to make sure the program doesn't have access to X11. What I suggested above does that.
@chiraag-nataraj commented on GitHub (Sep 9, 2016):
@netblue30, you may want to provide a
--blacklist-xsocketor something so that people who really want to block access to X can do so if you implement this suggestion.@manevich commented on GitHub (Sep 9, 2016):
@chiraag-nataraj Welcome!
Well, I also don't trust it too much, but this is simple and works fine as addition or if blocking abstract sockets is not solution.
@xahare commented on GitHub (Sep 9, 2016):
thought i knew how this worked. really glad this thread started! im missing something.
$ ss -lnt
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 5 192.168.122.1:53 :
LISTEN 0 5 127.0.1.1:53 :
LISTEN 0 128 :22 *:
LISTEN 0 128 :::22 :::*
didnt see anything on udp ports either.
yet,
firejail --net=none --private-tmp xlogo
firejail --net=none --blacklist=/tmp/.X11-unix xlogo
are needed to disable x. leave not --net=none or one of the tmp blockers and xlogo runs. whats going on?
the goal is allowing network, but not x11. also, now i just want to know whats going on!
@chiraag-nataraj commented on GitHub (Sep 9, 2016):
@xahare Here's what's going on.
By default, there are two different sockets (most distributions disable the tcp socket by default). There's the abstract socket (which requires a network namespace to disable generally speaking) and the standard unix socket (usually located in
/tmp).With respect to X11, you can handle both of these without having to create a new network namespace. You can disable the abstract socket as I described above, obviating the necessity of a network namespace. You can disable the unix socket by blacklisting it. Does that make sense? 😄
@xahare commented on GitHub (Sep 9, 2016):
@chiraag-nataraj yes! somehow i missed the memo on abstract sockets.
@xahare commented on GitHub (Sep 11, 2016):
The more i think about it, '-nolisten local' really belongs at the distro level, or maybe xorg itself as a default when installing to linux.
@xahare commented on GitHub (Sep 11, 2016):
how do you do this?
[edit] found it in /usr/share/lightdm/lightdm.conf.d/50-xserver-command.conf
@chiraag-nataraj commented on GitHub (Sep 11, 2016):
@xahare I agree that it should be a distro-level default, but apparently people don't seem to exactly care about this :( I think if distros started sandboxing programs by default (using firejail or apparmor or selinux or something), then you'd see a push to make this default.
@xahare commented on GitHub (Sep 15, 2016):
I think this project cares about this, https://github.com/QubesOS/qubes-gui-agent-linux/compare/master...xahare:patch-1
@netblue30 commented on GitHub (Sep 19, 2016):
Modified --private-tmp as a whitelist of /tmp/.X11-unix directory. Now I need to document how to disable the abstract x11 socket. Give it a try and if is breaking something else, let me know.
@chiraag-nataraj commented on GitHub (Sep 19, 2016):
Awesome! I presume that if you wanted to blacklist /tmp/.X11-unix (as is currently the case), you could use the blacklist command?
@netblue30 commented on GitHub (Sep 19, 2016):
yes, so for a server you would do "--private-tmp --blacklist=/tmp/.X11-unix". I'll have to modify all server profiles there.
@chiraag-nataraj commented on GitHub (Sep 19, 2016):
Perfect! Thanks @netblue30!