Jenkins master无法通过SSH连接到slave

时间:2015-05-17 08:57:50

标签: jenkins jenkins-plugins

Jenkins master正在亚马逊实例上运行,奴隶机器在专用的Soyoustart机器上运行。工作正常,直到需要重做从设置:重新安装操作系统,安装Java,添加主设备密钥到slave authorized_keys并删除/添加主设备known_hosts中的从设备。为从站设置新凭据并在Jenkins主站中配置节点,但无法连接到从站。

设置与现在一样,并且一直在与其他从站一起工作而没有打嗝。唯一不同的是,这次新的奴隶与旧的奴隶是同一台机器。

可以从CLI从主服务器ssh到slave(使用此帖子的占位符替换文件名和slave IP): $ ssh -i <key-file> jenkins@<slave-ip>

已设置凭据 enter image description here

节点已配置: enter image description here

连接到奴隶时的输出:

[05/17/15 07:30:31] [SSH] Opening SSH connection to <slave-ip>.
Key exchange was not finished, connection is closed.
ERROR: Unexpected error in launching a slave. This is probably a bug in Jenkins.
java.lang.IllegalStateException: Connection is not established!
at com.trilead.ssh2.Connection.getRemainingAuthMethods(Connection.java:1030)
at com.cloudbees.jenkins.plugins.sshcredentials.impl.TrileadSSHPublicKeyAuthenticator.getRemainingAuthMethods(TrileadSSHPublicKeyAuthenticator.java:88)
at com.cloudbees.jenkins.plugins.sshcredentials.impl.TrileadSSHPublicKeyAuthenticator.canAuthenticate(TrileadSSHPublicKeyAuthenticator.java:80)
at com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator.newInstance(SSHAuthenticator.java:207)
at com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator.newInstance(SSHAuthenticator.java:169)
at hudson.plugins.sshslaves.SSHLauncher.openConnection(SSHLauncher.java:1173)
at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:701)
at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:696)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
[05/17/15 07:30:31] Launch failed - cleaning up connection
[05/17/15 07:30:31] [SSH] Connection closed.

版本号:

  • Jenkins 1.613
  • SSH Credentials Plugin 1.11
  • SSH Slaves插件1.9

对于那些喜欢深入挖掘代码的人:

我错过了一些明显的东西吗?可能是什么导致了这个?任何已知的解决方法?或者它看起来像需要报告的错误?

如果需要更多信息,请与我们联系。

2 个答案:

答案 0 :(得分:6)

我正在使用使用OpenJDK8的官方Docker镜像运行Jenkins master,不需要安装JCE。

Apparently this is an unresolved issue in Jenkins/SSH security.

我目前的解决方法是在 Jenkins Slave MACs中注释掉KexAlgorithm/etc/ssh/sshd_config行,然后在Ubuntu上重新启动sshd(service ssh restart

更新:自2017-04-29起已解决此问题

答案 1 :(得分:2)

我怀疑您需要为JVM安装Java Cryptography Extension。 没有它,RSA密钥大小是有限的,并且没有建立身份验证。

有关详细信息,请参阅https://issues.jenkins-ci.org/browse/JENKINS-26495