# Several issues with Xrdp



## zirias@ (May 4, 2019)

I just installed a jail I intend to use for remote desktop through Xrdp and ran into several issues with it. First some info on my system:


Kernel: FreeBSD 12.0-RELEASE-p3 r345984 GENERIC on amd64
All packages built with `poudriere` and the following global make.conf(5) settings: 
	
	



```
DEFAULT_VERSIONS+= ssl=libressl samba=4.8 php=7.2 pgsql=10 linux=c7
OPTIONS_UNSET+= GSSAPI_BASE ALSA PULSE PULSEAUDIO
OPTIONS_SET+=   GSSAPI_MIT SNDIO PORTAUDIO
```


1. Login with `winbind` username in the form `<DOMAIN>\<user>`

I quickly realized this doesn't work  Xrdp interprets the domain-part sent by the client as the name of the session type to use. So, it finds a session type named like my Windows domain doesn't exist, picks the default type instead and tries to authenticate with PAM using only the `<user>` part (after the backslash), which fails.

Is there a way around this behavior? My workaround for now is `winbind use default domain = yes` in /usr/local/etc/smb4.conf, so winbind maps to plain usernames without a domain-part. But I'd prefer to have my domain-qualified usernames.

2. Xorg with `libxorgxrdp.so` crashes

The next problem I ran into was a crashing X-server. It logs the following: 
	
	



```
[1029407.028] (EE) Backtrace:
[1029407.033] (EE) 0: /usr/local/bin/Xorg (?+0x20) [0x3ffa40]
[1029407.036] (EE) 1: /lib/libthr.so.3 (?+0x20) [0x8009e4400]
[1029407.040] (EE) 2: /lib/libthr.so.3 (?+0x20) [0x8009e3900]
[1029407.044] (EE) 3: ? (?+0x20) [0x7ffffffff1b3]
[1029407.047] (EE) 4: /usr/local/lib/xorg/modules/libxorgxrdp.so (?+0x20) [0x8019ade30]
[1029407.051] (EE) 5: /usr/local/lib/xorg/modules/libxorgxrdp.so (?+0x20) [0x8019ac5c0]
[1029407.054] (EE) 6: /usr/local/lib/xorg/modules/libxorgxrdp.so (?+0x20) [0x8019ab460]
[1029407.060] (EE) 7: /usr/local/lib/xorg/modules/libxorgxrdp.so (?+0x20) [0x8019aa780]
[1029407.065] (EE) 8: /usr/local/bin/Xorg (?+0x20) [0x3f7280]
[1029407.071] (EE) 9: /usr/local/bin/Xorg (?+0x20) [0x2848a0]
[1029407.076] (EE) 10: /usr/local/bin/Xorg (?+0x20) [0x28e150]
[1029407.082] (EE) 11: /usr/local/bin/Xorg (?+0x20) [0x278020]
[1029407.087] (EE) 12: ? (?+0x20) [0x80043b020]
[1029407.087] (EE) 
[1029407.087] (EE) Segmentation fault at address 0xffffffffffffffff
```
 For context, here's the full log on pastebin. Did I miss something here, could it be caused by my make.conf settings? Should I go and file a bug?

Anyways, next workaround: install net/tigervnc-server and use the `Xvnc` session type. This works, but if I understood correctly, is less performant than using the RDP driver for Xorg.

3. High-DPI displays, Xvnc doesn't seem to get client DPI correctly

From work, I have a Microsoft Surface Book, which has an insanely high-dpi (don't know the exact value) integrated display. When I connect to some remote Windows desktop, it all works well. When I connect to my Xrdp server, the Xvnc server doesn't seem to get a correct DPI setting -- everything is displayed in a tiny size, I can't read anything 

Is this expected to work with Xvnc? Would it be expected to work with Xorg and the RDP driver? Is there anything I can do, configuration-wise?

4. Audio redirection

Looking at the packages that got installed, I assume audio redirection would work if I used `pulseaudio`, as there's the audio/pulseaudio-module-xrdp package installed with Xrdp. Well, one reason I stay away from Linux if I can is some special kind of software that a) is designed in a highly-complex way while b) tries to replace any (simple) alternative, I guess you get what I mean, and you can see from my `make.conf` above that my packages avoid `pulseaudio` if possible.

Now, is pulseaudio really my only chance to get audio redirection working? If so, would there at least be a way to have `sndio` output through pulseaudio, or do I really have to build all my packages with pulseaudio support? 

Thanks for hints, ideas, solutions, comments ...


----------



## zirias@ (May 13, 2019)

I'd be quite happy about hints addressing only one of these issues as well


----------



## rf10 (May 14, 2019)

I just tried to use Xrdp installed via a package on FreeBSD 12 Release version. I got it to the point where I could connect to the box via RDP client (I am using a beta version of Microsoft Remote Desktop on MacOS) and launch the basic session with xterm (configuration was provided in the package as an example). Unfortunately, the suggested approach of configuring `startwm.sh` did not work for Xmonad window manager (I just got a black screen), so after kicking it around for a couple of days I gave up. 

I could not figure out if the RDP package I installed was using Xvnc session, and not the libxorgrdp.


----------

