mviereck / x11docker

Run GUI applications and desktops in docker and podman containers. Focus on security.
MIT License
5.5k stars 370 forks source link

--hostdisplay fails if X server runs without cookie authentication #492

Open Greek64 opened 1 year ago

Greek64 commented 1 year ago

x11docker is checking the XAUTHORITY (Hostxauthority) variables and correctly reports

x11docker WARNING: Your host X server runs without cookie authentication.

when the X Server runs without cookie authentication.

But when given the --hostdisplay option, following commands are run

Hostcookie=$(xauth -n -i -f $Hostxauthority list | grep :$Hostdisplaynumber | awk '{print \$3}')
xauth -n -i -f $Xclientcookie add $Newdisplay MIT-MAGIC-COOKIE-1 \$Hostcookie

which of course fail, because $Hostxauthority is unset/empty.

Using the --xauth=no option is also not helping, since it just unsets the XAUTHORITY variable (which in our case is already by default).


Encasing the commands in a guard checking for unset Hostxauthority would mitigate this issue, but this may also happen in other positions, since I get the general feeling that x11docker is always asuming xauth functionality.

mviereck commented 1 year ago

Thank you for the report! I'll check this some day.