neutrinolabs / xrdp

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

Remote desktop connection from windows 10, with x11vnc and -unixpw argument, weird key events #3216

Open adrianalin opened 3 weeks ago

adrianalin commented 3 weeks ago

xrdp version

0.9.19

Detailed xrdp version, build options

user@mvc:~$xrdp --version
xrdp 0.9.19
  A Remote Desktop Protocol Server.
  Copyright (C) 2004-2020 Jay Sorg, Neutrino Labs, and all contributors.
  See https://github.com/neutrinolabs/xrdp for more information.

  Compiled with OpenSSL 3.1.3 19 Sep 2023

Operating system & version

Yocto built OS

Installation method

dnf / apt / zypper / pkg / etc

Which backend do you use?

x11vnc 0.9.16

What desktop environment do you use?

Xfce

Environment xrdp running on

phisical machine

What's your client?

windows remote desktop connection

Area(s) with issue?

Keyboard / Mouse

Steps to reproduce

When trying to login from windows remote desktop connection tool, i get the login screen but i don't get to enter my username, because there are some weird key events which causes to skip directly to password. image

Aug 20 17:52:22 mvc x11vnc[496042]: 20/08/2024 17:52:22   32 bpp, depth 24, little endian
Aug 20 17:52:22 mvc x11vnc[496042]: 20/08/2024 17:52:22   true colour: max r 255 g 255 b 255, shift r 16 g 8 b 0
Aug 20 17:52:22 mvc x11vnc[496042]: 20/08/2024 17:52:22 no translation needed
Aug 20 17:52:22 mvc x11vnc[496042]: 20/08/2024 17:52:22 Enabling full-color cursor updates for client ::1
Aug 20 17:52:22 mvc x11vnc[496042]: 20/08/2024 17:52:22 Enabling NewFBSize protocol extension for client ::1
Aug 20 17:52:22 mvc x11vnc[496042]: 20/08/2024 17:52:22 Enabling ExtDesktopSize protocol extension for client ::1
Aug 20 17:52:22 mvc x11vnc[496042]: 20/08/2024 17:52:22 Using raw encoding for client ::1
Aug 20 17:52:22 mvc x11vnc[496042]: 20/08/2024 17:52:22 Sending rfbEncodingExtDesktopSize for size (2560x1440)
Aug 20 17:52:22 mvc x11vnc[496042]: 20/08/2024 17:52:22 Sending rfbEncodingExtDesktopSize for size (2560x1440)
Aug 20 17:52:22 mvc x11vnc[496042]: 20/08/2024 17:52:22 # keyboard(up, 0xff09 "Tab") uip=1  23.2665
Aug 20 17:52:22 mvc x11vnc[496042]: 20/08/2024 17:52:22 # keyboard(up, 0xffe1 "Shift_L") uip=1  23.2665
Aug 20 17:52:22 mvc x11vnc[496042]: 20/08/2024 17:52:22 # keyboard(up, 0xffe2 "Shift_R") uip=1  23.2665
Aug 20 17:52:22 mvc x11vnc[496042]: 20/08/2024 17:52:22 # keyboard(up, 0xffe3 "Control_L") uip=1  23.2665
Aug 20 17:52:22 mvc x11vnc[496042]: 20/08/2024 17:52:22 # keyboard(up, 0xffe4 "Control_R") uip=1  23.2665
Aug 20 17:52:22 mvc x11vnc[496042]: 20/08/2024 17:52:22 # keyboard(up, 0xff09 "Tab") uip=1  23.2665
Aug 20 17:52:22 mvc x11vnc[496042]: 20/08/2024 17:52:22 # keyboard(up, 0xffe9 "Alt_L") uip=1  23.2665
Aug 20 17:52:22 mvc x11vnc[496042]: 20/08/2024 17:52:22 # keyboard(up, 0xff09 "Tab") uip=1  23.2666
Aug 20 17:52:22 mvc x11vnc[496042]: 20/08/2024 17:52:22 # keyboard(up, 0xffea "Alt_R") uip=1  23.2666
Aug 20 17:52:22 mvc x11vnc[496042]: 20/08/2024 17:52:22 # keyboard(up, 0xff09 "Tab") uip=1  23.2666
Aug 20 17:52:22 mvc x11vnc[496042]: 20/08/2024 17:52:22 # keyboard(up, 0xff09 "Tab") uip=1  23.3535
Aug 20 17:52:22 mvc x11vnc[496042]: 20/08/2024 17:52:22 # keyboard(up, 0xffe1 "Shift_L") uip=1  23.3535
Aug 20 17:52:22 mvc x11vnc[496042]: 20/08/2024 17:52:22 # keyboard(up, 0xffe2 "Shift_R") uip=1  23.3535
Aug 20 17:52:22 mvc x11vnc[496042]: 20/08/2024 17:52:22 # keyboard(up, 0xffe3 "Control_L") uip=1  23.3535
Aug 20 17:52:22 mvc x11vnc[496042]: 20/08/2024 17:52:22 # keyboard(up, 0xffe4 "Control_R") uip=1  23.3535
Aug 20 17:52:22 mvc x11vnc[496042]: 20/08/2024 17:52:22 # keyboard(up, 0xff09 "Tab") uip=1  23.3535
Aug 20 17:52:22 mvc x11vnc[496042]: 20/08/2024 17:52:22 # keyboard(up, 0xffe9 "Alt_L") uip=1  23.3535
Aug 20 17:52:22 mvc x11vnc[496042]: 20/08/2024 17:52:22 # keyboard(up, 0xff09 "Tab") uip=1  23.3535
Aug 20 17:52:22 mvc x11vnc[496042]: 20/08/2024 17:52:22 # keyboard(up, 0xffea "Alt_R") uip=1  23.3536

Note that I don't press any keys when I get this screen.

After failed login, prompts come back correctly and i can login.

✔️ Expected Behavior

No extra keys, login successful with first attempt.

❌ Actual Behavior

Login fails with first attempt.

Anything else?

No response

matt335672 commented 3 weeks ago

Hi @adrianalin

When you say 'login screen', do you mean the xrdp login screen or something else? I don't recognise the image you have posted.

adrianalin commented 3 weeks ago

Login screen -> I mean the x11vnc login screen.

https://linux.die.net/man/1/x11vnc check the argument -unixpw [list] , that is how I got to that login screen.

matt335672 commented 3 weeks ago

Thanks - that's a new one on me.

I've managed to reproduce this using this command line:-

UNIXPW_DISABLE_SSL=1 x11vnc -forever -repeat -unixpw -dk

I've run through this in a debugger, and I can see the keypresses coming over the wire from mstsc.exe. If I connect from FreeRDP (Linux), this doesn't happen. If I connect from MobaXterm (Windows), the same events occur.

They're all 'up' keypresses. I imagine the idea is to make sure the keyboard is in a known state before starting. It seems odd, as there's a sync event in the RDP specification which does exactly this. I've double-checked and we're not processing that event in VNC mode.

This looks like a problem with the x11vnc login box. I can't see why it should respond to up keypresses in this way.

I'm afraid I can't suggest a workaround for you within xrdp, as we're not generating these. I've tried playing with a few mstsc.exe options, and I can't stop the key up events being sent.