Algorithm negotiation fail SSH in Jenkins

后端 未结 9 1711
梦如初夏
梦如初夏 2020-11-30 05:52

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         


        
相关标签:
9条回答
  • 2020-11-30 06:15

    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();
    
    0 讨论(0)
  • 2020-11-30 06:16

    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

    1. Click Help
    2. Select "Find Action"
    3. Type "Switch IDE Boot JDK.."
    4. Use the drop down arrow and click the "..." option
    5. Find the version of JAVA you're using on your local machine and select that folder.

    PyCharm restarts and I'm able to ssh to remote servers.

    0 讨论(0)
  • 2020-11-30 06:24

    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

    0 讨论(0)
提交回复
热议问题