I have an X.org server running on my machine (Gentoo Linux without PAM, PolicyKit etc), incoming TCP connections are disabled with -nolisten tcp.
Is it possible to establish a whitelist specifying which local users are allowed to open windows on that X11 display?
Edit: I start my X server with this systemd unit:
[Unit]
Description=X Window System
Requires=systemd-user-sessions.service
After=systemd-user-sessions.service
[Service]
ExecStart=/usr/bin/xinit ${HOME}/.xinitrc -- -nolisten tcp vt09
User=myuser
Environment=SHELL=/bin/bash
[Install]
Alias=display-manager.service
Edit 2: I've modified it to this ...
ExecStart=/usr/bin/xinit ${HOME}/.xinitrc -- -auth ${HOME}/.Xauthority -nolisten tcp vt09
... created ${HOME}/.Xauthority ...
mcookie | sed -e 's/^/add :0 . /' | xauth -q
... and restarted the X server. Voila, authorisation is now default-deny. To give specific users access, I've copied .Xauthority to their home directory.
xhost commands weren't used.