wayland
wayland
¶
Select a desktop endpoint and restrict the proxy's compositor protocols.
Wayland grants protocol access, not merely permission to draw a window. The filtered mode exposes only the globals listed here. Direct mode deliberately retains the compositor's full client interface. Neither mode forwards audio, X11, the desktop runtime directory, or inherited display file descriptors.
WAYLAND_ENV_UNSET = ('WAYLAND_SOCKET', 'DISPLAY', 'XAUTHORITY')
module-attribute
¶
Endpoints that must not override the selected Wayland socket.
MOUNTS_NOT_PREPARED = 'desktop mounts were not prepared; recreate the task to enable Wayland'
module-attribute
¶
Why a container created without desktop mounts stays without GUI on every restart.
ALLOWED_GLOBALS = ('wl_compositor', 'wl_subcompositor', 'wl_shm', 'wl_output', 'wl_seat', 'xdg_wm_base', 'zxdg_decoration_manager_v1', 'wp_viewporter', 'wp_fractional_scale_manager_v1', 'wp_presentation', 'zwp_linux_dmabuf_v1', 'zwp_linux_explicit_synchronization_v1', 'wp_linux_drm_syncobj_manager_v1', 'wp_single_pixel_buffer_manager_v1', 'zwp_relative_pointer_manager_v1', 'zwp_pointer_constraints_v1', 'wp_cursor_shape_manager_v1')
module-attribute
¶
App surfaces, focused input, and rendering; unknown globals stay denied.
Clipboard/data devices, capture, input injection, DRM leasing, and desktop management are intentionally absent. FD transport remains wl-mitm's job.
WAYLAND_PROBE = ['python3', '-c', "import socket, struct, sys\nwith socket.socket(socket.AF_UNIX) as peer:\n peer.settimeout(2)\n peer.connect(sys.argv[1])\n peer.sendall(struct.pack('=III', 1, 12 << 16, 2))\n with peer.makefile('rb') as replies:\n reply = replies.read(12)\n if len(reply) != 12 or struct.unpack('=III', reply)[:2] != (2, 12 << 16):\n raise RuntimeError('compositor did not acknowledge Wayland sync')\n", CONTAINER_WAYLAND_SOCKET]
module-attribute
¶
Bounded wl_display.sync roundtrip from the container's security domain.
The proxy connects upstream only after accepting a client. A successful connect alone cannot detect denied or unavailable compositor access.
WaylandMode
¶
WaylandSession(mode=WaylandMode.NONE, upstream=None, binary=None, error=None, disabled_reason=None, direct_selinux=False)
dataclass
¶
Host-selected endpoints captured before a supervisor crosses namespaces.
mode = WaylandMode.NONE
class-attribute
instance-attribute
¶
upstream = None
class-attribute
instance-attribute
¶
binary = None
class-attribute
instance-attribute
¶
error = None
class-attribute
instance-attribute
¶
disabled_reason = None
class-attribute
instance-attribute
¶
Immutable isolation constraint: a restart must not add a mount creation refused.
direct_selinux = False
class-attribute
instance-attribute
¶
Immutable selection of the direct-access process domain at container creation.
proxied
property
¶
Whether this start has enough host wiring to launch the proxy.
mounted
property
¶
Whether creation gave the container its desktop mounts.
wired
property
¶
Whether this start has a complete path from the container to a compositor.
bound_socket
property
¶
The compositor socket a direct container holds as a bind mount, if it holds one.
malformed
property
¶
Whether the saved wiring could not be read back.
refreshed()
¶
Resolve this start's endpoints for the same grant.
What creation decided — the process domain, and whether desktop mounts exist at all — carries over unchanged, so one start from an unsuitable shell cannot cost a container the mounts it has.
Raises:
| Type | Description |
|---|---|
WaylandRecreationRequired
|
The saved wiring is unreadable, or a direct container's bound socket is gone or no longer the session's; Podman cannot retarget a saved bind mount. |
Source code in src/terok_sandbox/wayland.py
payload()
¶
Return the JSON representation stored in the private task sidecar.
Source code in src/terok_sandbox/wayland.py
from_payload(value)
classmethod
¶
Decode saved wiring, retaining malformed data as an explicit error.
Source code in src/terok_sandbox/wayland.py
WaylandRecreationRequired
¶
Bases: RuntimeError
A saved socket bind or process domain cannot change without recreation.
resolve_session(mode, *, unavailable=None)
¶
Resolve the invoking user's current desktop; failure costs only GUI access.
Source code in src/terok_sandbox/wayland.py
proxy_config(upstream, listener)
¶
Build stock wl-mitm TOML with no command hooks or permissive dry run.
JSON string syntax doubles as TOML basic strings once non-ASCII text is left unescaped: TOML rejects the surrogate pairs JSON would write.
Source code in src/terok_sandbox/wayland.py
warn_wayland(mode, reason, *, log=None, observer=None)
¶
Make optional desktop failure visible without claiming its cause is SELinux.
Source code in src/terok_sandbox/wayland.py
warn_desktop_access(mode, *, observer=None)
¶
Keep the host-desktop attack surface explicit in both opt-in modes.
Source code in src/terok_sandbox/wayland.py
emit_warning(message, *, observer=None)
¶
Present one startup warning on stderr, terminal-safe, and hand it to observer as plain text.
The single renderer of these warnings: a front-end that repeats what a
LifecycleHooks observer
collected passes each message back through here.