SchoofsKelvin / vscode-sshfs

Extension for Visual Studio Code: File system provider using SSH
GNU General Public License v3.0
549 stars 36 forks source link

I can access to remote server by terminal , but sshfs report a error #311

Open mikev4 opened 3 years ago

mikev4 commented 3 years ago

I can access to remote server via terminal , but sshfs

图片

via terminal login successfully

图片

myconfig

图片

it too slow that I spend about 30s connect to remote server by terminal , I guess it is timeout via sshfs plugin? its there any params can config connection timeout? look likeconnectionTimeout maybe thx for your help

error info

图片
SchoofsKelvin commented 3 years ago

This issue would be easier to solve with debug logs, so please follow these steps:

mikev4 commented 3 years ago

@SchoofsKelvin this is my log

[INFO]    Loading configurations...
[INFO]    Calculated config flags: {"debug_ssh2":[null,"Global Settings"]}
[DEBUG]     Added configuration sshconfig from [1]
[INFO]    Found 1 configurations
[INFO]    Extension activated, version 1.24.0, mode 2
[INFO]    Command received to open a terminal for FileSystemConfig(sshconfig)
[INFO]    [createConnection(sshconfig,config)] Creating a new connection for 'sshconfig'
[INFO]    Calculating actual config
[DEBUG]     Final configuration:
{
    "name": "sshconfig",
    "host": "172.17.0.2",
    "root": "/",
    "username": "root",
    "password": "<censored>",
    "_location": 1,
    "_locations": [
        1
    ],
    "_calculated": {
        "name": "sshconfig",
        "host": "172.17.0.2",
        "root": "/",
        "username": "root",
        "password": "<censored>",
        "_location": 1,
        "_locations": [
            1
        ]
    },
    "port": 22
}
[INFO]    [createSocket(sshconfig)] Creating socket
[DEBUG]   [createSocket(sshconfig)] Connecting to 172.17.0.2:22
[DEBUG]   [ssh2(sshconfig)] DEBUG: Local ident: 'SSH-2.0-ssh2js0.4.10'
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: IN_INIT
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: IN_GREETING
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: IN_HEADER
[DEBUG]   [ssh2(sshconfig)] DEBUG: Remote ident: 'SSH-2.0-OpenSSH_7.4'
[DEBUG]   [ssh2(sshconfig)] DEBUG: Outgoing: Writing KEXINIT
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: IN_PACKETBEFORE (expecting 8)
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: IN_PACKET
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: pktLen:1276,padLen:10,remainLen:1272
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: IN_PACKETDATA
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: IN_PACKETDATAAFTER, packet: KEXINIT
[DEBUG]   [ssh2(sshconfig)] DEBUG: Comparing KEXINITs ...
[DEBUG]   [ssh2(sshconfig)] DEBUG: (local) KEX algorithms: curve25519-sha256@libssh.org,curve25519-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha1
[DEBUG]   [ssh2(sshconfig)] DEBUG: (remote) KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
[DEBUG]   [ssh2(sshconfig)] DEBUG: KEX algorithm: curve25519-sha256@libssh.org
[DEBUG]   [ssh2(sshconfig)] DEBUG: (local) Host key formats: ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa
[DEBUG]   [ssh2(sshconfig)] DEBUG: (remote) Host key formats: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
[DEBUG]   [ssh2(sshconfig)] DEBUG: Host key format: ssh-ed25519
[DEBUG]   [ssh2(sshconfig)] DEBUG: (local) Client->Server ciphers: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm,aes128-gcm@openssh.com,aes256-gcm,aes256-gcm@openssh.com
[DEBUG]   [ssh2(sshconfig)] DEBUG: (remote) Client->Server ciphers: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc,blowfish-cbc,cast128-cbc,3des-cbc
[DEBUG]   [ssh2(sshconfig)] DEBUG: Client->Server Cipher: aes128-ctr
[DEBUG]   [ssh2(sshconfig)] DEBUG: (local) Server->Client ciphers: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm,aes128-gcm@openssh.com,aes256-gcm,aes256-gcm@openssh.com
[DEBUG]   [ssh2(sshconfig)] DEBUG: (remote) Server->Client ciphers: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc,blowfish-cbc,cast128-cbc,3des-cbc
[DEBUG]   [ssh2(sshconfig)] DEBUG: Server->Client Cipher: aes128-ctr
[DEBUG]   [ssh2(sshconfig)] DEBUG: (local) Client->Server HMAC algorithms: hmac-sha2-256,hmac-sha2-512,hmac-sha1
[DEBUG]   [ssh2(sshconfig)] DEBUG: (remote) Client->Server HMAC algorithms: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
[DEBUG]   [ssh2(sshconfig)] DEBUG: Client->Server HMAC algorithm: hmac-sha2-256
[DEBUG]   [ssh2(sshconfig)] DEBUG: (local) Server->Client HMAC algorithms: hmac-sha2-256,hmac-sha2-512,hmac-sha1
[DEBUG]   [ssh2(sshconfig)] DEBUG: (remote) Server->Client HMAC algorithms: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
[DEBUG]   [ssh2(sshconfig)] DEBUG: Server->Client HMAC algorithm: hmac-sha2-256
[DEBUG]   [ssh2(sshconfig)] DEBUG: (local) Client->Server compression algorithms: none,zlib@openssh.com,zlib
[DEBUG]   [ssh2(sshconfig)] DEBUG: (remote) Client->Server compression algorithms: none,zlib@openssh.com
[DEBUG]   [ssh2(sshconfig)] DEBUG: Client->Server compression algorithm: none
[DEBUG]   [ssh2(sshconfig)] DEBUG: (local) Server->Client compression algorithms: none,zlib@openssh.com,zlib
[DEBUG]   [ssh2(sshconfig)] DEBUG: (remote) Server->Client compression algorithms: none,zlib@openssh.com
[DEBUG]   [ssh2(sshconfig)] DEBUG: Server->Client compression algorithm: none
[DEBUG]   [ssh2(sshconfig)] DEBUG: Outgoing: Writing KEXECDH_INIT
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: IN_PACKETBEFORE (expecting 8)
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: IN_PACKET
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: pktLen:188,padLen:8,remainLen:184
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: IN_PACKETDATA
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: IN_PACKETDATAAFTER, packet: KEXECDH_REPLY
[DEBUG]   [ssh2(sshconfig)] DEBUG: Checking host key format
[DEBUG]   [ssh2(sshconfig)] DEBUG: Checking signature format
[DEBUG]   [ssh2(sshconfig)] DEBUG: Verifying host fingerprint
[DEBUG]   [ssh2(sshconfig)] DEBUG: Host accepted by default (no verification)
[DEBUG]   [ssh2(sshconfig)] DEBUG: Verifying signature
[DEBUG]   [ssh2(sshconfig)] DEBUG: Outgoing: Writing NEWKEYS
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: IN_PACKETBEFORE (expecting 8)
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: IN_PACKET
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: pktLen:12,padLen:10,remainLen:8
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: IN_PACKETDATA
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: IN_PACKETDATAAFTER, packet: NEWKEYS
[DEBUG]   [ssh2(sshconfig)] DEBUG: Outgoing: Writing SERVICE_REQUEST (ssh-userauth)
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: IN_PACKETBEFORE (expecting 16)
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: IN_PACKET
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: Decrypting
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: pktLen:28,padLen:10,remainLen:16
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: IN_PACKETDATA
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: Decrypting
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: HMAC size:32
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: IN_PACKETDATAVERIFY
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: Verifying MAC
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: IN_PACKETDATAAFTER, packet: SERVICE_ACCEPT
[DEBUG]   [ssh2(sshconfig)] DEBUG: Outgoing: Writing USERAUTH_REQUEST (none)
[DEBUG]   [ssh2(sshconfig)] DEBUG: Parser: IN_PACKETBEFORE (expecting 16)
[ERROR]   [createSSH(sshconfig)] Error: Timed out while waiting for handshake
JSON: {"level":"client-timeout"}
Error: Timed out while waiting for handshake
    at Timeout._onTimeout (/home/coder/.local/share/code-server/extensions/kelvin.vscode-sshfs-1.24.0/dist/14f8.extension.js:1:257524)
    at listOnTimeout (internal/timers.js:557:17)
    at processTimers (internal/timers.js:500:7)
Logged at:
    at T.emit (events.js:400:28)
    at Timeout._onTimeout (/home/coder/.local/share/code-server/extensions/kelvin.vscode-sshfs-1.24.0/dist/14f8.extension.js:1:257602)
    at listOnTimeout (internal/timers.js:557:17)
    at processTimers (internal/timers.js:500:7)
Reported by logger createSSH(sshconfig)
[ERROR]   Error while creating terminal:
Error: Timed out while waiting for handshake
JSON: {"level":"client-timeout"}
Error: Timed out while waiting for handshake
    at Timeout._onTimeout (/home/coder/.local/share/code-server/extensions/kelvin.vscode-sshfs-1.24.0/dist/14f8.extension.js:1:257524)
    at listOnTimeout (internal/timers.js:557:17)
    at processTimers (internal/timers.js:500:7)
Logged at:
    at m.commandTerminal (/home/coder/.local/share/code-server/extensions/kelvin.vscode-sshfs-1.24.0/dist/extension.js:11:26256)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async _executeContributedCommand (/usr/lib/code-server/vendor/modules/code-oss-dev/out/vs/workbench/services/extensions/node/extensionHostProcess.js:94:110871)
SchoofsKelvin commented 3 years ago

Does it take a long time when you authenticate using ssh or similar, e.g. by not using the extension?

I'll have to check the source code of the ssh2 library in detail to check something, but my first idea looking at your log is that your sshd server seems to not respond to a none authentication request? I'm not sure if you've configured anything regarding this or whether your server is busy querying some authentication data. Perhaps the sshd logs (with a debug log level) might tell you more (bit of a security risk to post those) as to what's happening after it receives the authentication request.

In the meantime, I'll see about creating a build of the extension with none disabled. Pretty sure the ssh2 library can be coerced to skip that.

SchoofsKelvin commented 3 years ago

Could you try out the .vsix from the latest build here? It'll try password > agent > publickey (aka privateKey) > keyboard-interactive > none, in that order, skipping the ones it can't do (e.g. password without a password set). If the issue is with your server mishandling none, this build should fix your issue and give me an idea of how to properly solve it for public release.