liximomo / vscode-sftp

Super fast sftp/ftp extension for VS Code
MIT License
1.51k stars 267 forks source link

Timed out while waiting for handshake #613

Open JeffrySteegmans opened 5 years ago

JeffrySteegmans commented 5 years ago

When I try to connect with my synology nas (sftp) with config:

{ "name": "home-assistant", "protocol": "sftp", "host": "xxx.synology.me", "port": 22, "username": "xxxx", "password": "xxxx", "remotePath": "/docker/home-assistant", "connectTimeout": 3600, "secure" : true, "ignore": [ ".vscode", ".git" ] }

I get the following error:

[08-01 13:21:17] [trace] run command 'Upload File' [08-01 13:21:17] [trace] handle upload file for c:\Workspace\YAML\HASS.vscode\sftp.json [08-01 13:21:17] [debug] Local ident: 'SSH-2.0-ssh2js0.4.2' [08-01 13:21:17] [debug] Client: Trying xxxx.synology.me on port 22 ... [08-01 13:21:17] [debug] Client: Connected [08-01 13:21:17] [debug] Remote ident: 'SSH-2.0-OpenSSH_7.4' [08-01 13:21:17] [debug] Outgoing: Writing KEXINIT [08-01 13:21:17] [debug] DEBUG: Comparing KEXINITs ... [08-01 13:21:17] [debug] (local) KEX algorithms: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1 [08-01 13:21:17] [debug] (remote) KEX algorithms: curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521 [08-01 13:21:17] [debug] KEX algorithm: ecdh-sha2-nistp256 [08-01 13:21:17] [debug] (local) Host key formats: ssh-rsa,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521 [08-01 13:21:17] [debug] (remote) Host key formats: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519 [08-01 13:21:17] [debug] Host key format: ssh-rsa [08-01 13:21:17] [debug] (local) Client->Server ciphers: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm,aes128-gcm@openssh.com,aes256-gcm,aes256-gcm@openssh.com [08-01 13:21:17] [debug] (remote) Client->Server ciphers: aes128-ctr,aes128-gcm@openssh.com,aes192-ctr,aes256-ctr,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com [08-01 13:21:17] [debug] Client->Server Cipher: aes128-ctr [08-01 13:21:17] [debug] (local) Server->Client ciphers: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm,aes128-gcm@openssh.com,aes256-gcm,aes256-gcm@openssh.com [08-01 13:21:17] [debug] (remote) Server->Client ciphers: aes128-ctr,aes128-gcm@openssh.com,aes192-ctr,aes256-ctr,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com [08-01 13:21:17] [debug] Server->Client Cipher: aes128-ctr [08-01 13:21:17] [debug] (local) Client->Server HMAC algorithms: hmac-sha2-256,hmac-sha2-512,hmac-sha1 [08-01 13:21:17] [debug] (remote) Client->Server HMAC algorithms: hmac-sha1,hmac-sha1-etm@openssh.com,hmac-sha2-256,hmac-sha2-256-etm@openssh.com,hmac-sha2-512,hmac-sha2-512-etm@openssh.com,umac-128-etm@openssh.com,umac-128@openssh.com,umac-64-etm@openssh.com,umac-64@openssh.com [08-01 13:21:17] [debug] Client->Server HMAC algorithm: hmac-sha2-256 [08-01 13:21:17] [debug] (local) Server->Client HMAC algorithms: hmac-sha2-256,hmac-sha2-512,hmac-sha1 [08-01 13:21:17] [debug] (remote) Server->Client HMAC algorithms: hmac-sha1,hmac-sha1-etm@openssh.com,hmac-sha2-256,hmac-sha2-256-etm@openssh.com,hmac-sha2-512,hmac-sha2-512-etm@openssh.com,umac-128-etm@openssh.com,umac-128@openssh.com,umac-64-etm@openssh.com,umac-64@openssh.com [08-01 13:21:17] [debug] Server->Client HMAC algorithm: hmac-sha2-256 [08-01 13:21:17] [debug] (local) Client->Server compression algorithms: none,zlib@openssh.com,zlib [08-01 13:21:17] [debug] (remote) Client->Server compression algorithms: none,zlib@openssh.com [08-01 13:21:17] [debug] Client->Server compression algorithm: none [08-01 13:21:17] [debug] (local) Server->Client compression algorithms: none,zlib@openssh.com,zlib [08-01 13:21:17] [debug] (remote) Server->Client compression algorithms: none,zlib@openssh.com [08-01 13:21:17] [debug] Server->Client compression algorithm: none [08-01 13:21:17] [debug] Outgoing: Writing KEXECDH_INIT [08-01 13:21:17] [debug] DEBUG: Checking host key format [08-01 13:21:17] [debug] DEBUG: Checking signature format [08-01 13:21:17] [debug] DEBUG: Verifying host fingerprint [08-01 13:21:17] [debug] DEBUG: Host accepted by default (no verification) [08-01 13:21:17] [debug] DEBUG: Verifying signature [08-01 13:21:17] [debug] Outgoing: Writing NEWKEYS [08-01 13:21:17] [debug] Outgoing: Writing SERVICE_REQUEST (ssh-userauth) [08-01 13:21:17] [debug] Outgoing: Writing USERAUTH_REQUEST (none) [08-01 13:21:17] [debug] Client: none auth failed [08-01 13:21:17] [debug] Outgoing: Writing USERAUTH_REQUEST (password) [08-01 13:21:20] [debug] Outgoing: Writing DISCONNECT (BY_APPLICATION) [08-01 13:21:20] [error] Error: [steegmans.synology.me]: Timed out while waiting for handshake at Client.module.exports._connectSSHClient.e.on.on.e (C:\Users\jeffry.steegmans.vscode\extensions\liximomo.sftp-1.12.7\dist\extension.js:70:107136) at Client.emit (events.js:187:15) at Timeout._onTimeout (C:\Users\jeffry.steegmans.vscode\extensions\liximomo.sftp-1.12.7\node_modules\ssh2\lib\client.js:692:14) at ontimeout (timers.js:425:11) at tryOnTimeout (timers.js:289:5) at listOnTimeout (timers.js:252:5) at Timer.processTimers (timers.js:212:10)

Is this a known issue?

liximomo commented 5 years ago

Check connection of your server. Try a larger connectTimeout value.

webternals commented 5 years ago

I am getting the same thing. Most times with other programs there is a known host file or at the least an interactive button you can hit to add the host to the list of known host. I feel like the issue is that is is trying to determine the status of the host but the plugin is not asking for you to confirm the host.

BlackGrizzly commented 5 years ago

I have the same problem. Sometimes connected, but most often not

IProudNoob commented 5 years ago

I have this problem too

disapamok commented 5 years ago

I am having the same issue

dziku86 commented 4 years ago

I have the same issue on 'sftp' protocol. There is no problem whatsoever when connecting through regular 'ftp'.

SOLVED

"remotePath" should be different on regular ftp and sftp, e.g.: ftp: /www/folder, sftp: /home/username/www/folder.

Changing path to full on sftp solved the problem for me.

See #356

Spirituss commented 4 years ago

Have the same problem. I use absolute path, not a symlink. Can't connect to my syno. Is any real treatment?

filopd commented 4 years ago

Hi @liximomo

Do we have any workaround for this issue? Also, changelog, versions not in sync.

Spirituss commented 4 years ago

@filopd The workaround is to set "connectTimeout": 40000 into sftp.json.

beto-aveiga commented 3 years ago

In my case, my ISP (Netlife, EC) sometimes blocks connections to port 22, sometimes not. In fact, I was connected a few minutes ago, then suddenly, I wasn't able to connect. Then I tried to connect from the terminal through SSH and I couldn't. So, test If you can connect with ssh, if it is not possible, then probably it is not this plugin's fault.

Fortunately I already had a VPN service because I have had these kind of issues before. I'm using VPN Express, but any VPN will work for you. I'm not endorsing this particular VPN, just saying it worked for me.

I don't think changing the timeout from 20000 to 40000 will do the trick, 20000 is enough waiting for most cases.

conrad96 commented 3 years ago

i've tried most of the solutions above, the timeout error is still there. i dont think i have a connection problem coz i can ssh into the server . so any workaround this problem is greatly appreciated .

mredodos commented 2 years ago

i cant connect and the log return Timed out while waiting for handshake

faydanube commented 2 years ago

In my case, my ISP (Netlife, EC) sometimes blocks connections to port 22, sometimes not. In fact, I was connected a few minutes ago, then suddenly, I wasn't able to connect. Then I tried to connect from the terminal through SSH and I couldn't. So, test If you can connect with ssh, if it is not possible, then probably it is not this plugin's fault.

Fortunately I already had a VPN service because I have had these kind of issues before. I'm using VPN Express, but any VPN will work for you. I'm not endorsing this particular VPN, just saying it worked for me.

I don't think changing the timeout from 20000 to 40000 will do the trick, 20000 is enough waiting for most cases.

I'm the opposite, after turning on vpn it times out.

image image

What do I need to pay attention to in terms of vpn settings?

TORAHTECH commented 2 years ago

TORAH TECH: ### port number conflict In my case: Close down the torrent download application, which uses port #s. If SFTP works one moment and the next times out of the handshake and won't connect to remote server then: Check any programs that are simultaneously running that you know uses PORT # for services. Hope this helps, Shalom! Ben Yahceph July (hot as Hell) 2022` around 12:30 PM port number conflict

arilishu commented 2 years ago

my problem is similar to yours. In my case, on FileZilla it is working just when Encryption is set to: "Use explicit FTP over TLS is available".

I can't find, or I don't know the way to make it works.

Any idea?

faydanube commented 2 years ago

my problem is similar to yours. In my case, on FileZilla it is working just when Encryption is set to: "Use explicit FTP over TLS is available".

I can't find, or I don't know the way to make it works.

Any idea?

I have not been able to solve the problem, and continue to pay attention to. I'm having to switch vpn on and off very frequently to get it to barely work.

rayr007 commented 2 years ago

I've run into an issue where I have 2 hosts (nearly identical VMs) and this plugin works with one but not the other. I've compared the output of just connecting using ssh with debug3 and everything is the same. No idea why one host gets a handshake timeout while the other is just fine.

rayr007 commented 2 years ago

Actually, I found my issue. I use a ProxyCommand in the ssh config file to do a hop through a host. The server that worked with this plugin had it's config wrong and was not requiring the hop while the server that isn't working is properly configured to require the hop. So in the end, the bug I've run into is that this plugin does NOT respect configuration in the ~/.ssh/config file even if I specify it.

For reference, my config file:

Host *.domain.com
    User hostUserName
    ProxyCommand ssh proxyUserName@proxyHost nc %h %p