Repast / repast.simphony

Git repository for Repast Simphony development
repast.github.io
90 stars 21 forks source link

JSchException: Algorithm negotiation fail #87

Closed jonas-andersen closed 6 months ago

jonas-andersen commented 11 months ago

When attempting to execute a batch run with type REMOTE, the following error is reported in the console:

com.jcraft.jsch.JSchException: Algorithm negotiation fail at com.jcraft.jsch.Session.receive_kexinit(Session.java:552) ~[jsch-0.1.48.jar:?] at com.jcraft.jsch.Session.connect(Session.java:299) ~[jsch-0.1.48.jar:?] at com.jcraft.jsch.Session.connect(Session.java:162) ~[jsch-0.1.48.jar:?] at repast.simphony.batch.ssh.SSHSessionFactory.create(SSHSessionFactory.java:75) ~[bin/:?] at repast.simphony.batch.ssh.RemoteSession.copyFile(RemoteSession.java:141) ~[bin/:?] at repast.simphony.batch.ssh.RemoteSession.initModelArchive(RemoteSession.java:134) ~[bin/:?]

This is encountered when attempting to connect to a new Debian 12.1 install.

I have attempted adding the Jsch algorithms to the server sshd in /etc/ssh/sshd_config:

KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1

but despite being listed in both "kex: server:" and "kex: client:" debug output is still produces the same error.

The included Jsch library is quite old (jsch-0.1.48 is from 2012 according to Maven central). I tried with the latest version (0.1.55 from 2018), which produces the same error.

From a bit of searching, it appears that the original Jsch has been abandoned.

There is a fork, which seems to still be active - https://github.com/mwiede/jsch/releases. This seems to be a drop-in replacement. I tested the latest version jsch-0.2.11 by downloading it and putting it in the Repast eclipse/plugins/repast.simphony.distributed.batch_2.10.0/lib directory (renaming and overwriting the existing jsch-0.1.48.jar to avoid having to update version plugin manifests... for the test). This seemed to work ok. Whether this fork is suitable as a replacement in general, I cannot say.

Another alternative might be to switch to Apache Mina SSHD. This was mentioned in some Eclipse archives discussing Jsch replacement for egit. Whether that would be a better approach is not something I can comment on at this time.

ncollier commented 11 months ago

OK. Thanks! We will look into a jsch replacement.

ncollier commented 6 months ago

I can reproduce this with bebop as the remote.

ncollier commented 6 months ago

Updated to newest jsch release: a784aeb5