mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #3602] Wiki: x11 guide #2262
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#2262
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 @matu3ba on GitHub (Aug 26, 2020).
Original GitHub issue: https://github.com/netblue30/firejail/issues/3602
Summary
We could sandbox the sandbox setup to fix this or use an overlay, but thats too much clutter.
Xpra
just works, but with constant lag :(
Xephyr
-extension MIT-SHMis used, no shared memory (more secure)TODOs
X11
-extension MIT-SHMWayland
(too much effort) Document how to sandbox XWayland (replace login manager, rewrite session handling in elogind/logind)just disallow X11Need to check withhack around with a huge command / upstream stuff to firejail?!xlsclients(requires restart),xeyes,xwininfo, starting application withDISPLAY='' apporWAYLAND_DEBUG=1 appin contrast to grepping for display portsMany distros dont ship a separate name to indicate that the application definitely uses waylanddont trust distros, they dont even manage to deprecate non-XDGBDS conforming applicationsLogin managers of distros still all use X11 (session management interaction?)no useless workEach login manager uses its own scripts for the Wayland and Xwayland session, but default X11 installation setup remains in /etc/X11no useless work@matu3ba commented on GitHub (Aug 26, 2020):
The old x11 guide is here and the new one will be here. For now it is more of a stub.
The wiki should live at
git@github.com:netblue30/firejail.wiki.git, so I cant push images.@netblue30 Should I link the images from your x11 guide as github user content or move into a folder
wiki/images/doc/imageand link from the wiki?man firejail-config is missing on my distribution(arch-based endeavour) imho.
@matu3ba commented on GitHub (Sep 2, 2020):
@rusty-snake Can you review?
I did only find this half-baked scripting solution for synchronizing the clipboard.
The other solution xclipsync did not work for me.
Do you have any idea what to use?
@rusty-snake commented on GitHub (Sep 3, 2020):
I'm on wayland for two years or so. So IDK too much about this, but here are three things I noted:
Why should I use this?: X11 is unsafe, no matter if it is used over an abstract or normal socket is usedNET? (ip addr show)@matu3ba commented on GitHub (Sep 3, 2020):
@rusty-snake Could you exemplify what on X11 remains unsafe, if one uses network namespaces + sandboxing?
Just curious: Do you use Sway, Gnome or tty/no Desktop Environment? For me KDE is very unstable and uses alot CPU on idle.
I fix 2+3 later.
@rusty-snake commented on GitHub (Sep 3, 2020):
If you restrict the X11 access of a sandbox to Xephyr (of whatever) it can obviously no longer do bat things like key-logger. So the most holes are closed. X11 is the only reason why we can not use
ipc-namespacefor graphical programs and almost every flatpak has--share=ipc.I follow the Wayland development of KDE since 2017. kwin_wayland looks good to me. However QT/KDE with Wayland is a torture. Crash, ugly window, broken clipboard, crash again, ... . GTK has full wayland support since 2015. Even firefox has good wayland support since 78 or so (before 78 you had crashes if you left-click on the wrong spot, open add-on pop-overs, ... every release a new crash, but now it's pretty good). To your question I use GNOME. The last time I tried sway (before 1.0, around summer 2018) it was lacking too much features.
@matu3ba commented on GitHub (Sep 3, 2020):
Thanks for the insight.
As I understand it, one can still abuse the shared memory region of the x11-server. Is there more you can think of?
Did you test x11docker (description) yet?
This looks like an excellent tool to compare firejail with.
1+2 I found the option
We could
stealcopy the config.@rusty-snake commented on GitHub (Sep 3, 2020):
@matu3ba commented on GitHub (Sep 3, 2020):
Do you mean like this?
firemon --x11 returns all possible display numbers and
firejail --x11does return the current display number only as debug output for the user and not scriptable.@rusty-snake commented on GitHub (Sep 3, 2020):
Something like this, but I don't remember.
@matu3ba commented on GitHub (Sep 3, 2020):
Thats not scriptable, since the status code of the first line
$?remains zero and DISPLAY in my shell environment remains ":0".@matu3ba commented on GitHub (Sep 4, 2020):
TODOs:
firejail --x11output orfiremon --x11to have a scriptable outputIf we can disable MIT-SHM / shared memory and performance is reasonable, we can use IPC namespacing.
@mviereck commented on GitHub (Sep 4, 2020):
In Xephyr, just set option
-extension MIT-SHMto disable it. (A+would enable it).xpra does not directly provide an option to disable MIT-SHM, but you can run a custom Xvfb command with disabled MIT-SHM or attach to an already running custom X/Xvfb server.
To disable MIT-SHM on regular Xorg started by a display manager, you can create a file in
/etc/X11/xorg.conf.d.Example:
You can check for enabled MIT-SHM with
xdpyinfo | grep -q "MIT-SHM".I don't have a solution for Xwayland started by a Wayland compositor.
@matu3ba commented on GitHub (Sep 8, 2020):
/usr/bin/Xwayland -helpshows an option-extension name Disable extension, but breaks awkwardly the pipe.Since I cant find any other specific paths for KDE, in the Wayland manual or in a search engine, I would assume that the standard paths for x11 configuration are used.Since the manual leaves the option open to define the display variable yourself, this would mean multiple x11 servers which I find dubious (since x11 handles all kind of stuff).Hence I asked on stackoverflow and will likely contact the x11/Wayland devs to improve their manual.
@matu3ba commented on GitHub (Sep 10, 2020):
For sddm the configuration is in
nvim /usr/lib/sddm/sddm.conf.d/default.confand for my distro it uses/usr/share/sddm/scripts/Xsessionfor the scripts to start the Xorg session.It is very annoying that Wayland provides no central place for the Wayland-specific config parts and every login manager has a different place.
At least for x11 there was a convention to place the startup scripts it into
/etc/X11/and the session scripts intoxorg.conf.d.xorg setup commands
@matu3ba commented on GitHub (Sep 10, 2020):
Maybe Wayland accepts changes to the Wayland standard for using XDG_BASE.My mail got ignored.The need of tools like xeyes to check what programs use Xwayland (and conversely Wayland) is very annoying.
Starting XWayland sandboxed would require replacing the graphical login manager + rewriting invoking commands (in elogind or logind) of the display manager.
The rabbit hole of session management is also very deep.
The replacement login manager/display manager can be greetd or writing custom scripts/the Sway way of doing things.
@matu3ba commented on GitHub (Sep 17, 2020):
@rusty-snake
Did you ever check with
xeyes, if Chromium or Firefox are started on XWayland?On my OS
GTKappears to always start with XWayland (in contrast to Qt applications), which defeats the purpose of using Wayland.(Firefox is also laggy and cant handle the content on maximizing, when using with KDE + Wayland. I can only use it on one screenside. I did not have issues with Falkon/Qt though.)
@rusty-snake commented on GitHub (Sep 18, 2020):
I use
xlsclients.Use
GDK_BACKEND=wayland CLUTTER_BACKEND=waylandif you want to change this.I can only talk about mutter (GNOME), but here firefox 80 is very stable now. No crashes, flickering, broken clipboard, wrong context-menu, ...
@matu3ba commented on GitHub (Sep 18, 2020):
@rusty-snake
xlsclients -display :1 -areturns onlyeven though
xeyesshows vlc to use X11 (uses GTK).There are also no more apps with such functionality.
Interestingly vlc is still started on XWayland (shown by xeyes).
Qt applications however just work fine.
@rusty-snake commented on GitHub (Sep 19, 2020):
I know it does not show all programs, on the other can it can show you X11-clints without window such as ibus. You can also use xprop, ... see https://fedoraproject.org/wiki/How_to_debug_Wayland_problems#Does_your_application_run_on_Wayland_natively.2C_or_uses_XWayland_.28X11_compatibility_layer.29.3F
Maybe the devs force X11 because the have bugs / missing features in wayland (HW-accel?). Or vlc still stuck on qt4.
@matu3ba commented on GitHub (Sep 19, 2020):
@rusty-snake
Setting
mitigated the issues (mostly heavy flickering with javascript or on initial resizing/maximizing the window, which still on initial loading of javascript occurs and then generally disappears after 10-15 sec).
vaapiis for GPU acceleration, which is optional.xlsclientsmay require a restart of the system after installation.@matu3ba commented on GitHub (Sep 20, 2020):
@rusty-snake @netblue30
This is expected behavior of Firefox.
"More recent versions of Firefox support opting into Wayland via an environment variable."
The Wayland standard implies probably unsecure applications, because it gives no user indication for its usage. This was just a big waste of time.
Can I write about this in a separate Wayland guide, since this may compromise user security?
@rusty-snake commented on GitHub (Sep 21, 2020):
What do you mean exactly?
FYI: Weston and sway can be used w/o XWayland AFAIK and GNOME is 2 or 3 release away from it.
@matu3ba commented on GitHub (Feb 8, 2021):
Yes. However, many distros have XWayland and Wayland for compatibility. It is however not visually distinguished and easily checkable, if the program uses XWayland or Wayland.
Programs can choose as they please and it would be the distros job to prevent this or ship separate versions. However, few actually do this (due to maintenance costs and no easy way in the standard to check/no simple programs available).
@rusty-snake commented on GitHub (Feb 8, 2021):
Ahhh, so you want to write a warning with some background and suggest to add a
include disable-X11.incto the most<program>.locals which supports it?@rusty-snake commented on GitHub (Aug 4, 2021):
https://github.com/netblue30/firejail/discussions/4451