我在 Algorithm negotiation fail SSH in Jenkins 中看到了同一问题的答案
我面临同样的问题,但更新 ss_config 没有帮助,我仍然遇到同样的错误。我还有另一个问题,可能与此有关。在 Jenkins 常规配置中,我将构建从站添加为远程主机,并为其提供主机名、端口、用户名和 key 文件路径,但它仍然显示“无法连接到服务器”。我想知道为什么,因为如果我登录到 Jenkins 机器,我可以使用相同的 key 文件在命令行中轻松连接到我的远程主机。
更新:
这是我添加到 ssh_config 的行:
KexAlgorithms diffie-hellman-group1-sha1,<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ddbea8afabb8efe8e8ece4f0aeb5bcefe8eb9db1b4bfaeaeb5f3b2afba" rel="noreferrer noopener nofollow">[email protected]</a>,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:
最佳答案
我发现,我使用 Ubuntu 15.04 作为远程主机,它使用 ssh 版本 6.7,并且该版本默认禁用大部分加密算法。我需要添加这一行:
KexAlgorithms diffie-hellman-group1-sha1,<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="294a5c5b5f4c1b1c1c1810045a41481b1c1f6945404b5a5a4107465b4e" rel="noreferrer noopener nofollow">[email protected]</a>,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
不是到 ssh_config,而是到 sshd_config。
关于java - Jenkins 中算法协商失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32627998/