Jenkins中的算法协商失败

时间:2015-09-17 10:22:03

标签: java jenkins ssh

我在Algorithm negotiation fail SSH in Jenkins

中看到了同一问题的答案

我遇到同样的问题,但更新ss_config没有帮助,我仍然得到同样的错误。我还有另一个问题,可能与此有关。在Jenkins的一般配置中,我将构建slave作为远程主机添加,并为其指定了主机名,端口,用户名和密钥文件路径,但仍然显示“无法连接到服务器”。我想知道为什么,因为如果我登录Jenkins机器,我可以使用相同的密钥文件轻松地在命令行中连接到我的远程主机。

更新

这是我添加到ssh_config的行:

KexAlgorithms diffie-hellman-group1-sha1,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1

这是Jenkins的控制台输出:

[SSH] Exception:Algorithm negotiation fail
com.jcraft.jsch.JSchException: Algorithm negotiation fail
    at com.jcraft.jsch.Session.receive_kexinit(Session.java:520)
    at com.jcraft.jsch.Session.connect(Session.java:286)
    at com.jcraft.jsch.Session.connect(Session.java:150)
    at org.jvnet.hudson.plugins.SSHSite.createSession(SSHSite.java:141)
    at org.jvnet.hudson.plugins.SSHSite.executeCommand(SSHSite.java:151)
    at org.jvnet.hudson.plugins.SSHBuilder.perform(SSHBuilder.java:60)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
    at hudson.model.Build$BuildExecution.build(Build.java:205)
    at hudson.model.Build$BuildExecution.doRun(Build.java:162)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537)
    at hudson.model.Run.execute(Run.java:1741)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:381)
Build step 'Execute shell script on remote host using ssh' marked build as failure
[SSH] executing post build script:

1 个答案:

答案 0 :(得分:5)

我想通了,我使用Ubuntu 15.04作为使用ssh版本6.7的远程主机,这个版本默认禁用了大部分加密算法。我需要添加这一行:

KexAlgorithms diffie-hellman-group1-sha1,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1

不是ssh_config,而是 sshd_config