Repository navigation
Description
SSH agent isn't launched after the latest update, complaining about missing records in the known hosts file.
Nevertheless, the records do exist. I've tried to connect manually with ssh, everything was fine, ssh reports that it has found the host in known_hosts.
Probable reason is the hashed host name in known_hosts.
Here is the log from the Jenkins slave launch page:
[03/21/17 11:40:34] [SSH] Opening SSH connection to xxx.xxx.xxx.xxx:22
[03/21/17 11:40:34] [SSH] WARNING: No entry currently exists in the Known Hosts file for this host. Connections will be denied until this new host and its associated key is added to the Known Hosts file.
Key exchange was not finished, connection is closed.
java.io.IOException: There was a problem while connecting to xxx.xxx.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:591)
at com.trilead.ssh2.transport.TransportManager.receiveLoop(TransportManager.java:777)
at com.trilead.ssh2.transport.TransportManager$1.run(TransportManager.java:489)
... 1 more
[03/21/17 11:40:34] Launch failed - cleaning up connection
[03/21/17 11:40:34] [SSH] Connection closed.
And this is the debug output from ssh, showing that it has found a record in the second line of known_hosts.
$ sudo -u jenkins -g jenkins ssh -v jenkins@xxx.xxx.xxx.xxx
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx] port 22.
debug1: Connection established.
debug1: identity file /var/lib/jenkins/.ssh/id_rsa type 1
...
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
debug1: Host 'xxx.xxx.xxx.xxx.xxx' is known and matches the ECDSA host key.
debug1: Found key in /var/lib/jenkins/.ssh/known_hosts:2
debug1: ssh_ecdsa_verify: signature correct
...
Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-67-generic x86_64)
Additional logs from Jenkins system log:
Mar 21, 2017 12:06:08 PM FINER com.trilead.ssh2.transport.KexManager
kex_algo=diffie-hellman-group14-sha1
Mar 21, 2017 12:06:08 PM FINER com.trilead.ssh2.transport.KexManager
server_host_key_algo=ssh-rsa
Mar 21, 2017 12:06:08 PM FINER com.trilead.ssh2.transport.KexManager
enc_algo_client_to_server=aes256-ctr
Mar 21, 2017 12:06:08 PM FINER com.trilead.ssh2.transport.KexManager
enc_algo_server_to_client=aes256-ctr
Mar 21, 2017 12:06:08 PM FINER com.trilead.ssh2.transport.KexManager
mac_algo_client_to_server=hmac-sha1
Mar 21, 2017 12:06:08 PM FINER com.trilead.ssh2.transport.KexManager
mac_algo_server_to_client=hmac-sha1
Mar 21, 2017 12:06:08 PM FINER com.trilead.ssh2.transport.KexManager
comp_algo_client_to_server=none
Mar 21, 2017 12:06:08 PM FINER com.trilead.ssh2.transport.KexManager
comp_algo_server_to_client=none
Mar 21, 2017 12:06:08 PM FINE com.trilead.ssh2.transport.TransportManager
Receive thread: error in receiveLoop
java.io.IOException: The server hostkey was not accepted by the verifier callback
at com.trilead.ssh2.transport.KexManager.handleMessage(KexManager.java:591)
at com.trilead.ssh2.transport.TransportManager.receiveLoop(TransportManager.java:777)
at com.trilead.ssh2.transport.TransportManager$1.run(TransportManager.java:489)
at java.lang.Thread.run(Thread.java:745)
Mar 21, 2017 12:06:08 PM FINER com.trilead.ssh2.transport.TransportManager
Receive thread: back from receiveLoop
Mar 21, 2017 12:06:10 PM FINER com.trilead.ssh2.transport.KexManager
kex_algo=diffie-hellman-group14-sha1
Mar 21, 2017 12:06:10 PM FINER com.trilead.ssh2.transport.KexManager
server_host_key_algo=ssh-rsa
Mar 21, 2017 12:06:10 PM FINER com.trilead.ssh2.transport.KexManager
enc_algo_client_to_server=aes256-ctr
Mar 21, 2017 12:06:10 PM FINER com.trilead.ssh2.transport.KexManager
enc_algo_server_to_client=aes256-ctr
Mar 21, 2017 12:06:10 PM FINER com.trilead.ssh2.transport.KexManager
mac_algo_client_to_server=hmac-sha1
Mar 21, 2017 12:06:10 PM FINER com.trilead.ssh2.transport.KexManager
mac_algo_server_to_client=hmac-sha1
Mar 21, 2017 12:06:10 PM FINER com.trilead.ssh2.transport.KexManager
comp_algo_client_to_server=none
Mar 21, 2017 12:06:10 PM FINER com.trilead.ssh2.transport.KexManager
comp_algo_server_to_client=none
Mar 21, 2017 12:06:10 PM FINE com.trilead.ssh2.transport.TransportManager
Receive thread: error in receiveLoop
java.io.IOException: The server hostkey was not accepted by the verifier callback
at com.trilead.ssh2.transport.KexManager.handleMessage(KexManager.java:591)
at com.trilead.ssh2.transport.TransportManager.receiveLoop(TransportManager.java:777)
at com.trilead.ssh2.transport.TransportManager$1.run(TransportManager.java:489)
at java.lang.Thread.run(Thread.java:745)
Mar 21, 2017 12:06:10 PM FINER com.trilead.ssh2.transport.TransportManager
Receive thread: back from receiveLoop
File /var/lib/jenkins/.ssh/known_hosts contains strings, looking like being base64-encoded, delimited by '|'. Here is the sample.
|1|DAg ... o... 1ll9wI=| ... .... tIrM= ecdsa-sha2-nistp256 xxxxxx..... bmlzdHAyNTYAAAAIbm................. .................xxxxxxxxxxxoKEHF3Vr0q685jI2+6vWjvAAG4lz5Ckujy9k=
Originally reported by wl2776, imported from: Failed known_hosts verification for SSH agent
- assignee:
mc1arke
- status: Closed
- priority: Critical
- component(s): ssh-slaves-plugin
- label(s): regression
- resolution: Fixed
- resolved: 2017-08-17T18:37:59+00:00
- votes: 55
- watchers: 75
- imported: 20251212-090250
Raw content of original issue
SSH agent isn't launched after the latest update, complaining about missing records in the known hosts file.
Nevertheless, the records do exist. I've tried to connect manually with ssh, everything was fine, ssh reports that it has found the host in known_hosts.
Probable reason is the hashed host name in known_hosts.
Here is the log from the Jenkins slave launch page:
[03/21/17 11:40:34] [SSH] Opening SSH connection to xxx.xxx.xxx.xxx:22 [03/21/17 11:40:34] [SSH] WARNING: No entry currently exists in the Known Hosts file for this host. Connections will be denied until this new host and its associated key is added to the Known Hosts file. Key exchange was not finished, connection is closed. java.io.IOException: There was a problem while connecting to xxx.xxx.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:591) at com.trilead.ssh2.transport.TransportManager.receiveLoop(TransportManager.java:777) at com.trilead.ssh2.transport.TransportManager$1.run(TransportManager.java:489) ... 1 more [03/21/17 11:40:34] Launch failed - cleaning up connection [03/21/17 11:40:34] [SSH] Connection closed.And this is the debug output from ssh, showing that it has found a record in the second line of known_hosts.
$ sudo -u jenkins -g jenkins ssh -v jenkins@xxx.xxx.xxx.xxx OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: Applying options for * debug1: Connecting to xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx] port 22. debug1: Connection established. debug1: identity file /var/lib/jenkins/.ssh/id_rsa type 1 ... debug1: sending SSH2_MSG_KEX_ECDH_INIT debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: Server host key: ECDSA xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx debug1: Host 'xxx.xxx.xxx.xxx.xxx' is known and matches the ECDSA host key. debug1: Found key in /var/lib/jenkins/.ssh/known_hosts:2 debug1: ssh_ecdsa_verify: signature correct ... Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-67-generic x86_64)Additional logs from Jenkins system log:
Mar 21, 2017 12:06:08 PM FINER com.trilead.ssh2.transport.KexManager kex_algo=diffie-hellman-group14-sha1 Mar 21, 2017 12:06:08 PM FINER com.trilead.ssh2.transport.KexManager server_host_key_algo=ssh-rsa Mar 21, 2017 12:06:08 PM FINER com.trilead.ssh2.transport.KexManager enc_algo_client_to_server=aes256-ctr Mar 21, 2017 12:06:08 PM FINER com.trilead.ssh2.transport.KexManager enc_algo_server_to_client=aes256-ctr Mar 21, 2017 12:06:08 PM FINER com.trilead.ssh2.transport.KexManager mac_algo_client_to_server=hmac-sha1 Mar 21, 2017 12:06:08 PM FINER com.trilead.ssh2.transport.KexManager mac_algo_server_to_client=hmac-sha1 Mar 21, 2017 12:06:08 PM FINER com.trilead.ssh2.transport.KexManager comp_algo_client_to_server=none Mar 21, 2017 12:06:08 PM FINER com.trilead.ssh2.transport.KexManager comp_algo_server_to_client=none Mar 21, 2017 12:06:08 PM FINE com.trilead.ssh2.transport.TransportManager Receive thread: error in receiveLoop java.io.IOException: The server hostkey was not accepted by the verifier callback at com.trilead.ssh2.transport.KexManager.handleMessage(KexManager.java:591) at com.trilead.ssh2.transport.TransportManager.receiveLoop(TransportManager.java:777) at com.trilead.ssh2.transport.TransportManager$1.run(TransportManager.java:489) at java.lang.Thread.run(Thread.java:745)Mar 21, 2017 12:06:08 PM FINER com.trilead.ssh2.transport.TransportManager Receive thread: back from receiveLoop Mar 21, 2017 12:06:10 PM FINER com.trilead.ssh2.transport.KexManager kex_algo=diffie-hellman-group14-sha1 Mar 21, 2017 12:06:10 PM FINER com.trilead.ssh2.transport.KexManager server_host_key_algo=ssh-rsa Mar 21, 2017 12:06:10 PM FINER com.trilead.ssh2.transport.KexManager enc_algo_client_to_server=aes256-ctr Mar 21, 2017 12:06:10 PM FINER com.trilead.ssh2.transport.KexManager enc_algo_server_to_client=aes256-ctr Mar 21, 2017 12:06:10 PM FINER com.trilead.ssh2.transport.KexManager mac_algo_client_to_server=hmac-sha1 Mar 21, 2017 12:06:10 PM FINER com.trilead.ssh2.transport.KexManager mac_algo_server_to_client=hmac-sha1 Mar 21, 2017 12:06:10 PM FINER com.trilead.ssh2.transport.KexManager comp_algo_client_to_server=none Mar 21, 2017 12:06:10 PM FINER com.trilead.ssh2.transport.KexManager comp_algo_server_to_client=none Mar 21, 2017 12:06:10 PM FINE com.trilead.ssh2.transport.TransportManager Receive thread: error in receiveLoop java.io.IOException: The server hostkey was not accepted by the verifier callback at com.trilead.ssh2.transport.KexManager.handleMessage(KexManager.java:591) at com.trilead.ssh2.transport.TransportManager.receiveLoop(TransportManager.java:777) at com.trilead.ssh2.transport.TransportManager$1.run(TransportManager.java:489) at java.lang.Thread.run(Thread.java:745) Mar 21, 2017 12:06:10 PM FINER com.trilead.ssh2.transport.TransportManager Receive thread: back from receiveLoopFile /var/lib/jenkins/.ssh/known_hosts contains strings, looking like being base64-encoded, delimited by '|'. Here is the sample.
|1|DAg ... o... 1ll9wI=| ... .... tIrM= ecdsa-sha2-nistp256 xxxxxx..... bmlzdHAyNTYAAAAIbm................. .................xxxxxxxxxxxoKEHF3Vr0q685jI2+6vWjvAAG4lz5Ckujy9k=
environment
Versions:<br/>
Jenkins: 2.51<br/>
SSH Agent Plugin: 1.14<br/>
SSH Credentials plugin: 1.13<br/>
SSH Slaves Plugin : 1.15<br/>
Ubuntu 14.04, 16.04

Activity
jenkins-infra-bot commentedon Mar 21, 2017
Remote links associated with this issue:
jenkins-infra-bot commentedon Mar 21, 2017
Raw content of original comment:
This actually looks like it might be being caused by your host using ECDSA, but Trilead only supporting RSA or DSA keys, rather than the hostnames being hashed.
jenkins-infra-bot commentedon Mar 21, 2017
wl2776:
Raw content of original comment:
How can I change it?
Looks like SSH settings are default.
jenkins-infra-bot commentedon Mar 21, 2017
pvohmann:
Raw content of original comment:
I had the same issue, cygwin ssh added the ecdsa-sha2-nistp256 type key to known hosts.
One can add all known types with ssh-keyscan >>known_hosts
this did include the RSA key for ssh-slave.
Observed with cygwin ssh (OpenSSH_6.8p1, OpenSSL 1.0.2a 19 Mar 2015)
jenkins-infra-bot commentedon Mar 22, 2017
wl2776:
Raw content of original comment:
pvohmann: Thank you, I've obtained one more key with ssh-keyscan, having ssh-rsa in it, and the slave now launches fine.
mc1arke: I think, more information in the help message will be useful.
- this is a help on the slave configuration page. It says nothing about supported key encodings.
I mean the following:
jenkins-infra-bot commentedon Mar 22, 2017
crb:
Raw content of original comment:
I see the same issue now on one of our Jenkins 2.32.3 installations, slave was connected fine but I had to reconnect it for reasons and since then I get this same error message.
Following pvohmann's advice I added the RSA key to my known_hosts file, but was not able to solve the issue. Error still persists.
Update: Nevermind. I did not read carefully and only executed this on the slave and not on the master ... after properly updating the known_hosts file on the Jenkins master connection can be established again. Sorry for any confusion.
Would also propose to update the documentation to make it easier understandable.
jenkins-infra-bot commentedon Mar 22, 2017
jzila:
Raw content of original comment:
It seems like there's a legitimate bug here, where the SSH Slave Plugin SSH client doesn't report which host key types it supports. My hosts all have ssh-rsa and ecdsa-sha2-nistp256 host keys, but because the client doesn't tell the host which one it wants, the host responds only with the ecdsa-sha2-nistp256 key. This causes the plugin to fail to connect.
jenkins-infra-bot commentedon Mar 22, 2017
jzila:
Raw content of original comment:
FWIW a workaround is to switch the Host Key Verification Strategy to "Manually trusted key Verification Strategy". According to the description, this automatically verifies the key on first-time connections, and subsequently requires the key to match. That is exactly what I need because we use dynamically created hosts via the EC2 Spot Fleet plugin.
jenkins-infra-bot commentedon Mar 23, 2017
misatravel:
Raw content of original comment:
Hello! I also want to join my case:
I have Jenkins running in a Windows 10 machine, no cygwin, and after the upgrade I get these messages:
[03/23/17 11:46:57] [SSH] Opening SSH connection to fedora1.misatravel.org:22. C:\Users\dev\.ssh\known_hosts [SSH] No Known Hosts file was found at C:\Users\dev\.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 fedora1.misatravel.org: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(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) 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:591) at com.trilead.ssh2.transport.TransportManager.receiveLoop(TransportManager.java:777) at com.trilead.ssh2.transport.TransportManager$1.run(TransportManager.java:489) ... 1 more [03/23/17 11:46:57] Launch failed - cleaning up connection [03/23/17 11:46:57] [SSH] Connection closed.
Again, it is a Windows machine and it doesn't need to follow the architecture of a Linux machine.
Why is the SSH know relying in what the system may have instead of Jenkins' configuration? After of all, the manager of Jenkins doesn't need to be the same manager than the manager for the system account where Jenkins is running.
jenkins-infra-bot commentedon Mar 24, 2017
Raw content of original comment:
misatravel I'm not sure what your point in your final paragraph is saying. Jenkins looks for a known_hosts file in $user_home/,ssh/known_hosts which is the default location for a known_hosts file for most SSH clients, regardless of whether they're running on Linux or Windows. I could update the Known Hosts strategy to take a path for the known_hosts file but I'm not clear if that's the issue here.
jenkins-infra-bot commentedon Mar 24, 2017
Raw content of original comment:
For the issue other people have mentioned here: Trilead is no longer an actively maintained library, although I'll raise a Pull Requests against the Jenkins fork to allow it to handle ECDSA host keys. This should fix the issue where validation works on a command prompt but fails in Jenkins.
I'd rather not add arguments to the SSH command to force a specific key format to be used, as some hosts may not have that format, and it then causes upgrade issues if we ever chose to move format and some user's machines don't support newer formats.
jenkins-infra-bot commentedon Mar 27, 2017
misatravel:
Raw content of original comment:
mc1arke The fact is that I already created the file manually and I have tried to make it run. I would like to highlight again that I am running Jenkins on Windows, which doesn't have OpenSSH, and as Jenkins manager, I may not have access to Windows to operate neither remotely nor locally. At the end, I have created the known_hosts using reference other known_hosts, but this is what I get:
[03/27/17 10:24:43] [SSH] Opening SSH connection to fedora3.misatravel.org:22. [03/27/17 10:24:44] [SSH] WARNING: No entry currently exists in the Known Hosts file for this host. Connections will be denied until this new host and its associated key is added to the Known Hosts file. Key exchange was not finished, connection is closed. java.io.IOException: There was a problem while connecting to fedora3.misatravel.org: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(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) 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:591) at com.trilead.ssh2.transport.TransportManager.receiveLoop(TransportManager.java:777) at com.trilead.ssh2.transport.TransportManager$1.run(TransportManager.java:489) ... 1 more [03/27/17 10:24:44] Launch failed - cleaning up connection [03/27/17 10:24:44] [SSH] Connection closed.
Now, it is when I realize about the box "Host Key Verification Strategy" which was set up as "Known hosts file Verification Strategy", but you can see that it didn't work for me.
So I change it to "Manually provided key Verification Strategy", and I put in the "SSH Key" the public key of the computer+user I want to access, but I get
[03/27/17 10:32:10] [SSH] Opening SSH connection to fedora3.misatravel.org:22. [03/27/17 10:32:10] [SSH] WARNING: The SSH key for this host does not match the key required in the connection configuration. Connections will be denied until until the host key matches the configuration key. Key exchange was not finished, connection is closed. java.io.IOException: There was a problem while connecting to fedora3.misatravel.org: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(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) 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:591) at com.trilead.ssh2.transport.TransportManager.receiveLoop(TransportManager.java:777) at com.trilead.ssh2.transport.TransportManager$1.run(TransportManager.java:489) ... 1 more [03/27/17 10:32:10] Launch failed - cleaning up connection [03/27/17 10:32:10] [SSH] Connection closed.
At this point I also realize there is a new option called "Trust SSH Host Key" in the left, and after clicking on it, and accept the host key, I am still getting this exception:
[03/27/17 10:35:10] [SSH] Opening SSH connection to fedora3.misatravel.org:22. [03/27/17 10:35:11] [SSH] WARNING: The SSH key for this host does not match the key required in the connection configuration. Connections will be denied until until the host key matches the configuration key. Key exchange was not finished, connection is closed. java.io.IOException: There was a problem while connecting to fedora3.misatravel.org: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(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) 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:591) at com.trilead.ssh2.transport.TransportManager.receiveLoop(TransportManager.java:777) at com.trilead.ssh2.transport.TransportManager$1.run(TransportManager.java:489) ... 1 more [03/27/17 10:35:11] Launch failed - cleaning up connection [03/27/17 10:35:11] [SSH] Connection closed.
Finally, I have changed it to "Manually trusted key Verification Strategy" and now I am able to connect with the slave again.
jenkins-infra-bot commentedon Mar 27, 2017
Raw content of original comment:
Corroborating:
I have the exact same issue as reported after latest round of updates.
This workaround allowed me to connect to the disconnected slave nodes again.
jenkins-infra-bot commentedon Mar 29, 2017
Raw content of original comment:
I needed this workaround from the mailing list:
> ssh -o HostKeyAlgorithms=ssh-rsa slave2.example.com
The implication below is that Jenkins is using weaker encryption.
https://groups.google.com/d/msgid/jenkinsci-users/7006ab93-7ca4-4063-baf6-7c844be60165%40googlegroups.com
jenkins-infra-bot commentedon Mar 31, 2017
adrianbridgett:
Raw content of original comment:
srl295's fix solved it for me as well. I purged the other lines from ~/.ssh/known_hosts just in case.
47 remaining items
jenkins-infra-bot commentedon Jul 15, 2017
mwebber:
Raw content of original comment:
Having just upgraded from 2.68 to 2.69, with SSH Slaves plugin 1.20, it's still WORKING for me.
jenkins-infra-bot commentedon Jul 16, 2017
Raw content of original comment:
olenads Please provide more information, such as the exact error message (with stack trace), as well as what the known_hosts entry looks like.
jenkins-infra-bot commentedon Aug 15, 2017
mcsf:
Raw content of original comment:
I have these versions:
Jenkins 2.60.2
SSH Slaves Plugin 1.20
and am still getting this error:
Warning: no key algorithms provided; JENKINS-42959">
JENKINS-42959disabled [08/14/17 18:47:10] [SSH] Opening SSH connection to xxxxxx:22. [08/14/17 18:47:10] [SSH] WARNING: No entry currently exists in the Known Hosts file for this host. Connections will be denied until this new host and its associated key is added to the Known Hosts file.jenkins-infra-bot commentedon Aug 15, 2017
mwebber:
Raw content of original comment:
This message means exactly what it says.
In your agent configuration, for "Host Key Verification Strategy" you probably have "Known hosts file verification strategy". The help text for that says:
So that's what you need to do. If you need more help, ask on the mailing list, not here, since it's not a bug.
jenkins-infra-bot commentedon Aug 17, 2017
mcsf:
Raw content of original comment:
Yes, and I've been asking our elusive Sys Admin to please ssh from one host to the other in order to populate the known_hosts. This never used to be required by the plugin in the past (or if it was, I was not aware), but I guess it is now.
Meanwhile, I noticed there is a dropdown menu under Node configuration, and I selected "Manually provided key Verification Strategy", and then I pasted the contents of id_rsa.pub into the "SSH Key" textbox, but got this error:
[08/17/17 10:48:58] [SSH] WARNING: The SSH key for this host does not match the key required in the connection configuration. Connections will be denied until until the host key matches the configuration key. Key exchange was not finished, connection is closed.
I then tried "Non verifying Verification Strategy", and got this error:
[08/17/17 10:46:28] [SSH] WARNING: SSH Host Keys are not being verified. Man-in-the-middle attacks may be possible against this connection. ERROR: Server rejected the 1 private key(s) for jenkins (credentialId:e85865a0-e6eb-4de3-a77e-b0fbbc9ec8c4/method:publickey) [08/17/17 10:46:28] [SSH] Authentication failed. Authentication failed.
So it seems like the "Manually provided key" method will work for me, but there is an issue with key mismatch. So, I'll follow up with our sys admin.
jenkins-infra-bot commentedon Aug 17, 2017
Raw content of original comment:
mcsf Which id_rsa.pub was it you copied in to the configuration? Your personal one (~/.ssh/id_rsa.pub), or the one for the host's public key (/etc/sshd/id_rsa.pub or similar)? It needs to be the latter for this to work.
Your final failure indicates that your private key (used for authentication) does not match any public key saved on the host, which no amount of key verification is going to fix.
Using Non verifying Verification Strategy is strongly discouraged, unless you can verify the identity of the host through another means. Have you considered using the "Manually Trusted Key Verification Strategy" to retrieve the remote host's key and then for you to verify the key against the contents of rsa_id.pub from the remote host? This should get round any delays with getting System Admins to perform actions on your behalf.