paidem / guacozy

Cozy guacamole-based remote-access solution
MIT License
175 stars 53 forks source link

SSH handshake failed connecting to WSL KALI #47

Open warlordattack opened 2 years ago

warlordattack commented 2 years ago

Hello i have a UPSTREAM_ERROR and "SSH handshake failed" when i try to connect to Kali linux inside WSL on Windows

-my guacozy is installd on a synology ds918+ nas inside docker -i try to connect to Linux Kali wich is running inside WSL2 in Windows

I routed my windows like this : netsh interface portproxy add v4tov4 listenport=2022 listenaddress=0.0.0.0 connectport=2022 connectaddress=172.24.176.217 where 172.24.176.217 is the WSL KALI ip Inside sshd_config in KALI i modified the like this : Port 2022 SyslogFacility AUTH LogLevel INFO PubkeyAuthentication yes PasswordAuthentication yes AllowUsers doge

TESTS Connexion from Powershell : OK OK : ssh -vvv doge@192.168.1.54 -p2022 OK : ssh -vvv doge@172.24.176.217 -p2022 OK : ssh doge@192.168.1.54 -p2022 OK : ssh doge@172.24.176.217 -p2022 sometimes it does not work, then i "sudo service ssh stop" on the WSL KALI then it works again

Connexion from Powershell example : OK PS C:\Users\alexe> ssh doge@172.24.176.217 -p2022 doge@172.24.176.217's password: Linux ant 5.10.60.1-microsoft-standard-WSL2 #1 SMP Wed Aug 25 23:20:18 UTC 2021 x86_64 hello wsl kali :) You have no mail. Last login: Sat Mar 5 22:51:43 2022 from 172.24.176.1 ┏━(Message from Kali developers) ┗━(Run: “touch ~/.hushlogin” to hide this message) ┌──(doge㉿ant)-[~] └─$ exit logout Connection to 172.24.176.217 closed. PS C:\Users\alexe> ssh doge@192.168.1.54 -p2022 doge@192.168.1.54's password: Linux ant 5.10.60.1-microsoft-standard-WSL2 #1 SMP Wed Aug 25 23:20:18 UTC 2021 x86_64 hello wsl kali :) You have no mail. Last login: Sat Mar 5 22:53:50 2022 from 172.24.176.1 ┏━(Message from Kali developers) ┗━(Run: “touch ~/.hushlogin” to hide this message) ┌──(doge㉿ant)-[~] └─$ exit logout Connection to 192.168.1.54 closed. PS C:\Users\alexe>

Connexion from vs-code hosted on the nas : OK abc@code:~/workspace$ ssh doge@192.168.1.54 -p2022 doge@192.168.1.54's password: Linux ant 5.10.60.1-microsoft-standard-WSL2 #1 SMP Wed Aug 25 23:20:18 UTC 2021 x86_64 hello wsl kali :) You have no mail. Last login: Sat Mar 5 22:51:54 2022 from 172.24.176.1 ┏━(Message from Kali developers) ┃ ┃ This is a minimal installation of Kali Linux, you likely ┃ want to install supplementary tools. Learn how: ┃ ⇒ https://www.kali.org/docs/troubleshooting/common-minimum-setup/ ┃ ┗━(Run: “touch ~/.hushlogin” to hide this message) ┌──(doge㉿ant)-[~] └─$

BUG : When i try to connect from guacozy (nas, docker) :

GUACD information (from DOZZLE) : today at 22:56:31guacd[7]: DEBUG: Error reading "select": Timeout while waiting for data on socket today at 22:56:33guacd[7]: INFO: Creating new client for protocol "ssh" today at 22:56:33guacd[7]: INFO: Connection ID is "$a76f3f71-cc7a-435d-8715-ef9942fa28b2" today at 22:56:33guacd[20325]: DEBUG: Processing instruction: size today at 22:56:33guacd[20325]: DEBUG: Processing instruction: audio today at 22:56:33guacd[20325]: DEBUG: Processing instruction: video today at 22:56:33guacd[20325]: DEBUG: Processing instruction: image today at 22:56:33guacd[20325]: DEBUG: Parameter "scrollback" omitted. Using default value of 1000. today at 22:56:33guacd[20325]: DEBUG: Parameter "font-name" omitted. Using default value of "monospace". today at 22:56:33guacd[20325]: DEBUG: Parameter "enable-sftp" omitted. Using default value of 0. today at 22:56:33guacd[20325]: DEBUG: Parameter "sftp-disable-download" omitted. Using default value of 0. today at 22:56:33guacd[20325]: DEBUG: Parameter "sftp-disable-upload" omitted. Using default value of 0. today at 22:56:33guacd[20325]: DEBUG: Parameter "read-only" omitted. Using default value of 0. today at 22:56:33guacd[20325]: DEBUG: Parameter "typescript-name" omitted. Using default value of "typescript". today at 22:56:33guacd[20325]: DEBUG: Parameter "create-typescript-path" omitted. Using default value of 0. today at 22:56:33guacd[20325]: DEBUG: Parameter "recording-name" omitted. Using default value of "recording". today at 22:56:33guacd[20325]: DEBUG: Parameter "recording-exclude-output" omitted. Using default value of 0. today at 22:56:33guacd[20325]: DEBUG: Parameter "recording-exclude-mouse" omitted. Using default value of 0. today at 22:56:33guacd[20325]: DEBUG: Parameter "recording-include-keys" omitted. Using default value of 0. today at 22:56:33guacd[20325]: DEBUG: Parameter "server-alive-interval" omitted. Using default value of 0. today at 22:56:33guacd[20325]: DEBUG: Parameter "backspace" omitted. Using default value of 127. today at 22:56:33guacd[20325]: DEBUG: Parameter "disable-copy" omitted. Using default value of 0. today at 22:56:33guacd[20325]: DEBUG: Client has not defined its protocol version. today at 22:56:33guacd[20325]: DEBUG: Successfully connected to host 192.168.1.54, port 2022 today at 22:56:33guacd[20325]: ERROR: SSH handshake failed. today at 22:56:34guacd[20325]: INFO: User "@dd606589-51b5-498b-bc45-7fcc05700c3f" disconnected (0 users remain) today at 22:56:34guacd[20325]: INFO: Last user of connection "$a76f3f71-cc7a-435d-8715-ef9942fa28b2" disconnected today at 22:56:34guacd[20325]: DEBUG: Requesting termination of client... today at 22:56:34guacd[20325]: DEBUG: Client terminated successfully. today at 22:56:34guacd[7]: INFO: Connection "$a76f3f71-cc7a-435d-8715-ef9942fa28b2" removed. today at 22:56:34guacd[7]: ERROR: Guacamole protocol violation. Perhaps the version of guacamole-client is incompatible with this version of guacd? today at 22:56:34guacd[7]: DEBUG: Error reading "select": Instruction read did not have expected opcode today at 22:56:34guacd[7]: WARNING: Guacamole handshake failed: Timed out today at 22:56:34guacd[7]: DEBUG: Error reading "select": Timeout while waiting for data on socket today at 22:56:34guacd[7]: WARNING: Guacamole handshake failed: Timed out today at 22:56:34guacd[7]: DEBUG: Error reading "select": Timeout while waiting for data on socket

WSL KALI information : ┌──(root㉿ant)-[/mnt/c/Users/alexe] └─# sudo service ssh stop Stopping OpenBSD Secure Shell server: sshd.

┌──(root㉿ant)-[/mnt/c/Users/alexe] └─# sudo service ssh start -d Starting OpenBSD Secure Shell server: sshddebug1: sshd version OpenSSH_8.8, OpenSSL 1.1.1m 14 Dec 2021 debug1: rexec_argv[0]='/usr/sbin/sshd' debug1: rexec_argv[1]='-d' debug1: Set /proc/self/oom_score_adj from 0 to -1000 debug1: Bind to port 2022 on 0.0.0.0. Server listening on 0.0.0.0 port 2022. debug1: Bind to port 2022 on ::. Server listening on :: port 2022. debug1: Server will not fork when running in debugging mode. debug1: rexec start in 5 out 5 newsock 5 pipe -1 sock 8 debug1: sshd version OpenSSH_8.8, OpenSSL 1.1.1m 14 Dec 2021 debug1: inetd sockets after dupping: 3, 3 Connection from 172.24.176.1 port 64316 on 172.24.176.217 port 2022 rdomain "" debug1: Local version string SSH-2.0-OpenSSH_8.8p1 Debian-1 debug1: Remote protocol version 2.0, remote software version libssh2_1.8.0 debug1: compat_banner: no match: libssh2_1.8.0 debug1: permanently_set_uid: 118/65534 [preauth] debug1: list_hostkey_types: rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519 [preauth] debug1: SSH2_MSG_KEXINIT sent [preauth] debug1: SSH2_MSG_KEXINIT received [preauth] debug1: kex: algorithm: diffie-hellman-group-exchange-sha256 [preauth] debug1: kex: host key algorithm: (no match) [preauth] Unable to negotiate with 172.24.176.1 port 64316: no matching host key type found. Their offer: ssh-rsa,ssh-dss [preauth] debug1: do_cleanup [preauth] debug1: monitor_read_log: child log fd closed debug1: do_cleanup debug1: Killing privsep child 18163 debug1: audit_event: unhandled event 12 failed! ┌──(root㉿ant)-[/mnt/c/Users/alexe] └─#

Help please :)

paidem commented 2 years ago

The first thing I would test - if you can connect to that port from synology. You can launch some other container which has SSH client installed or you can connecto just to synology via SSH and from there connecto to your Kali. The problem seems not a guacozy problem but a network connection problem.

On Sat, 5 Mar 2022 at 23:58, Alexey K. @.***> wrote:

Hello i have a UPSTREAM_ERROR and "SSH handshake failed" when i try to connect to Kali linux inside WSL on Windows

-my guacozy is installd on a synology ds918+ nas inside docker -i try to connect to Linux Kali wich is running inside WSL2 in Windows

I routed my windows like this : netsh interface portproxy add v4tov4 listenport=2022 listenaddress=0.0.0.0 connectport=2022 connectaddress=172.24.176.217 where 172.24.176.217 is the WSL KALI ip Inside sshd_config in KALI i modified the like this : Port 2022 SyslogFacility AUTH LogLevel INFO PubkeyAuthentication yes PasswordAuthentication yes AllowUsers doge

TESTS Connexion from Powershell : OK OK : ssh -vvv @. -p2022 OK : ssh -vvv @. -p2022 OK : ssh @. -p2022 OK : ssh @. -p2022 sometimes it does not work, then i "sudo service ssh stop" on the WSL KALI then it works again

Connexion from vs-code hosted on the nas : OK @.:~/workspace$ ssh @. -p2022 @.***'s password: Linux ant 5.10.60.1-microsoft-standard-WSL2 #1 https://github.com/paidem/guacozy/issues/1 SMP Wed Aug 25 23:20:18 UTC 2021 x86_64 hello wsl kali :) You have no mail. Last login: Sat Mar 5 22:51:54 2022 from 172.24.176.1 ┏━(Message from Kali developers) ┃ ┃ This is a minimal installation of Kali Linux, you likely ┃ want to install supplementary tools. Learn how: ┃ ⇒ https://www.kali.org/docs/troubleshooting/common-minimum-setup/ ┃ ┗━(Run: “touch /.hushlogin” to hide this message) ┌──(doge㉿ant)-[] └─$

BUG : When i try to connect from guacozy (nas, docker) :

GUACD information (from DOZZLE) : today at 22:56:31guacd[7]: DEBUG: Error reading "select": Timeout while waiting for data on socket today at 22:56:33guacd[7]: INFO: Creating new client for protocol "ssh" today at 22:56:33guacd[7]: INFO: Connection ID is "$a76f3f71-cc7a-435d-8715-ef9942fa28b2" today at 22:56:33guacd[20325]: DEBUG: Processing instruction: size today at 22:56:33guacd[20325]: DEBUG: Processing instruction: audio today at 22:56:33guacd[20325]: DEBUG: Processing instruction: video today at 22:56:33guacd[20325]: DEBUG: Processing instruction: image today at 22:56:33guacd[20325]: DEBUG: Parameter "scrollback" omitted. Using default value of 1000. today at 22:56:33guacd[20325]: DEBUG: Parameter "font-name" omitted. Using default value of "monospace". today at 22:56:33guacd[20325]: DEBUG: Parameter "enable-sftp" omitted. Using default value of 0. today at 22:56:33guacd[20325]: DEBUG: Parameter "sftp-disable-download" omitted. Using default value of 0. today at 22:56:33guacd[20325]: DEBUG: Parameter "sftp-disable-upload" omitted. Using default value of 0. today at 22:56:33guacd[20325]: DEBUG: Parameter "read-only" omitted. Using default value of 0. today at 22:56:33guacd[20325]: DEBUG: Parameter "typescript-name" omitted. Using default value of "typescript". today at 22:56:33guacd[20325]: DEBUG: Parameter "create-typescript-path" omitted. Using default value of 0. today at 22:56:33guacd[20325]: DEBUG: Parameter "recording-name" omitted. Using default value of "recording". today at 22:56:33guacd[20325]: DEBUG: Parameter "recording-exclude-output" omitted. Using default value of 0. today at 22:56:33guacd[20325]: DEBUG: Parameter "recording-exclude-mouse" omitted. Using default value of 0. today at 22:56:33guacd[20325]: DEBUG: Parameter "recording-include-keys" omitted. Using default value of 0. today at 22:56:33guacd[20325]: DEBUG: Parameter "server-alive-interval" omitted. Using default value of 0. today at 22:56:33guacd[20325]: DEBUG: Parameter "backspace" omitted. Using default value of 127. today at 22:56:33guacd[20325]: DEBUG: Parameter "disable-copy" omitted. Using default value of 0. today at 22:56:33guacd[20325]: DEBUG: Client has not defined its protocol version. today at 22:56:33guacd[20325]: DEBUG: Successfully connected to host 192.168.1.54, port 2022 today at 22:56:33guacd[20325]: ERROR: SSH handshake failed. today at 22:56:34guacd[20325]: INFO: User @.***" disconnected (0 users remain) today at 22:56:34guacd[20325]: INFO: Last user of connection "$a76f3f71-cc7a-435d-8715-ef9942fa28b2" disconnected today at 22:56:34guacd[20325]: DEBUG: Requesting termination of client... today at 22:56:34guacd[20325]: DEBUG: Client terminated successfully. today at 22:56:34guacd[7]: INFO: Connection "$a76f3f71-cc7a-435d-8715-ef9942fa28b2" removed. today at 22:56:34guacd[7]: ERROR: Guacamole protocol violation. Perhaps the version of guacamole-client is incompatible with this version of guacd? today at 22:56:34guacd[7]: DEBUG: Error reading "select": Instruction read did not have expected opcode today at 22:56:34guacd[7]: WARNING: Guacamole handshake failed: Timed out today at 22:56:34guacd[7]: DEBUG: Error reading "select": Timeout while waiting for data on socket today at 22:56:34guacd[7]: WARNING: Guacamole handshake failed: Timed out today at 22:56:34guacd[7]: DEBUG: Error reading "select": Timeout while waiting for data on socket

WSL KALI information : ┌──(root㉿ant)-[/mnt/c/Users/alexe] └─# sudo service ssh stop Stopping OpenBSD Secure Shell server: sshd.

┌──(root㉿ant)-[/mnt/c/Users/alexe] └─# sudo service ssh start -d Starting OpenBSD Secure Shell server: sshddebug1: sshd version OpenSSH_8.8, OpenSSL 1.1.1m 14 Dec 2021 debug1: private host key #0: ssh-rsa SHA256:CuYBGNu2B/1/WY4gLj7zy9IaJs2GZZAoOk0nwPnRaqE debug1: private host key #1 https://github.com/paidem/guacozy/issues/1: ecdsa-sha2-nistp256 SHA256:9k/UDzRrhIbGYqbMgKWqLxLxpijCXbK9gcE5hugrTfQ debug1: private host key #2 https://github.com/paidem/guacozy/issues/2: ssh-ed25519 SHA256:IFI4RTZJxyg0g5LZLzVxa9nv/h1m7DRFKYnGGcoX4gU debug1: rexec_argv[0]='/usr/sbin/sshd' debug1: rexec_argv[1]='-d' debug1: Set /proc/self/oom_score_adj from 0 to -1000 debug1: Bind to port 2022 on 0.0.0.0. Server listening on 0.0.0.0 port 2022. debug1: Bind to port 2022 on ::. Server listening on :: port 2022. debug1: Server will not fork when running in debugging mode. debug1: rexec start in 5 out 5 newsock 5 pipe -1 sock 8 debug1: sshd version OpenSSH_8.8, OpenSSL 1.1.1m 14 Dec 2021 debug1: private host key #0: ssh-rsa SHA256:CuYBGNu2B/1/WY4gLj7zy9IaJs2GZZAoOk0nwPnRaqE debug1: private host key #1 https://github.com/paidem/guacozy/issues/1: ecdsa-sha2-nistp256 SHA256:9k/UDzRrhIbGYqbMgKWqLxLxpijCXbK9gcE5hugrTfQ debug1: private host key #2 https://github.com/paidem/guacozy/issues/2: ssh-ed25519 SHA256:IFI4RTZJxyg0g5LZLzVxa9nv/h1m7DRFKYnGGcoX4gU debug1: inetd sockets after dupping: 3, 3 Connection from 172.24.176.1 port 64316 on 172.24.176.217 port 2022 rdomain "" debug1: Local version string SSH-2.0-OpenSSH_8.8p1 Debian-1 debug1: Remote protocol version 2.0, remote software version libssh2_1.8.0 debug1: compat_banner: no match: libssh2_1.8.0 debug1: permanently_set_uid: 118/65534 [preauth] debug1: list_hostkey_types: rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519 [preauth] debug1: SSH2_MSG_KEXINIT sent [preauth] debug1: SSH2_MSG_KEXINIT received [preauth] debug1: kex: algorithm: diffie-hellman-group-exchange-sha256 [preauth] debug1: kex: host key algorithm: (no match) [preauth] Unable to negotiate with 172.24.176.1 port 64316: no matching host key type found. Their offer: ssh-rsa,ssh-dss [preauth] debug1: do_cleanup [preauth] debug1: monitor_read_log: child log fd closed debug1: do_cleanup debug1: Killing privsep child 18163 debug1: audit_event: unhandled event 12 failed! ┌──(root㉿ant)-[/mnt/c/Users/alexe] └─#

Help please :)

— Reply to this email directly, view it on GitHub https://github.com/paidem/guacozy/issues/47, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOPIST6STKRKO3CF7RAEP3U6PKIPANCNFSM5QAGYZJA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- BR,

Pavel Paidem

warlordattack commented 2 years ago

I will test this, thank you.

Already found some problems on synology, had to do the right chmod on : -user folder -user/.ssh -user/.ssh/authorized_keys