publickey auth fails in ssh2, but works from command line
I am try to connect to a DigitalOcean droplet with ssh2.
$ ssh -V
OpenSSH_7.9p1, LibreSSL 2.7.3
$ node --version
v15.0.1
$ yarn info ssh2
0.8.9
Here's my code:
let conn = new ssh2.Client()
return new Promise((resolve, reject) => {
conn.on('ready', () => {
conn.exec(cmd, (err, stream) => {
if (err) {
reject(err)
}
stream.on('close', (code, signal) => {
if (code !== 0) {
reject(code)
}
conn.end()
resolve(code)
}).stderr.on('data', (data) => {
reject(data)
})
})
}).connect({
host: xxx.xxx.xxx.xxx,
port: 22,
username: 'root',
privateKey: fs.readFileSync('/Users/<me>/.ssh/id_rsa'),
debug: (s) => {console.log(s)}
})
})
ssh2 fails with the following log:
DEBUG: Local ident: 'SSH-2.0-ssh2js0.4.10'
DEBUG: Client: Trying localhost on port 22 ...
DEBUG: Client: Connected
DEBUG: Parser: IN_INIT
DEBUG: Parser: IN_GREETING
DEBUG: Parser: IN_HEADER
DEBUG: Remote ident: 'SSH-2.0-OpenSSH_7.9'
DEBUG: Outgoing: Writing KEXINIT
DEBUG: Parser: IN_PACKETBEFORE (expecting 8)
DEBUG: Parser: IN_PACKET
DEBUG: Parser: pktLen:1076,padLen:6,remainLen:1072
DEBUG: Parser: IN_PACKETDATA
DEBUG: Parser: IN_PACKETDATAAFTER, packet: KEXINIT
DEBUG: Comparing KEXINITs ...
DEBUG: (local) KEX algorithms: [email protected],curve25519-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha
256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha1
DEBUG: (remote) KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sh
a512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1
DEBUG: KEX algorithm: [email protected]
DEBUG: (local) Host key formats: ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa
DEBUG: (remote) Host key formats: rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519
DEBUG: Host key format: ssh-ed25519
DEBUG: (local) Client->Server ciphers: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm,[email protected],aes256-gcm,[email protected]
DEBUG: (remote) Client->Server ciphers: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
DEBUG: Client->Server Cipher: aes128-ctr
DEBUG: (local) Server->Client ciphers: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm,[email protected],aes256-gcm,[email protected]
DEBUG: (remote) Server->Client ciphers: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
DEBUG: Server->Client Cipher: aes128-ctr
DEBUG: (local) Client->Server HMAC algorithms: hmac-sha2-256,hmac-sha2-512,hmac-sha1
DEBUG: (remote) Client->Server HMAC algorithms: [email protected],[email protected],[email protected],[email protected],[email protected],umac-64@openssh
.com,[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
DEBUG: Client->Server HMAC algorithm: hmac-sha2-256
DEBUG: (local) Server->Client HMAC algorithms: hmac-sha2-256,hmac-sha2-512,hmac-sha1
DEBUG: (remote) Server->Client HMAC algorithms: [email protected],[email protected],[email protected],[email protected],[email protected],umac-64@openssh
.com,[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
DEBUG: Server->Client HMAC algorithm: hmac-sha2-256
DEBUG: (local) Client->Server compression algorithms: none,[email protected],zlib
DEBUG: (remote) Client->Server compression algorithms: none,[email protected]
DEBUG: Client->Server compression algorithm: none
DEBUG: (local) Server->Client compression algorithms: none,[email protected],zlib
DEBUG: (remote) Server->Client compression algorithms: none,[email protected]
DEBUG: Server->Client compression algorithm: none
DEBUG: Outgoing: Writing KEXECDH_INIT
DEBUG: Parser: IN_PACKETBEFORE (expecting 8)
DEBUG: Parser: IN_PACKET
DEBUG: Parser: pktLen:188,padLen:8,remainLen:184
DEBUG: Parser: IN_PACKETDATA
DEBUG: Parser: IN_PACKETDATAAFTER, packet: KEXECDH_REPLY
DEBUG: Checking host key format
DEBUG: Checking signature format
DEBUG: Verifying host fingerprint
DEBUG: Host accepted by default (no verification)
DEBUG: Verifying signature
DEBUG: Outgoing: Writing NEWKEYS
DEBUG: Parser: IN_PACKETBEFORE (expecting 8)
DEBUG: Parser: IN_PACKET
DEBUG: Parser: pktLen:12,padLen:10,remainLen:8
DEBUG: Parser: IN_PACKETDATA
DEBUG: Parser: IN_PACKETDATAAFTER, packet: NEWKEYS
DEBUG: Outgoing: Writing SERVICE_REQUEST (ssh-userauth)
DEBUG: Parser: IN_PACKETBEFORE (expecting 16)
DEBUG: Parser: IN_PACKET
DEBUG: Parser: Decrypting
DEBUG: Parser: pktLen:28,padLen:10,remainLen:16
DEBUG: Parser: IN_PACKETDATA
DEBUG: Parser: Decrypting
DEBUG: Parser: HMAC size:32
DEBUG: Parser: IN_PACKETDATAVERIFY
DEBUG: Parser: Verifying MAC
DEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)
DEBUG: Parser: IN_PACKETDATAAFTER, packet: SERVICE_ACCEPT
DEBUG: Outgoing: Writing USERAUTH_REQUEST (none)
DEBUG: Parser: IN_PACKETBEFORE (expecting 16)
DEBUG: Parser: IN_PACKET
DEBUG: Parser: Decrypting
DEBUG: Parser: pktLen:60,padLen:14,remainLen:48
DEBUG: Parser: IN_PACKETDATA
DEBUG: Parser: Decrypting
DEBUG: Parser: HMAC size:32
DEBUG: Parser: IN_PACKETDATAVERIFY
DEBUG: Parser: Verifying MAC
DEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)
DEBUG: Parser: IN_PACKETDATAAFTER, packet: USERAUTH_FAILURE
DEBUG: Client: none auth failed
DEBUG: Outgoing: Writing USERAUTH_REQUEST (publickey -- check)
DEBUG: Parser: IN_PACKETBEFORE (expecting 16)
DEBUG: Parser: IN_PACKET
DEBUG: Parser: Decrypting
DEBUG: Parser: pktLen:60,padLen:14,remainLen:48
DEBUG: Parser: IN_PACKETDATA
DEBUG: Parser: Decrypting
DEBUG: Parser: HMAC size:32
DEBUG: Parser: IN_PACKETDATAVERIFY
DEBUG: Parser: Verifying MAC
DEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)
DEBUG: Parser: IN_PACKETDATAAFTER, packet: USERAUTH_FAILURE
DEBUG: Client: publickey auth failed
node:events:304
throw er; // Unhandled 'error' event
^
Error: All configured authentication methods failed
...
Emitted 'error' event on Client instance at:
at doNextAuth (.../node_modules/ssh2/lib/client.js:415:12)
at tryNextAuth (.../node_modules/ssh2/lib/client.js:484:5)
[... lines matching original stack trace ...]
at Socket.ondata (node:internal/streams/readable:715:22) {
level: 'client-authentication'
}
And here's what ssh -vvv [email protected] echo hello shows me:
OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/<me>/.ssh/config
debug1: /Users/<me>/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: /etc/ssh/ssh_config line 52: Applying options for *
debug2: resolve_canonicalize: hostname xxx.xxx.xxx.xxx is address
debug2: ssh_connect_direct
debug1: Connecting to xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx] port 22.
debug1: Connection established.
debug1: identity file /Users/<me>/.ssh/id_rsa type 0
debug1: identity file /Users/<me>/.ssh/id_rsa-cert type -1
debug1: identity file /Users/<me>/.ssh/id_dsa type -1
debug1: identity file /Users/<me>/.ssh/id_dsa-cert type -1
debug1: identity file /Users/<me>/.ssh/id_ecdsa type -1
debug1: identity file /Users/<me>/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/<me>/.ssh/id_ed25519 type -1
debug1: identity file /Users/<me>/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/<me>/.ssh/id_xmss type -1
debug1: identity file /Users/<me>/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2p1 Ubuntu-4ubuntu0.1
debug1: match: OpenSSH_8.2p1 Ubuntu-4ubuntu0.1 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to xxx.xxx.xxx.xxx:22 as 'root'
debug3: hostkeys_foreach: reading file "/Users/<me>/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /Users/<me>/.ssh/known_hosts:231
debug3: load_hostkeys: loaded 1 keys from xxx.xxx.xxx.xxx
debug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c
debug2: host key algorithms: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],[email protected],[email protected],ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected],zlib
debug2: compression stoc: none,[email protected],zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256
debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected]
debug2: compression stoc: none,[email protected]
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:TfXJgCVPy6XMqj+1lMjKjp0s9xtDxAeSzrKX/0BFwj0
debug3: hostkeys_foreach: reading file "/Users/<me>/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /Users/<me>/.ssh/known_hosts:231
debug3: load_hostkeys: loaded 1 keys from xxx.xxx.xxx.xxx
debug1: Host 'xxx.xxx.xxx.xxx' is known and matches the ECDSA host key.
debug1: Found key in /Users/<me>/.ssh/known_hosts:231
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey after 134217728 blocks
debug1: Will attempt key: /Users/<me>/.ssh/id_rsa RSA SHA256:DMI9zKrH0iUZIxI0c1Wy6Hgv9i025lAZJ5L0+Xmhf4M
debug1: Will attempt key: /Users/<me>/.ssh/id_dsa
debug1: Will attempt key: /Users/<me>/.ssh/id_ecdsa
debug1: Will attempt key: /Users/<me>/.ssh/id_ed25519
debug1: Will attempt key: /Users/<me>/.ssh/id_xmss
debug2: pubkey_prepare: done
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,[email protected],ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected]>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey
debug3: start over, passed a different list publickey
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/<me>/.ssh/id_rsa RSA SHA256:DMI9zKrH0iUZIxI0c1Wy6Hgv9i025lAZJ5L0+Xmhf4M
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 60
debug1: Server accepts key: /Users/<me>/.ssh/id_rsa RSA SHA256:DMI9zKrH0iUZIxI0c1Wy6Hgv9i025lAZJ5L0+Xmhf4M
debug3: sign_and_send_pubkey: RSA SHA256:DMI9zKrH0iUZIxI0c1Wy6Hgv9i025lAZJ5L0+Xmhf4M
debug3: sign_and_send_pubkey: signing using rsa-sha2-512
debug3: send packet: type 50
debug3: receive packet: type 52
debug1: Authentication succeeded (publickey).
Authenticated to xxx.xxx.xxx.xxx ([xxx.xxx.xxx.xxx]:22).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting [email protected]
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: network
debug3: receive packet: type 80
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug3: receive packet: type 4
debug1: Remote: /root/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug3: receive packet: type 4
debug1: Remote: /root/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug3: receive packet: type 91
debug2: channel_input_open_confirmation: channel 0: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: ssh_packet_set_tos: set IP_TOS 0x20
debug2: client_session2_setup: id 0
debug1: Sending environment.
debug3: Ignored env LESS_TERMCAP_mb
debug3: Ignored env TERM_PROGRAM
debug3: Ignored env LESS_TERMCAP_md
debug3: Ignored env LESS_TERMCAP_me
debug3: Ignored env TERM
debug3: Ignored env SHELL
debug3: Ignored env CLICOLOR
debug3: Ignored env HISTSIZE
debug3: Ignored env TMPDIR
debug3: Ignored env Apple_PubSub_Socket_Render
debug3: Ignored env TERM_PROGRAM_VERSION
debug3: Ignored env OLDPWD
debug3: Ignored env LESS_TERMCAP_ue
debug3: Ignored env HISTFILESIZE
debug3: Ignored env USER
debug3: Ignored env COMMAND_MODE
debug3: Ignored env SSH_AUTH_SOCK
debug3: Ignored env __CF_USER_TEXT_ENCODING
debug3: Ignored env LSCOLORS
debug3: Ignored env LESS_TERMCAP_us
debug3: Ignored env PATH
debug3: Ignored env PWD
debug3: Ignored env __PS1__
debug1: Sending env LANG = en_US.UTF-8
debug2: channel 0: request env confirm 0
debug3: send packet: type 98
debug3: Ignored env XPC_FLAGS
debug3: Ignored env HISTIGNORE
debug3: Ignored env HISTCONTROL
debug3: Ignored env XPC_SERVICE_NAME
debug3: Ignored env SHLVL
debug3: Ignored env HOME
debug3: Ignored env __UPDIR__
debug3: Ignored env LOGNAME
debug3: Ignored env LESS_TERMCAP_so
debug3: Ignored env PROMPT_COMMAND
debug3: Ignored env DISPLAY
debug3: Ignored env PROMPT_INDEX
debug3: Ignored env SECURITYSESSIONID
debug3: Ignored env LESS_TERMCAP_se
debug3: Ignored env COLORTERM
debug3: Ignored env _
debug1: Sending command: echo hello
debug2: channel 0: request exec confirm 1
debug3: send packet: type 98
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 2097152
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: exec request accepted on channel 0
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
debug2: channel 0: rcvd eow
debug2: channel 0: chan_shutdown_read (i0 o0 sock -1 wfd 4 efd 6 [write])
debug2: channel 0: input open -> closed
debug3: receive packet: type 96
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug3: receive packet: type 97
debug2: channel 0: rcvd close
debug3: channel 0: will not send data after close
hello
debug3: channel 0: will not send data after close
debug2: channel 0: obuf empty
debug2: channel 0: chan_shutdown_write (i3 o1 sock -1 wfd 5 efd 6 [write])
debug2: channel 0: output drain -> closed
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug3: send packet: type 97
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
#0 client-session (t4 r0 i3/0 o3/0 e[write]/0 fd -1/-1/6 sock -1 cc -1)
debug3: send packet: type 1
debug3: fd 1 is not O_NONBLOCK
Transferred: sent 2760, received 3000 bytes, in 1.0 seconds
Bytes per second: sent 2652.6, received 2883.3
debug1: Exit status 0
Is there another argument in connect() that I need to include?
Is there another argument in
connect()that I need to include?
No. Out of curiosity, can you try with the current master branch? I'm wondering if the rewrite has helped any.
@mscdex Yes, pardon my ignorance, but how do I use the latest off master? Tried cloning locally and then using const {Client} = require('./ssh2/lib/client.js'). When using yarn run install I get the error:
Error: Cannot find module 'nan'
Require stack:
- /Users/<me>/personal/snug/ssh2/lib/protocol/crypto/[eval]
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:900:15)
at Function.Module._load (node:internal/modules/cjs/loader:745:27)
at Module.require (node:internal/modules/cjs/loader:972:19)
at require (node:internal/modules/cjs/helpers:88:18)
at [eval]:1:1
at Script.runInThisContext (node:vm:132:18)
at Object.runInThisContext (node:vm:309:38)
at node:internal/process/execution:77:19
at [eval]-wrapper:6:22
at evalScript (node:internal/process/execution:76:60) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/<me>/personal/snug/ssh2/lib/protocol/crypto/[eval]'
]
}
gyp: Call to 'node -e "require('nan')"' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/Cellar/node/15.0.1/libexec/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (node:events:327:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:277:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/usr/local/Cellar/node/15.0.1/bin/node" "/usr/local/Cellar/node/15.0.1/libexec/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "--target=v15.0.1" "rebuild"
gyp ERR! cwd /Users/<me>/personal/snug/ssh2/lib/protocol/crypto
gyp ERR! node -v v15.0.1
gyp ERR! node-gyp -v v7.1.2
gyp ERR! not ok
Failed to build optional crypto binding
@mscdex Sorry, ignore the previous log, I was confused. I installed the latest off master and am seeing the same behavior.
Custom crypto binding available
Client: Trying localhost on port 22 ...
Local ident: 'SSH-2.0-ssh2js1.0.0-beta.0'
Socket connected
Remote ident: 'SSH-2.0-OpenSSH_7.9'
Outbound: Sending KEXINIT
Inbound: Handshake in progress
Handshake: (local) KEX method: [email protected],curve25519-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group15-sha512,diffie-hellman-group16-sha512,diffie-hellman-group17-sha512,diffie-hellman-group18-sha512
Handshake: (remote) KEX method: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1
Handshake: KEX algorithm: [email protected]
Handshake: (local) Host key format: ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256,ssh-rsa
Handshake: (remote) Host key format: rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519
Handshake: Host key format: ssh-ed25519
Handshake: (local) C->S cipher: aes128-gcm,[email protected],aes256-gcm,[email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected]
Handshake: (remote) C->S cipher: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
Handshake: C->S Cipher: [email protected]
Handshake: (local) S->C cipher: aes128-gcm,[email protected],aes256-gcm,[email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected]
Handshake: (remote) S->C cipher: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
Handshake: S->C cipher: [email protected]
Handshake: (local) C->S MAC: [email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
Handshake: (remote) C->S MAC: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
Handshake: C->S MAC: <implicit>
Handshake: (local) S->C MAC: [email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
Handshake: (remote) S->C MAC: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
Handshake: S->C MAC: <implicit>
Handshake: (local) C->S compression: none,[email protected],zlib
Handshake: (remote) C->S compression: none,[email protected]
Handshake: C->S compression: none
Handshake: (local) S->C compression: none,[email protected],zlib
Handshake: (remote) S->C compression: none,[email protected]
Handshake: S->C compression: none
Outbound: Sending KEXECDH_INIT
Host accepted by default (no verification)
Host accepted (verified)
Inbound: NEWKEYS
Verifying signature ...
Verified signature
Outbound: Sending NEWKEYS
Handshake completed
Outbound: Sending SERVICE_REQUEST (ssh-userauth)
Inbound: Received SERVICE_ACCEPT (ssh-userauth)
Outbound: Sending USERAUTH_REQUEST (none)
Inbound: Received USERAUTH_FAILURE (publickey,password,keyboard-interactive)
Client: none auth failed
Outbound: Sending USERAUTH_REQUEST (publickey -- check)
Inbound: Received USERAUTH_FAILURE (publickey,password,keyboard-interactive)
Client: publickey auth failed
node:events:304
throw er; // Unhandled 'error' event
^
Error: All configured authentication methods failed
at doNextAuth (.../ssh2/lib/client.js:785:21)
at tryNextAuth (.../ssh2/lib/client.js:852:7)
at USERAUTH_FAILURE (.../ssh2/lib/client.js:356:11)
at 51 (.../ssh2/lib/protocol/handlers.misc.js:333:16)
at Protocol.onPayload (.../ssh2/lib/protocol/Protocol.js:1979:10)
at AESGCMDecipherBinding.decrypt (.../ssh2/lib/protocol/crypto.js:1091:26)
at Protocol.parsePacket [as _parse] (.../ssh2/lib/protocol/Protocol.js:1948:25)
at Protocol.parse (.../ssh2/lib/protocol/Protocol.js:288:16)
at Socket.<anonymous> (.../ssh2/lib/client.js:650:15)
at Socket.emit (node:events:327:20)
Emitted 'error' event on Client instance at:
at Socket.<anonymous> (.../ssh2/lib/client.js:652:14)
at Socket.emit (node:events:327:20)
at addChunk (node:internal/streams/readable:304:12)
at readableAddChunk (node:internal/streams/readable:279:9)
at Socket.Readable.push (node:internal/streams/readable:218:10)
at TCP.onStreamRead (node:internal/stream_base_commons:192:23) {
level: 'client-authentication'
}
Are you able to create a new and unused key of the same type that exhibits the same behavior that you could send/post? I can try to duplicate the issue on my end.
Yes, I created a new keypair with ssh-keygen and spun up a new droplet on DO and am seeing the exact same behavior.
Here is the new public key.
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDBdQ5/tnbFzWYxLBGwtKAzYkIV5CkQZjb+EJTNPu6EYXWX0kSofVNcMHGvINwWDtaqqZoQI2AvIU3TYGbuLSzoFHPvQxtxHyAOCPcliRKcUDFJSUFfWdkodLXvbC2UhJ6DsCl/HRqGxaW6q6HocZThGXOy62zZabnkkrFT8oxInPtRfOQAAVnGQVUgxpuFX3WVDB9SI2KTdKCBbUzbU501An+BgPPyy20YkfANm8xYreQ+1330Hpqazsi5I9Pgs3VoLgS8ldPhMug7LY6mByyyqKHR7UHeHA7O2VRQNWd/0XCiS/NLUg9m+gqD05mQDKrBAUSe9u8NbsX7ihGDEVTn will.carhart@wcarhart-mbp15
Here is the new private key.
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABFwAAAAdzc2gtcn
NhAAAAAwEAAQAAAQEAwXUOf7Z2xc1mMSwRsLSgM2JCFeQpEGY2/hCUzT7uhGF1l9JEqH1T
XDBxryDcFg7WqqmaECNgLyFN02Bm7i0s6BRz70MbcR8gDgj3JYkSnFAxSUlBX1nZKHS172
wtlISeg7Apfx0ahsWluquh6HGU4Rlzsuts2Wm55JKxU/KMSJz7UXzkAAFZxkFVIMabhV91
lQwfUiNik3SggW1M21OdNQJ/gYDz8sttGJHwDZvMWK3kPtd99B6ams7IuSPT4LN1aC4EvJ
XT4TLoOy2Opgcssqih0e1B3hwOztlUUDVnf9FwokvzS1IPZvoKg9OZkAyqwQFEnvbvDW7F
+4oRgxFU5wAAA9hU0VtjVNFbYwAAAAdzc2gtcnNhAAABAQDBdQ5/tnbFzWYxLBGwtKAzYk
IV5CkQZjb+EJTNPu6EYXWX0kSofVNcMHGvINwWDtaqqZoQI2AvIU3TYGbuLSzoFHPvQxtx
HyAOCPcliRKcUDFJSUFfWdkodLXvbC2UhJ6DsCl/HRqGxaW6q6HocZThGXOy62zZabnkkr
FT8oxInPtRfOQAAVnGQVUgxpuFX3WVDB9SI2KTdKCBbUzbU501An+BgPPyy20YkfANm8xY
reQ+1330Hpqazsi5I9Pgs3VoLgS8ldPhMug7LY6mByyyqKHR7UHeHA7O2VRQNWd/0XCiS/
NLUg9m+gqD05mQDKrBAUSe9u8NbsX7ihGDEVTnAAAAAwEAAQAAAQEAly+06ggd4E26LHmF
RbSTcjS68sLBeMh496rbr18cJibIMKMp9wcia2yMm9GxTifAidVLyorq80oyuRugtUhmzO
SXCghG3Ov3MCC/jP0Hp1NggSaXyT29YUl8maTQJj5SZxX4CBglj+fMsgrJ2I9TS2uJqO0l
vu9KUKB3puRpz6BJqvKfGqkp3ttLrqA53Cx1JOwL8kUtXTGo5WECo36SO4C7v0XGwa2vYi
XAXF98+UBFNn55ZAnPBDEH5PcGSl3CQJ1/KJbITq7JdTsW+8ksgth1r23B+l7AXkyZnqPw
1/MsDtySWfpycr0Jqe5h/QiGIf4E34iuPY0RsPINP4IscQAAAIAFjTVwRLg1T6oC9yvYLF
qS/xKm80pxoeSKdDDWGmU06SDm0VnxziwngEenGWYwH+fsrl5Htt3492iIoASGo42HkXvD
FpqJpopQA5qnLi3yntADqd5rpeL7HmvvzMoL4n/6b7b65hq6fPP37vl+d/X1FrE5X6ARoZ
YaNU67s6KDPgAAAIEA9TGYVQVoJrGqEavdXv6K1sO5zDC0Ej9fMY4w8Tcv9KEcRsglNeSh
fe3oZbJeloXsAmGtMPFfFvEthYCbsh2sZ1I8McbOF2mVwjrI2bMsItUaxcosXw0MuTEkhL
Tuf1Rc7ITQh8rReNSHzJd7i1c8C2BXKRWsAUpTO92D94Lb4G8AAACBAMn7vk0LXI1QvC21
lH9EfGm/liXao0DcmnBUWVff+S8ZAqGCXS/QtkW3/+oLRDOBXj9/v3EfBdDRJs2FGgwSc3
DhjFvfyvXtA7BONv2uHNcXmuHsg+oJ4eQNsbt99XtFfc2OPIy7sZMka5yxIN6JIr1OGZI7
74PmsHBZy5cL5x8JAAAAG3dpbGwuY2FyaGFydEB3Y2FyaGFydC1tYnAxNQECAwQFBgc=
-----END OPENSSH PRIVATE KEY-----
Here is the log, but I think it's identical to above.
DEBUG: Local ident: 'SSH-2.0-ssh2js0.4.10'
DEBUG: Client: Trying localhost on port 22 ...
DEBUG: Client: Connected
DEBUG: Parser: IN_INIT
DEBUG: Parser: IN_GREETING
DEBUG: Parser: IN_HEADER
DEBUG: Remote ident: 'SSH-2.0-OpenSSH_7.9'
DEBUG: Outgoing: Writing KEXINIT
DEBUG: Parser: IN_PACKETBEFORE (expecting 8)
DEBUG: Parser: IN_PACKET
DEBUG: Parser: pktLen:1076,padLen:6,remainLen:1072
DEBUG: Parser: IN_PACKETDATA
DEBUG: Parser: IN_PACKETDATAAFTER, packet: KEXINIT
DEBUG: Comparing KEXINITs ...
DEBUG: (local) KEX algorithms: [email protected],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: (remote) KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1
DEBUG: KEX algorithm: [email protected]
DEBUG: (local) Host key formats: ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa
DEBUG: (remote) Host key formats: rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519
DEBUG: Host key format: ssh-ed25519
DEBUG: (local) Client->Server ciphers: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm,[email protected],aes256-gcm,[email protected]
DEBUG: (remote) Client->Server ciphers: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
DEBUG: Client->Server Cipher: aes128-ctr
DEBUG: (local) Server->Client ciphers: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm,[email protected],aes256-gcm,[email protected]
DEBUG: (remote) Server->Client ciphers: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
DEBUG: Server->Client Cipher: aes128-ctr
DEBUG: (local) Client->Server HMAC algorithms: hmac-sha2-256,hmac-sha2-512,hmac-sha1
DEBUG: (remote) Client->Server HMAC algorithms: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
DEBUG: Client->Server HMAC algorithm: hmac-sha2-256
DEBUG: (local) Server->Client HMAC algorithms: hmac-sha2-256,hmac-sha2-512,hmac-sha1
DEBUG: (remote) Server->Client HMAC algorithms: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
DEBUG: Server->Client HMAC algorithm: hmac-sha2-256
DEBUG: (local) Client->Server compression algorithms: none,[email protected],zlib
DEBUG: (remote) Client->Server compression algorithms: none,[email protected]
DEBUG: Client->Server compression algorithm: none
DEBUG: (local) Server->Client compression algorithms: none,[email protected],zlib
DEBUG: (remote) Server->Client compression algorithms: none,[email protected]
DEBUG: Server->Client compression algorithm: none
DEBUG: Outgoing: Writing KEXECDH_INIT
DEBUG: Parser: IN_PACKETBEFORE (expecting 8)
DEBUG: Parser: IN_PACKET
DEBUG: Parser: pktLen:188,padLen:8,remainLen:184
DEBUG: Parser: IN_PACKETDATA
DEBUG: Parser: IN_PACKETDATAAFTER, packet: KEXECDH_REPLY
DEBUG: Checking host key format
DEBUG: Checking signature format
DEBUG: Verifying host fingerprint
DEBUG: Host accepted by default (no verification)
DEBUG: Verifying signature
DEBUG: Outgoing: Writing NEWKEYS
DEBUG: Parser: IN_PACKETBEFORE (expecting 8)
DEBUG: Parser: IN_PACKET
DEBUG: Parser: pktLen:12,padLen:10,remainLen:8
DEBUG: Parser: IN_PACKETDATA
DEBUG: Parser: IN_PACKETDATAAFTER, packet: NEWKEYS
DEBUG: Outgoing: Writing SERVICE_REQUEST (ssh-userauth)
DEBUG: Parser: IN_PACKETBEFORE (expecting 16)
DEBUG: Parser: IN_PACKET
DEBUG: Parser: Decrypting
DEBUG: Parser: pktLen:28,padLen:10,remainLen:16
DEBUG: Parser: IN_PACKETDATA
DEBUG: Parser: Decrypting
DEBUG: Parser: HMAC size:32
DEBUG: Parser: IN_PACKETDATAVERIFY
DEBUG: Parser: Verifying MAC
DEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)
DEBUG: Parser: IN_PACKETDATAAFTER, packet: SERVICE_ACCEPT
DEBUG: Outgoing: Writing USERAUTH_REQUEST (none)
DEBUG: Parser: IN_PACKETBEFORE (expecting 16)
DEBUG: Parser: IN_PACKET
DEBUG: Parser: Decrypting
DEBUG: Parser: pktLen:60,padLen:14,remainLen:48
DEBUG: Parser: IN_PACKETDATA
DEBUG: Parser: Decrypting
DEBUG: Parser: HMAC size:32
DEBUG: Parser: IN_PACKETDATAVERIFY
DEBUG: Parser: Verifying MAC
DEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)
DEBUG: Parser: IN_PACKETDATAAFTER, packet: USERAUTH_FAILURE
DEBUG: Client: none auth failed
DEBUG: Outgoing: Writing USERAUTH_REQUEST (publickey -- check)
DEBUG: Parser: IN_PACKETBEFORE (expecting 16)
DEBUG: Parser: IN_PACKET
DEBUG: Parser: Decrypting
DEBUG: Parser: pktLen:60,padLen:14,remainLen:48
DEBUG: Parser: IN_PACKETDATA
DEBUG: Parser: Decrypting
DEBUG: Parser: HMAC size:32
DEBUG: Parser: IN_PACKETDATAVERIFY
DEBUG: Parser: Verifying MAC
DEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)
DEBUG: Parser: IN_PACKETDATAAFTER, packet: USERAUTH_FAILURE
DEBUG: Client: publickey auth failed
node:events:304
throw er; // Unhandled 'error' event
^
Error: All configured authentication methods failed
at doNextAuth (.../node_modules/ssh2/lib/client.js:413:17)
at tryNextAuth (.../node_modules/ssh2/lib/client.js:484:5)
at SSH2Stream.onUSERAUTH_FAILURE (.../node_modules/ssh2/lib/client.js:597:5)
at SSH2Stream.emit (node:events:327:20)
at parsePacket (.../node_modules/ssh2-streams/lib/ssh.js:3682:10)
at SSH2Stream._transform (.../node_modules/ssh2-streams/lib/ssh.js:701:13)
at SSH2Stream.Transform._write (node:internal/streams/transform:184:23)
at writeOrBuffer (node:internal/streams/writable:382:12)
at SSH2Stream.Writable.write (node:internal/streams/writable:333:10)
at Socket.ondata (node:internal/streams/readable:715:22)
Emitted 'error' event on Client instance at:
at doNextAuth (.../node_modules/ssh2/lib/client.js:415:12)
at tryNextAuth (.../node_modules/ssh2/lib/client.js:484:5)
[... lines matching original stack trace ...]
at Socket.ondata (node:internal/streams/readable:715:22) {
level: 'client-authentication'
}
In your package.json file, change the entry for ssh2 in the dependencies list to use a git URL instead of a version number e.g.
"ssh2": "github:mscdex/ssh2"
See the npm man page for details on using git and github urls.
I have the same issue, switching to master did not help
Something I just noticed @wcarhart is that with the OpenSSH client you're connecting to a different server because the server ident is different. With your OpenSSH client connection the server ident is "OpenSSH_8.2p1 Ubuntu-4ubuntu0.1" but with your ssh2 connection the server is reporting "OpenSSH_7.9". Are you sure you're using the right key for the right server with ssh2?
Chiming in, I'm also on mac and having the same problem but then realized i was passing the wrong values from my .env after console logging the config just before trying to connect.
Getting a similar issue, running latest both master of ssh2 and the latest release:
custom crypto binding not available
Client: Trying datastation.multiprocess.io on port 22 ...
Local ident: 'SSH-2.0-ssh2js1.1.0'
Socket connected
Remote ident: 'SSH-2.0-OpenSSH_8.4'
Outbound: Sending KEXINIT
Inbound: Handshake in progress
Handshake: (local) KEX method: [email protected],curve25519-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-s
ha256,diffie-hellman-group14-sha256,diffie-hellman-group15-sha512,diffie-hellman-group16-sha512,diffie-hellman-group17-sha512,diffie-hellman-group18-sha512
Handshake: (remote) KEX method: curve25519-sha256,[email protected],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
Handshake: KEX algorithm: [email protected]
Handshake: (local) Host key format: ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256,ssh-rsa
Handshake: (remote) Host key format: rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
Handshake: Host key format: ssh-ed25519
Handshake: (local) C->S cipher: aes128-gcm,[email protected],aes256-gcm,[email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected]
Handshake: (remote) C->S cipher: [email protected],[email protected],aes256-ctr,[email protected],aes128-ctr
Handshake: C->S Cipher: [email protected]
Handshake: (local) S->C cipher: aes128-gcm,[email protected],aes256-gcm,[email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected]
Handshake: (remote) S->C cipher: [email protected],[email protected],aes256-ctr,[email protected],aes128-ctr
Handshake: S->C cipher: [email protected]
Handshake: (local) C->S MAC: [email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
Handshake: (remote) C->S MAC: [email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha1,u
[email protected],hmac-sha2-512
Handshake: C->S MAC: <implicit>
Handshake: (local) S->C MAC: [email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
Handshake: (remote) S->C MAC: [email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha1,u
[email protected],hmac-sha2-512
Handshake: S->C MAC: <implicit>
Handshake: (local) C->S compression: none,[email protected],zlib
Handshake: (remote) C->S compression: none,[email protected]
Handshake: C->S compression: none
Handshake: (local) S->C compression: none,[email protected],zlib
Handshake: (remote) S->C compression: none,[email protected]
Handshake: S->C compression: none
Outbound: Sending KEXECDH_INIT
Received DH Reply
Host accepted by default (no verification)
Host accepted (verified)
Inbound: NEWKEYS
Verifying signature ...
Verified signature
Outbound: Sending NEWKEYS
Handshake completed
Outbound: Sending SERVICE_REQUEST (ssh-userauth)
Inbound: Received SERVICE_ACCEPT (ssh-userauth)
Outbound: Sending USERAUTH_REQUEST (none)
Inbound: Received USERAUTH_FAILURE (publickey,gssapi-keyex,gssapi-with-mic)
Client: none auth failed
Outbound: Sending USERAUTH_REQUEST (publickey -- check)
Inbound: Received USERAUTH_FAILURE (publickey,gssapi-keyex,gssapi-with-mic)
Client: publickey auth failed
CLIENT[sftp]: Handled Error: All configured authentication methods failed undefined
Outbound: Sending DISCONNECT (11)
CLIENT[sftp]: Removing listener from ready
CLIENT[sftp]: sftp: Removing end listener
CLIENT[sftp]: sftp: Removing close listener
CLIENT[sftp]: sftp: Removing error listener
Error: sftpConnect: All configured authentication methods failed
at fmtError (/Users/philipeaton/multiprocess/datastation/node_modules/ssh2-sftp-client/src/utils.js:53:18)
at Client.fn (/Users/philipeaton/multiprocess/datastation/node_modules/ssh2-sftp-client/src/utils.js:73:16)
at Client.emit (events.js:327:22)
at doNextAuth (/Users/philipeaton/multiprocess/datastation/node_modules/ssh2/lib/client.js:784:14)
at tryNextAuth (/Users/philipeaton/multiprocess/datastation/node_modules/ssh2/lib/client.js:972:7)
at USERAUTH_FAILURE (/Users/philipeaton/multiprocess/datastation/node_modules/ssh2/lib/client.js:367:11)
at 51 (/Users/philipeaton/multiprocess/datastation/node_modules/ssh2/lib/protocol/handlers.misc.js:333:16)
at Protocol.onPayload (/Users/philipeaton/multiprocess/datastation/node_modules/ssh2/lib/protocol/Protocol.js:1974:10)
at AESGCMDecipherNative.decrypt (/Users/philipeaton/multiprocess/datastation/node_modules/ssh2/lib/protocol/crypto.js:992:26)
at Protocol.parsePacket [as _parse] (/Users/philipeaton/multiprocess/datastation/node_modules/ssh2/lib/protocol/Protocol.js:1943:25)
at Protocol.parse (/Users/philipeaton/multiprocess/datastation/node_modules/ssh2/lib/protocol/Protocol.js:281:16)
at Socket.<anonymous> (/Users/philipeaton/multiprocess/datastation/node_modules/ssh2/lib/client.js:692:21)
at Socket.emit (events.js:315:20)
at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
at Socket.Readable.push (internal/streams/readable.js:223:10) {
code: 'ERR_GENERIC_CLIENT',
custom: true
}
When I pass username, privateKey, host, and port as config options.
I'm able to ssh in with the same private key though using ssh:
ssh -vvv -i ~/.ssh/id_rsa [email protected] -- exit
OpenSSH_8.1p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/philipeaton/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 47: Applying options for *
debug1: Connecting to datastation.multiprocess.io port 22.
debug1: Connection established.
debug1: identity file /Users/philipeaton/.ssh/id_rsa type 0
debug1: identity file /Users/philipeaton/.ssh/id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.4
debug1: match: OpenSSH_8.4 pat OpenSSH* compat 0x04000000
debug3: fd 5 is O_NONBLOCK
debug1: Authenticating to datastation.multiprocess.io:22 as 'fedora'
debug3: hostkeys_foreach: reading file "/Users/philipeaton/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /Users/philipeaton/.ssh/known_hosts:47
debug3: load_hostkeys: loaded 1 keys from datastation.multiprocess.io
debug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c
debug2: host key algorithms: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],[email protected],[email protected],ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected],zlib
debug2: compression stoc: none,[email protected],zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected],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
debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: [email protected],[email protected],aes256-ctr,[email protected],aes128-ctr
debug2: ciphers stoc: [email protected],[email protected],aes256-ctr,[email protected],aes128-ctr
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha1,[email protected],hmac-sha2-512
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha1,[email protected],hmac-sha2-512
debug2: compression ctos: none,[email protected]
debug2: compression stoc: none,[email protected]
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:xYULx/bHiyIlT5QX+yow8pEpyKgfpmcvBdCtVkK2W6A
debug3: hostkeys_foreach: reading file "/Users/philipeaton/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /Users/philipeaton/.ssh/known_hosts:47
debug3: load_hostkeys: loaded 1 keys from datastation.multiprocess.io
debug3: hostkeys_foreach: reading file "/Users/philipeaton/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /Users/philipeaton/.ssh/known_hosts:47
debug3: load_hostkeys: loaded 1 keys from 3.83.41.154
debug1: Host 'datastation.multiprocess.io' is known and matches the ECDSA host key.
debug1: Found key in /Users/philipeaton/.ssh/known_hosts:47
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /Users/philipeaton/.ssh/id_rsa RSA SHA256:VJ5+aBFgJ+LmFrNu5NAz1gr9i/JZwGAba8bt/0tcgss explicit
debug2: pubkey_prepare: done
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,[email protected],ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected]>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug3: start over, passed a different list publickey,gssapi-keyex,gssapi-with-mic
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/philipeaton/.ssh/id_rsa RSA SHA256:VJ5+aBFgJ+LmFrNu5NAz1gr9i/JZwGAba8bt/0tcgss explicit
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 60
debug1: Server accepts key: /Users/philipeaton/.ssh/id_rsa RSA SHA256:VJ5+aBFgJ+LmFrNu5NAz1gr9i/JZwGAba8bt/0tcgss explicit
debug3: sign_and_send_pubkey: RSA SHA256:VJ5+aBFgJ+LmFrNu5NAz1gr9i/JZwGAba8bt/0tcgss
debug3: sign_and_send_pubkey: signing using rsa-sha2-512
debug3: send packet: type 50
debug3: receive packet: type 52
debug1: Authentication succeeded (publickey).
Authenticated to datastation.multiprocess.io ([3.83.41.154]:22).
debug2: fd 7 setting O_NONBLOCK
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting [email protected]
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: network
debug3: receive packet: type 80
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug3: receive packet: type 4
debug1: Remote: /home/fedora/.ssh/authorized_keys:3: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug3: receive packet: type 4
debug1: Remote: /home/fedora/.ssh/authorized_keys:3: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug3: receive packet: type 91
debug2: channel_input_open_confirmation: channel 0: callback start
debug2: fd 5 setting TCP_NODELAY
debug3: ssh_packet_set_tos: set IP_TOS 0x20
debug2: client_session2_setup: id 0
debug1: Sending environment.
debug3: Ignored env C8_ROOT
debug3: Ignored env COLORTERM
debug3: Ignored env COMMAND_MODE
debug3: Ignored env EDITOR
debug3: Ignored env HOME
debug3: Ignored env KITTY_WINDOW_ID
debug1: Sending env LANG = en_US.UTF-8
debug2: channel 0: request env confirm 0
debug3: send packet: type 98
debug1: Sending env LC_CTYPE = en_US.UTF-8
debug2: channel 0: request env confirm 0
debug3: send packet: type 98
debug3: Ignored env LESS
debug3: Ignored env LOGNAME
debug3: Ignored env LSCOLORS
debug3: Ignored env OLDPWD
debug3: Ignored env PAGER
debug3: Ignored env PATH
debug3: Ignored env PONYO_ROOT
debug3: Ignored env PWD
debug3: Ignored env SHELL
debug3: Ignored env SHLVL
debug3: Ignored env SSH_AUTH_SOCK
debug3: Ignored env TERM
debug3: Ignored env TERMINFO
debug3: Ignored env TERM_PROGRAM
debug3: Ignored env TERM_PROGRAM_VERSION
debug3: Ignored env TMPDIR
debug3: Ignored env TMUX
debug3: Ignored env TMUX_PANE
debug3: Ignored env USER
debug3: Ignored env WINDOWID
debug3: Ignored env XPC_FLAGS
debug3: Ignored env XPC_SERVICE_NAME
debug3: Ignored env ZSH
debug3: Ignored env __CFBundleIdentifier
debug3: Ignored env __CF_USER_TEXT_ENCODING
debug3: Ignored env _
debug1: Sending command: exit
debug2: channel 0: request exec confirm 1
debug3: send packet: type 98
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 2097152
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: exec request accepted on channel 0
debug3: receive packet: type 96
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: channel 0: chan_shutdown_write (i0 o1 sock -1 wfd 7 efd 8 [write])
debug2: channel 0: output drain -> closed
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
debug2: channel 0: rcvd eow
debug2: channel 0: chan_shutdown_read (i0 o3 sock -1 wfd 6 efd 8 [write])
debug2: channel 0: input open -> closed
debug3: receive packet: type 97
debug2: channel 0: rcvd close
debug3: channel 0: will not send data after close
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug3: send packet: type 97
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
#0 client-session (t4 r0 i3/0 o3/0 e[write]/0 fd -1/-1/8 sock -1 cc -1)
debug3: send packet: type 1
debug3: fd 1 is not O_NONBLOCK
Transferred: sent 3580, received 3204 bytes, in 0.4 seconds
Bytes per second: sent 9277.0, received 8302.7
debug1: Exit status 0
I see it show up in server logs but I'm not sure what's going wrong/why it's failing to connect using the same user/privatekey
Jul 06 21:20:11 ip-172-31-49-215.ec2.internal sshd[330467]: userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedKeyTypes [preauth]
Jul 06 21:20:11 ip-172-31-49-215.ec2.internal sshd[330467]: Received disconnect from 64.78.253.73 port 34281:11: [preauth]
Jul 06 21:20:11 ip-172-31-49-215.ec2.internal sshd[330467]: Disconnected from authenticating user fedora 64.78.253.73 port 34281 [preauth]
Jul 06 21:20:13 ip-172-31-49-215.ec2.internal sshd[330469]: userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedKeyTypes [preauth]
Jul 06 21:20:13 ip-172-31-49-215.ec2.internal sshd[330469]: Received disconnect from 64.78.253.73 port 34374:11: [preauth]
Jul 06 21:20:13 ip-172-31-49-215.ec2.internal sshd[330469]: Disconnected from authenticating user fedora 64.78.253.73 port 34374 [preauth]
Jul 06 21:20:17 ip-172-31-49-215.ec2.internal sshd[330471]: userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedKeyTypes [preauth]
Jul 06 21:20:17 ip-172-31-49-215.ec2.internal sshd[330471]: Received disconnect from 64.78.253.73 port 57905:11: [preauth]
Jul 06 21:20:17 ip-172-31-49-215.ec2.internal sshd[330471]: Disconnected from authenticating user fedora 64.78.253.73 port 57905 [preauth]
I just noticed:
Jul 06 21:20:11 ip-172-31-49-215.ec2.internal sshd[330467]: userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedKeyTypes [preauth]
And it does look like Fedora did indeed deprecate this key type. But I'm confused because regular ssh still allows me to use this same key but ssh2 (this module) does not?
@eatonphil ssh2 definitely supports RSA keys. Can you verify the problem using just ssh2 (it seems you're using a downstream library -- ssh2-sftp-client)? Can you paste what your connection config object that you're passing to connect() looks like? Are you sure it's the same key?
I probably should add key hash values to debug output like OpenSSH does to catch these issues more easily.
No I believe it's that this library is "labeling" my key as ssh-rsa whereas the open ssh client is "labeling" it as rsa-sha2-512.
Since fedora deprecated ssh-rsa I can't use this library to connect even though I can connect with the openssh client (that labels the same key differently).
Does that make sense?
It's the same key type, the only difference is the hashing algorithm. OpenSSH uses a custom/non-standard message type to indicate the supported key algorithms for authentication, which I guess we could add support for if OpenSSH is reported in the remote party's identification. That won't help any other server implementations though that happen to disable support for select algorithms.
As ssh2-sftp-client is really just a simple wrapper around ssh2, it is unlikely it has any impact in this area, but of course cannot be eliminated and should be considered/verified.
In the ssh2-sftp-client repository, there is a 'validation' directory which contains some very basic scripts which perform simple sftp operations and which only use ssh2. These scripts are there for precisely this reason i.e. to verify an issue can be reproduced using just ssh2 and eliminate ssh2-sftp-client layer as a contributing factor. If the issue does not occur using these scripts, then the issue should probably be reported with the ssh2-sftp-client project.
I have the same issue when using the ssh2 library directly.
I guess we could add support for if OpenSSH is reported in the remote party's identification
It sounds like I'm making a feature request then
It sounds like I'm making a feature request then
As I was working on adding support for this, I discovered that OpenSSH does not filter the list of signature algorithms according to the server's configured PubkeyAcceptedKeyTypes/PubkeyAcceptedAlgorithms so it just sends everything OpenSSH supports in general, which kind of defeats the whole purpose of sending such a list.
The RFCs mention that if the server doesn't send a signature algorithm list or doesn't support the extension negotiation mechanism at all, to possibly use trial and error, however as the RFC also notes, some server implementations can penalize you for such things.
So unfortunately there's not really anything I can do right now.
I'm having the same issue.
This will happen when trying to connect to any server with a recent version of openssh (with default settings) and so it will become more and more urgent as it's not just a fedora deprecation but an openssh one.
Arch Linux is also shipping this version of openssh.
Same problem on my side with Arch Linux. I have been running unit tests on arch for years with nikita. The majority of the tests run with a local SSH connection. Lately, I trash all my docker images and couldn't run the tests which were using an Arch Linux image while the ssh command works from inside the container. Here are the steps to reproduce the issue:
docker run -it --rm archlinux:latest /bin/bash
pacman --noconfirm -Syu
pacman --noconfirm -S openssh nodejs npm
ssh -V | grep 'OpenSSH_8.8p1, OpenSSL 1.1.1l 24 Aug 2021'
cd /root/
/usr/bin/ssh-keygen -A
ssh-keygen -t rsa -f ~/.ssh/id_rsa -N ''
cat ~/.ssh/id_rsa.pub > ~/.ssh/authorized_keys
/usr/sbin/sshd
ssh [email protected] whoami | grep root
mkdir test
npm init -y
npm install ssh2
cat <<JS >test.js
const { readFileSync } = require('fs');
const { Client } = require('ssh2');
const conn = new Client();
conn.on('ready', () => {
console.log('Client :: ready');
conn.shell((err, stream) => {
if (err) throw err;
stream.on('close', () => {
console.log('Stream :: close');
conn.end();
}).on('data', (data) => {
console.log('OUTPUT: ' + data);
});
stream.end('ls -l\nexit\n');
});
}).connect({
host: '127.0.0.1',
port: 22,
username: 'root',
privateKey: readFileSync('/root/.ssh/id_rsa'),
debug: (s) => {console.log(s)}
});
JS
node test.js
Output is:
Custom crypto binding not available
Local ident: 'SSH-2.0-ssh2js1.5.0'
Client: Trying 127.0.0.1 on port 22 ...
Socket connected
Remote ident: 'SSH-2.0-OpenSSH_8.8'
Outbound: Sending KEXINIT
Inbound: Handshake in progress
Handshake: (local) KEX method: [email protected],curve25519-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group15-sha512,diffie-hellman-group16-sha512,diffie-hellman-group17-sha512,diffie-hellman-group18-sha512
Handshake: (remote) KEX method: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256
Handshake: KEX algorithm: [email protected]
Handshake: (local) Host key format: ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256,ssh-rsa
Handshake: (remote) Host key format: rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
Handshake: Host key format: ssh-ed25519
Handshake: (local) C->S cipher: [email protected],[email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected]
Handshake: (remote) C->S cipher: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
Handshake: C->S Cipher: [email protected]
Handshake: (local) S->C cipher: [email protected],[email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected]
Handshake: (remote) S->C cipher: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
Handshake: S->C cipher: [email protected]
Handshake: (local) C->S MAC: [email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
Handshake: (remote) C->S MAC: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
Handshake: C->S MAC: <implicit>
Handshake: (local) S->C MAC: [email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
Handshake: (remote) S->C MAC: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
Handshake: S->C MAC: <implicit>
Handshake: (local) C->S compression: none,[email protected],zlib
Handshake: (remote) C->S compression: none,[email protected]
Handshake: C->S compression: none
Handshake: (local) S->C compression: none,[email protected],zlib
Handshake: (remote) S->C compression: none,[email protected]
Handshake: S->C compression: none
Outbound: Sending KEXECDH_INIT
Received DH Reply
Host accepted by default (no verification)
Host accepted (verified)
Outbound: Sending NEWKEYS
Inbound: NEWKEYS
Verifying signature ...
Verified signature
Handshake completed
Outbound: Sending SERVICE_REQUEST (ssh-userauth)
Inbound: Received SERVICE_ACCEPT (ssh-userauth)
Outbound: Sending USERAUTH_REQUEST (none)
Inbound: Received USERAUTH_FAILURE (publickey,password)
Client: none auth failed
Outbound: Sending USERAUTH_REQUEST (publickey -- check)
Inbound: Received USERAUTH_FAILURE (publickey,password)
Client: publickey auth failed
node:events:368
throw er; // Unhandled 'error' event
^
Error: All configured authentication methods failed
at doNextAuth (/root/test/node_modules/ssh2/lib/client.js:803:21)
at tryNextAuth (/root/test/node_modules/ssh2/lib/client.js:993:7)
at USERAUTH_FAILURE (/root/test/node_modules/ssh2/lib/client.js:373:11)
at 51 (/root/test/node_modules/ssh2/lib/protocol/handlers.misc.js:337:16)
at Protocol.onPayload (/root/test/node_modules/ssh2/lib/protocol/Protocol.js:2025:10)
at AESGCMDecipherNative.decrypt (/root/test/node_modules/ssh2/lib/protocol/crypto.js:987:26)
at Protocol.parsePacket [as _parse] (/root/test/node_modules/ssh2/lib/protocol/Protocol.js:1994:25)
at Protocol.parse (/root/test/node_modules/ssh2/lib/protocol/Protocol.js:293:16)
at Socket.<anonymous> (/root/test/node_modules/ssh2/lib/client.js:713:21)
at Socket.emit (node:events:390:28)
Emitted 'error' event on Client instance at:
at Socket.<anonymous> (/root/test/node_modules/ssh2/lib/client.js:715:20)
at Socket.emit (node:events:390:28)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at Socket.Readable.push (node:internal/streams/readable:234:10)
at TCP.onStreamRead (node:internal/stream_base_commons:199:23) {
level: 'client-authentication'
}
Node.js v17.1.0
Note, it works with an older version of Arch, eg echo 'Server=https://archive.archlinux.org/repos/2021/05/01/$repo/os/$arch' > /etc/pacman.d/mirrorlist on container start and when ssh -V is OpenSSH_8.6p1, OpenSSL 1.1.1l 24 Aug 2021.
@mscdex
If I understand correctly - while we cannot get a list of PubkeyAcceptedAlgorithms, we could:
- use the best algorithm possible (now it uses the worst possible, oppositely to what OpenSSH does: https://github.com/mscdex/ssh2/issues/989#issuecomment-875126682)
- and allow the user to explicitly choose the preferred algorithm
So we'd need a configuration option similar to kex or cipher, but related to private key area, right?