I\'m trying to ssh from Jenkins to a local server but the following error is thrown:
[SSH] Exception:Algorithm negotiation fail
com.jcraft.jsch.JSchExcep
As outlined here: http://sourceforge.net/p/jsch/mailman/message/32975616/, in JSch 0.1.51 diffie-hellman-group-exchange-sha256 is implemented, but not enabled. You can enable it using the setConfig
function like so:
JSch jsch = new JSch();
java.util.Properties configuration = new java.util.Properties();
configuration.put("kex", "diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256");
configuration.put("StrictHostKeyChecking", "no");
Session session = jsch.getSession("username", "hostname", 22);
session.setPassword("password");
session.setConfig(configuration);
session.connect();
If you end up here because you get the same error in PyCharm -
I'm using 2016.2.3 and can only upgrade if I convert to the subscription model. The problem is only seen on my Windows box. I was unable to get the remote server updated as described in other answers (KexAlgorithms).
My solution is
PyCharm restarts and I'm able to ssh to remote servers.
The only this helped to me.
If you want to temporarily fix this issue, simply download "Jsch" with min. version of 0.1.53 and move it to the SSH plugin directory, for example: cp /tmp/jsch-0.1.53.jar /var/lib/jenkins/plugins/ssh/WEB-INF/lib/ Don't forget to restart jenkins. You should now be able to Build your Job with Debian Jessie.
https://issues.jenkins-ci.org/browse/JENKINS-25258?focusedCommentId=274232&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-274232