Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disconnect after selecting large amount of text (Ubuntu 21.04, xrdp, x11vnc) #1885

Closed
zilexa opened this issue May 12, 2021 · 8 comments · Fixed by #1900
Closed

Disconnect after selecting large amount of text (Ubuntu 21.04, xrdp, x11vnc) #1885

zilexa opened this issue May 12, 2021 · 8 comments · Fixed by #1900
Labels
confirmed confirmed reproduction

Comments

@zilexa
Copy link

zilexa commented May 12, 2021

Ubuntu Budgie 21.04 (but same issue on 20.10), xrdp 0.9.12.
All I did on my homeserver:
sudo apt install xrdp && sudo apt install x11vnc

Changed the xrdp.ini file, x11vnc section to connect to port 5900. Goal is to share the local desktop session that is currently running (instead of a new remote session):

[Xvnc]
name=Xvnc
lib=libvnc.so
ip=127.0.0.1
port=5900

I have Guacamole in Docker running on the server and access guacamole via my laptop within my LAN. Via guacamole I simply connect to xrdp protocol, rdp://192.168.88.2. Connection works instantly, it is plenty fast.

Only issue is this one:
#755

As soon as I select a large/semi-large amount of text, I am disconnected within seconds.
I can reconnect, but after a fixed amount of time (about 10-15sec) I always get disconnected.
Unless I use the little time I have after reconnecting to select a single word, when I do that, connection stays.

It seems this was fixed before in the past..

When I connect (using guacamole) directly with x11vnc: vnc://192.168.88.2:5900 I do not have this issue. I prefer the xrdp>x11vnc route though because it is slightly faster.

@matt335672 matt335672 added the confirmed confirmed reproduction label May 12, 2021
@matt335672
Copy link
Member

Hi @zilexa

Thanks for reporting this. I've managed to reproduce it with Guacamole, but not with the Microsoft client. It's a buffer overflow in the VNC code for large copy-and-paste operations.

It's not the same as #755, although the symptoms are similar.

I must also say that although your setup should work, cut-and-paste probably won't. For that you';; need to run xrdp-chansrv, and we only recently fixed a bug which allows this to happen on DISPLAY 0. So you'd need xrdp v0.9.16 for that.

@zilexa
Copy link
Author

zilexa commented May 13, 2021

Thanks for the swift feedback!
I use this setup because the documentation of guacamole (and several other articles and fora) recommend this (xrdp + x11vnc) is THE best way to share local desktop session with opensource software. So I thought it would be pretty common.

I haven't been able to replace x11vnc+xrdp for xorgxrdp+xrdp, it seems for display0/current session, x11vnc is the only way to go?

I guess I should do 3 things:

  1. From the 0.9.16 release notes I understand all I need to do is add chansrvport=DISPLAY(0) to the [Xvnc] section in my xrdp.ini.
  2. Updating to that version would mean building from source and installing, since v0.9.12 is the latest available in Ubuntu repository.
  3. File a bug with guacamole (already did guacamole-1345) and add information to it.

@necouchman
Copy link

@matt335672: Could you clarify this statement a bit:

Thanks for reporting this. I've managed to reproduce it with Guacamole, but not with the Microsoft client. It's a buffer overflow in the VNC code for large copy-and-paste operations.

With Guacamole, when connecting to xrdp, the VNC code would not be used at all (even if xrdp is using VNC on the back-end), so I'm not sure how this could be a buffer overflow in the Guacamole VNC code?

Can you provide any further detail about where you see this buffer overflow?

@matt335672
Copy link
Member

Both - there's definitely a bug on our side which needs sorting out. This may still be nothing to do with guacamole.

@zilexa - as regards your list :-

  1. In your session you need to run xrdp-chansrv before you connect to the session. Otherwise you'll see a delay while xrdp tries to talk to a non-existent process. Be aware that when you log out of the session it will be necessary (somehow) to fusermount -u ~/thinclient_drives before starting another xrdp-chansrv.
  2. That's correct.
  3. That's possibly a bit premature, and I apologise if I gave you that impression.

Also, there's some basic text-only cut-and-paste code which is supported in x11vnc mode which is what seems to be broken here.

@necouchman - @zilexa is talking RDP from guacamole to xrdp, and then using the xrdp VNC backend to connect to an existing x11vnc server.

I think there's a linguistic confusion here - both projects have a VNC backend and the problem I've found is in the xrdp VNC backend and not the guacamole VNC backend. I think that's been lost in translation.

Does that make sense?

A bit more detail which may help - xrdp is receiving a CLIPRDR_FORMAT_DATA_REQUEST PDU MS-RDPECLIP 2.2.5.1 and then trying to squeeze a large amount of VNC copy text into an inappropriately sized buffer.

I think the problem comes down to when the client sends CLIPRDR_FORMAT_DATA_REQUEST, and this is just something which is more likely to happen with guacamole. I'm planning to test that hypothesis this afternoon, in which case I can rule out guacamole.

The reason we don't see this all the time is that in this configuration the process which normally handles the clipboard is not running, and so we're falling back on some rarely used codepaths.

@matt335672
Copy link
Member

I can confirm this is nothing to do with guacamole.

The Windows client sends the CLIPRDR_FORMAT_DATA_REQUEST on a request to paste the data rather than earlier.

@necouchman - I think you can close 1345 on your side. I don't have an Apache account myself.

@necouchman
Copy link

@matt335672: Thank you for the additional testing and detail on this - makes sense and is much appreciated. I'll close out the ticket on the Guacamole end.

@zilexa
Copy link
Author

zilexa commented May 17, 2021

Just fyi, without xrdp-chansrv, the connection is fast and stable, I am not noticing any delay..
Only when selecting large text the connection gets interrupted.

A bit offtopic, but is x11vnc essential to connect to the current local session via xrdp or can this also be achieved without vnc? I haven't found any documentation online describing alternatives for vnc when using xrdp to connect to the local session.

@matt335672
Copy link
Member

The only way to connect to the console I'm aware of is to (somehow) go via VNC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed confirmed reproduction
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants