Connect using SSH2
leonschreuder opened this issue · comments
I am unable to connect to a remote machine using gradle-ssh-plugin, but commandline ssh works reliably. I think it has something to do with the ssh protocol that is used:
commandline ssh:
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1 none
debug1: kex: client->server aes128-ctr hmac-sha1 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA [...]
debug1: Host '10.2.37.88' is known and matches the ECDSA host key.
debug1: Found key in /home/user/.ssh/known_hosts:17
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentication succeeded (none).
gradle-ssh-plugin log:
14:59:22.055 [QUIET] [system.out] gradle-ssh-plugin-2.9.0 (groovy-ssh-2.9.0, jsch-0.1.53, groovy-2.4.10, java-1.8.0_65)
14:59:22.094 [DEBUG] [org.hidetake.groovy.ssh.core.Service] Using default settings: {fileTransfer=sftp, jschLog=false, retryWaitSec=0, timeoutSec=0, pty=false, authentications=[publickey, keyboard-interactive, password], agentForwarding=false, keepAliveSec=60, sudoPath=sudo, dryRun=false, encoding=UTF-8, retryCount=0, logging=slf4j, knownHosts=/home/user/.ssh/known_hosts, ignoreError=false, agent=false}
14:59:22.096 [DEBUG] [org.hidetake.groovy.ssh.core.Service] Using global settings: {}
14:59:22.101 [DEBUG] [org.hidetake.groovy.ssh.core.Service] Using per-service settings: {}
14:59:22.115 [DEBUG] [org.hidetake.groovy.ssh.session.SessionTask] Using per-remote settings: {fileTransfer=scp, jschLog=true, user=root}
14:59:22.128 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] Enabled JSch logging on Thread[Daemon worker Thread 16,5,main]
14:59:22.171 [DEBUG] [org.hidetake.groovy.ssh.connection.ConnectionManager] Connecting to Remote1[10.2.37.88:22] with {keepAliveSec=60, retryCount=0, retryWaitSec=0, knownHosts=/home/user/.ssh/known_hosts, timeoutSec=0, agent=false, authentications=[publickey, keyboard-interactive, password], user=root}
14:59:22.220 [DEBUG] [org.hidetake.groovy.ssh.connection.HostAuthentication$Helper] Using known-hosts file for Remote1[10.2.37.88:22]: /home/user/.ssh/known_hosts
14:59:22.239 [DEBUG] [org.hidetake.groovy.ssh.connection.HostAuthentication$Helper] Using key exhange algorithm for Remote1[10.2.37.88:22]: ecdsa-sha2-nistp521
14:59:22.243 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] Connecting to 10.2.37.88 port 22
14:59:22.243 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] Connection established
14:59:22.262 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] Remote version string: SSH-2.0-OpenSSH_7.3
14:59:22.262 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] Local version string: SSH-2.0-JSCH-0.1.53
14:59:22.263 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
14:59:22.274 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] aes256-ctr is not available.
14:59:22.274 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] aes192-ctr is not available.
14:59:22.274 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] aes256-cbc is not available.
14:59:22.274 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] aes192-cbc is not available.
14:59:22.274 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] CheckKexes: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
14:59:22.320 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] CheckSignatures: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
14:59:22.322 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] SSH_MSG_KEXINIT sent
14:59:22.322 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] SSH_MSG_KEXINIT received
14:59:22.322 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] kex: server: 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-group14-sha256,diffie-hellman-group14-sha1
14:59:22.322 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] kex: server: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp521,ssh-ed25519
14:59:22.322 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] kex: server: chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr
14:59:22.322 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] kex: server: chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr
14:59:22.322 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] kex: server: 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
14:59:22.323 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] kex: server: 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
14:59:22.323 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] kex: server: none
14:59:22.323 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] kex: server: none
14:59:22.323 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] kex: server:
14:59:22.323 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] kex: server:
14:59:22.323 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] kex: client: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
14:59:22.323 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] kex: client: ecdsa-sha2-nistp521
14:59:22.323 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
14:59:22.323 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
14:59:22.323 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
14:59:22.323 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
14:59:22.323 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] kex: client: none
14:59:22.323 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] kex: client: none
14:59:22.323 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] kex: client:
14:59:22.323 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] kex: client:
14:59:22.323 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] kex: server->client aes128-ctr hmac-sha1 none
14:59:22.323 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] kex: client->server aes128-ctr hmac-sha1 none
14:59:22.324 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] SSH_MSG_KEX_ECDH_INIT sent
14:59:22.325 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] expecting SSH_MSG_KEX_ECDH_REPLY
14:59:22.347 [DEBUG] [org.hidetake.groovy.ssh.connection.JSchLogger] [jsch] Disconnecting from 10.2.37.88 port 22
14:59:22.355 [DEBUG] [org.hidetake.groovy.ssh.connection.ConnectionManager] Closing connections: []
The only seemingly significant difference is in the protocol:
native ssh: SSH2_MSG_KEX_ECDH_INIT
gradle-ssh-plugin: SSH_MSG_KEX_ECDH_INIT
I have not found a way to configure if the plugin uses SSH or SSH2. Is this possible? I have searched the documentation and sources of the plugin and gradle-ssh, but could not find a way to configure it.
Environment info
gradle-ssh-plugin-2.9.0 (groovy-ssh-2.9.0, jsch-0.1.53, groovy-2.4.10, java-1.8.0_65)