Skip to content

LordOS — a free, fast and secure GNU/Linux distribution based on Debian, with its own desktop environment: display server and Wayland compositor in C, a React UI engine on QuickJS, and private native apps.

fwlinux/screen.sh: an X socket is the session's own rootless Xwayland (0600, the user's) since 0.8.3; fail only on a full X server or a foreign socket

Federico Pereira1f7a6099f8f0
diff --git a/server/tests/fwlinux/screen.sh b/server/tests/fwlinux/screen.sh
index d46def2..1c7711e 100755
--- a/server/tests/fwlinux/screen.sh
+++ b/server/tests/fwlinux/screen.sh
@@ -4,7 +4,9 @@
# running system:
# - the compositor offers no capture protocol (screencopy, image capture, dmabuf export) to a
# client (build/wl-globals, connected like any app);
-# - there is no X server (Xwayland isn't supported), so no X11 screen grab;
+# - an X server socket, if any, is the session's own rootless Xwayland (0.8.3): 0600, the user's, and
+# rootless, so an X11 app sees only X11 windows, never Wayland or LordOS windows; restricted apps
+# get no DISPLAY (docs/FIREWALL.md);
# - no screen-cast portal is installed that could hand a PipeWire screen stream to an app
# (xdg-desktop-portal with a ScreenCast backend);
# - no PipeWire node is a screen source;
@@ -20,7 +22,12 @@ GLOBALS=$(WAYLAND_DISPLAY=${WAYLAND_DISPLAY:-wayland-0} "$WG")
[ -n "$GLOBALS" ] && ok "connected to the compositor: $(echo "$GLOBALS" | wc -l) globals" || { bad "no globals"; fwlinux_done; exit 1; }
cap=$(echo "$GLOBALS" | grep -E -i "screencopy|image_copy_capture|image_capture_source|export_dmabuf|screencast|output_image|capture" || true)
[ -z "$cap" ] && ok "no capture protocol among them" || bad "capture protocols offered: $cap"
-ls /tmp/.X11-unix/X* >/dev/null 2>&1 && bad "an X server is running" || ok "no X server socket"
+for x in /tmp/.X11-unix/X*; do
+ [ -S "$x" ] || continue
+ m=$(stat -c '%a %U' "$x")
+ [ "$m" = "600 $(id -un "$U")" ] && ok "$x is the session's Xwayland socket ($m)" || bad "$x: $m (not the session's own 0600 socket)"
+done
+pgrep -x Xorg >/dev/null && bad "a full X server (Xorg) is running" || ok "no full X server (only rootless Xwayland, if any)"
portal=$(grep -l -s "ScreenCast" /usr/share/xdg-desktop-portal/portals/*.portal 2>/dev/null)
command -v /usr/libexec/xdg-desktop-portal >/dev/null 2>&1 || [ -x /usr/libexec/xdg-desktop-portal ] && pp=1 || pp=0
[ -z "$portal" ] && ok "no screen-cast portal backend installed (xdg-desktop-portal: $([ $pp = 1 ] && echo present || echo absent))" || bad "screen-cast portal backends: $portal"