neutrinolabs / xrdp

xrdp: an open source RDP server
http://www.xrdp.org/
Apache License 2.0
5.6k stars 1.73k forks source link

V0.10.x : Can't run xrdp-chansrv in console VNC session #3240

Open matt335672 opened 1 week ago

matt335672 commented 1 week ago

xrdp version

0.10.x and later

Detailed xrdp version, build options

Pretty much any

Operating system & version

Any

Installation method

Doesn't matter

Which backend do you use?

x11vnc, typically

What desktop environment do you use?

various

Environment xrdp running on

Typically physical machine

What's your client?

Any

Area(s) with issue?

Clipboard, File transfer / drive redirection

Steps to reproduce

  1. Log the console in using Xorg. Start x11vnc with something like:-
x11vnc -display $DISPLAY -forever -repeat
  1. Make a note of the DISPLAY

  2. Create a VNC-compatible stanza for xrdp in xrdp.ini, e.g.:-

[localvnc]
name=localvnc
lib=libvnc.so
ip=localhost
port=5900
pamusername=asktestuser
pampassword=ask
chansrvport=DISPLAY(1)
enable_dynamic_resizing=false

The above is for console display :1

  1. Connect through from an RDP client

✔️ Expected Behavior

Clipboard and drive redirection available

❌ Actual Behavior

Clipboard and drive redirection not available. Chansrv log contains lines like these:-

[2024-09-09T15:15:37.732+0100] [ERROR] [setup_api_listen(chansrv.c:1380)] setup_api_listen: trans_listen failed for port /var/run/xrdp/1001/xrdpapi_1
[2024-09-09T15:15:37.497+0100] [ERROR] [setup_listen(chansrv.c:1357)] setup_listen: trans_listen failed for port /var/run/xrdp/1001/xrdp_chansrv_socket_1

Anything else?

See #3237

matt335672 commented 5 days ago

The socket directory needs to be present when chansrv is started, or chansrv can't create its main listening socket.

One option might be to move the socket directory for configurations like this. This has a couple of disadvantages:- 1) The user has to create the directory in such a way that only the user and the xrdp process can access it. This is challenging to get right, and makes it hard for the xrdp team to re-design this directory. 2) If the directory moves, other components like the sound driver(s) need to be aware this has happened. Again,the onus to get this right is on the user, rather than the developer(s).

A better solution is for chansrv to ask sesman to create the socket directory via an additional SCP message. If chansrv finds the socket directory for the user to be missing, it can simply ask sesman to create it.

This does require sesman to be running. UDS authentication will be adequate for this, and no complicated run-time configuration is required by the user.

I'm going to draft a solution along these lines.