cea-sec / sanzu

Graphical remote desktop solution
GNU General Public License v3.0
177 stars 27 forks source link

Unable to connect to Windows server from Linux client #241

Closed roland65 closed 8 months ago

roland65 commented 8 months ago

Hi,

I installed sanzu server in Windows 10 20H2 (running in a VM, Windows Defender disabled) using the command:

sanzu_server --config sanzu.toml

(the file sanzu.toml I used is the one you give).

Then in Linux (Ubuntu 22.04 with the package sanzu-client_0.1.4_amd64.deb installed) I issued the command:

sanzu_client 192.168.122.215 1122

and got the errors:

[2023-11-16T15:01:48.929045572Z ERROR sanzu_client] Client error [2023-11-16T15:01:48.929060976Z ERROR sanzu_client] - due to Error in tcp server connection "192.168.122.215:1122" [2023-11-16T15:01:48.929065707Z ERROR sanzu_client] - due to Connection refused (os error 111)

What am I doing wrong? Is there some login/password to pass to the server?

serpilliere commented 8 months ago

Hi @roland65 Can you:

As explained in the error, this is not a login error, but a filtering problem. Is your VM is natted or bridged to the host? What is you VM network configuration?

roland65 commented 8 months ago

Hi, thanks for the answer. On the Windows server, I use no firewall (Windows Defender disabled). The Windows server (Windows 10) is running within a kvm/qemu VM, with a natted network.

serpilliere commented 8 months ago

@roland65 I think this is a network problem, not a sanzu related issue. Do you manage to ping the windows guest ip from the linux host?

roland65 commented 8 months ago

I can ping the Windows server. I also tried to open and RDP session on the Windows server, from a Linux xfreerdp client and it works.

On the Windows server, do I need some other dependency than ffmpeg?

roland65 commented 8 months ago

I tried to do the reverse, that is connecting to a Linux sanzu server using a sanzu client from the Windows VM.

On the Linux server side (Ubuntu 22.04) I did:

Xvfb :100 -screen 0 1920x1080x24 DISPLAY=:100 xfwm4 DISPLAY=:100 sanzu_server --config sanzu.toml

On the Windows client, I did:

cd c:\ffmpeg\bin sanzu_client.exe 192.168.123.1 1122

and I received the following error:

c:\ffmpeg\bin>[2023-11-22T13:24:19.080439800Z ERROR sanzu_client] Client error [2023-11-22T13:24:19.080732400Z ERROR sanzu_client] - due to Error in tcp server connection "192.168.123.1:1122" [2023-11-22T13:24:19.085084400Z ERROR sanzu_client] - due to Aucune connexion n’a pu être établie car l’ordinateur cible l’a expressément refusée. (os error 10061)

On the Linux server, I did:

netstat -na | grep :1122

and I got:

tcp 0 0 127.0.0.1:1122 0.0.0.0:* LISTEN

so it seems the sanzu server is indeed listening, but there is some communication problem...

Any idea?

roland65 commented 8 months ago

I also tried with a VM in VirtualBox and host only networking: same issue...

serpilliere commented 8 months ago

The default listening address is 127.0.0.1 (so only local listening) add the option:

sanzu_server  --config sanzu.toml --address 0.0.0.0

Does it solve the problem?

roland65 commented 8 months ago

Hi serpilliere,

thanks for the tip, now I can connect!

However, in the Windows server I get tons of errors like this:

[2023-11-27T08:43:57.257719400Z ERROR sanzu::server_windows] acquirenextframe -2005270489 [2023-11-27T08:43:57.259290800Z ERROR sanzu::server_windows] - due to wait timeout

and in the client I get one error:

[2023-11-27T08:45:06.751261742Z ERROR sanzu_client] Client error [2023-11-27T08:45:06.751284157Z ERROR sanzu_client] - due to Error in send client events

And the rendering is slow...

Any idea?

serpilliere commented 8 months ago

Hi @roland65 If I understand correctly, the sanzu server in on a windows Virtual Machine. As said in the readme, sanzu uses video compression to encode the stream. So if the serveur is in a virtual machine, maybe the virtual machine doesn't have access to hardware capabilities, which may give non reactive behavior.

In your case, you didn't provide specific encoders on the command line, so sanzu_server uses libx264 by default for encoding. This encoding will be done on the cpu in the virtual machine which may be slow.

One solution to this is doing the following steps (if it's acceptable from your point of view):

This has the advantage to compress video on the host, so if you don't trust your VM, this is interesting as the video stream doesn't come from the guest but from the host in this case.

If you want to try this, the steps are explained in an old PR here: https://github.com/cea-sec/sanzu/pull/113

serpilliere commented 8 months ago

Another point: Can you confirm you compiled using "--release" ?

roland65 commented 8 months ago

In fact, I used the release you provide. I'll test your solution but for now I have a question: I tried to launch the server in seamless mode, like this (in Windows):

sanzu_server -x --config sanzu.toml --address 192.128.xxx.yyy

but on the client side (Linux) I didn't find a way to launch an application. How do you do that?

serpilliere commented 8 months ago

Hi @roland65 That's a problem in seamless environment: You need at least one remote window opened, for example by auto launching firefox on login (or a terminal)

serpilliere commented 8 months ago

Note that for now, the sanzu windows server is not really optimized regarding to linux one.

serpilliere commented 8 months ago

As the connection problem is resolved, I am closing the issue