環境
master
amazon linux (2017/04/01時点の最新)
java java-1.8.0-openjdk
Jenkins 2.52
slave
amazon linux (2017/04/01時点の最新)
java java-1.8.0-openjdk
JenkinsのSSHスレーブサーバを追加したところ以下のエラーが発生して
上手くslaveサーバを追加できなかったので、その対処方法。
[04/01/17 09:51:23] [SSH] Opening SSH connection to 172.31.xxx.xxx:22.
/var/lib/jenkins/.ssh/known_hosts [SSH] No Known Hosts file was found at /var/lib/jenkins/.ssh/known_hosts. Please ensure one is created at this path and that Jenkins can read it.
Key exchange was not finished, connection is closed.
java.io.IOException: There was a problem while connecting to 172.31.xxx.xxx:22
at com.trilead.ssh2.Connection.connect(Connection.java:818)
at com.trilead.ssh2.Connection.connect(Connection.java:687)
at com.trilead.ssh2.Connection.connect(Connection.java:601)
at hudson.plugins.sshslaves.SSHLauncher.openConnection(SSHLauncher.java:1265)
at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:790)
at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:785)
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)
Caused by: java.io.IOException: Key exchange was not finished, connection is closed.
at com.trilead.ssh2.transport.KexManager.getOrWaitForConnectionInfo(KexManager.java:93)
at com.trilead.ssh2.transport.TransportManager.getConnectionInfo(TransportManager.java:230)
at com.trilead.ssh2.Connection.connect(Connection.java:770)
... 9 more
Caused by: java.io.IOException: The server hostkey was not accepted by the verifier callback
at com.trilead.ssh2.transport.KexManager.handleMessage(KexManager.java:535)
at com.trilead.ssh2.transport.TransportManager.receiveLoop(TransportManager.java:777)
at com.trilead.ssh2.transport.TransportManager$1.run(TransportManager.java:489)
... 1 more
[04/01/17 09:51:23] Launch failed - cleaning up connection
[04/01/17 09:51:23] [SSH] Connection closed.
対処方法を先に記載します。
管理者でログインし、
[Jenkinsの管理]-[ノードの管理]へ移動し、今回エラーが出ているノードを選択します。
Host Key Verification Strategyの設定値を変更する。
「Known hosts file Verification strategy」
↓
「Manually trusted key Verification Strategy」
参考ページ
その他
Jenkins slaveの追加を書こうかと思ったのですが、他の方々が書かれているので今回は割愛します。
追伸
SSH Slaves pluginのアップデートした場合以下のメッセージが出るようです。
SSH Host Key Verifiers are not configured for all SSH slaves on this Jenkins instance. This could leave these slaves open to man-in-the-middle attacks. Update your slave configuration to resolve this.
その場合も、「Manually trusted key Verification Strategy」に変更することで、エラーがなくなります。