TurboVNC / turbovnc

Main TurboVNC repository
https://TurboVNC.org
GNU General Public License v2.0
746 stars 136 forks source link

Session Manager behaviour with UDS listening sessions #407

Closed yghorbal closed 3 months ago

yghorbal commented 3 months ago

Using macOS Viewer Version 3.1.1 (20240221) and RHEL 8.9 Server (Xvnc) 64-bit v3.1.1 (build 20240127) I started a session on the server with -uds option. The session is correctly created:

$ /opt/TurboVNC/bin/vncserver -uds -wm xfce

Desktop 'TurboVNC: youssef:1 (djo)' started on display youssef:1
Listening on Unix domain socket /home/djo/.vnc/youssef_1.uds

Starting applications specified in /opt/TurboVNC/bin/xstartup.turbovnc
Log file is /home/djo/.vnc/youssef:1.log

It's correctly listed on the server (with a weird WARNING though!)

$ /opt/TurboVNC/bin/vncserver -list

TurboVNC sessions:

X DISPLAY # PROCESS ID  NOVNC PROCESS ID

WARNING: youssef:1 is taken because abstract socket \0/tmp/.X11-unix/X1 is in use.
:1      14877

It's also correctly displayed in the Viewer when connected to the server's FQDN name:

Screenshot 2024-03-12 at 00 05 20

But when I click "connect". I get this error message:

Screenshot 2024-03-12 at 00 06 09

When starting the session without -uds, everything works as expected.

Does the Session Manager supposed to work with sessions listening on Unix Domain Sockets?

dcommander commented 3 months ago

It definitely does not work at the moment. I'll scope it out and see if it is something I can implement easily or whether it will require extensive modifications.

yghorbal commented 3 months ago

Thank you for the swift reply! I don't know if it's relevant, but the following works:

=> this shows the VNC auth window and access can proceed. If I understand correctly, in this case the session manager is not involved.

dcommander commented 3 months ago

Yes, you can use Unix domain sockets without the session manager. The session manager itself, however, still assumes that the session will be listening on a TCP port corresponding to its X display.

dcommander commented 3 months ago

In order to successfully generate an OTP for and connect to a TurboVNC session listening on a Unix domain socket, the TurboVNC Session Manager would need to know both the X display number of the session and the UDS on which it is listening. That would require extending the session manager protocol. Also, since Unix domain socket support requires an external SSH client, the session manager would need to be extended to handle external SSH clients. Otherwise, the built-in SSH client would be used for the session manager connection, and the external SSH client would be used for the RFB connection. I have added UDS support as a sub-feature of #148.

I did at least fix the warning.