Algorithm negotiation fail SSH in Jenkins

后端 未结 9 1729
梦如初夏
梦如初夏 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();
    

提交回复
热议问题