sshtools / maverick-synergy

Next Generation Java SSH API
https://jadaptive.com
GNU Lesser General Public License v3.0
96 stars 26 forks source link

SSHClient -Failed to negotiate a transport component #57

Closed radhesh-kunnath closed 1 year ago

radhesh-kunnath commented 2 years ago

Hi guys, I'm trying to ssh into a cluster node by using sshclient Ex: SshClient ssh = new SshClient(hostname, port, username, password.toCharArray()

Exception: java.io.IOException: Failed to negotiate a transport component from {} and {} java.io.IOException: Failed to connect to :22

and unable to connect to the cluster. I'm using maverick jar version 3.6 -maverick-synergy-client-3.0.6-all.jar Kindly refer the screenshot attached. Can someone help what needs to be done? cluster-authentication-failed

Thanks and Regards, Radhesh

radhesh-kunnath commented 2 years ago

Just an update to the above query Used latest maverick jar 3.0.9

When i do ssh into the cluster using putty and upon checking auth.log, i have found this -> no matching key exchange method found . Their offer: curve25519-sha256,curve25519-sha256@libssh.org [preauth]

and when i view the ssh settings of the cluster this is what i found. Kex Algorithms: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha256,diffie-hellman-group-exchange-sha256

can someone help what needs to be done?

Thanks and Regards, Radhesh.

ludup commented 2 years ago

Can you provide a log please?

Create logging.properties in your working directory and add

maverick.log.file=true
maverick.log.file.level=DEBUG

Then post the synergy.log file.

radhesh-kunnath commented 1 year ago

Hi David, Please find the attached.

Thanks and Regards, Radhesh. synergy.log

radhesh-kunnath commented 1 year ago

@ludup I feel like based on the exception in the logs, is the cluster looking for specific ciphers in the key exchange negotiation? java.io.IOException: Failed to negotiate a transport component from curve25519-sha256,curve25519-sha256@libssh.org and ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha256,diffie-hellman-group-exchange-sha256

Would love to know the root cause , any help is much appreciated asap.

ludup commented 1 year ago

It cannot negotiate a key exchange, but the API supports all of those key exchanges.

The problem is clear earlier in the log "JCE cannot authenticate the provider BC"

Have you tried to extract everything into a uber jar file? You cannot do that with BC, if not, there is still some error with the BC dependency.

radhesh-kunnath commented 1 year ago

Thanks Ludup, upon checking my working directory I have found 2 different versions of bc*.jar. Removed one of them it has fixed the issue. Thanks again @ludup .