Ehsan Enayati
Ehsan Enayati

Reputation: 309

Algorithm negotiation fail in Jenkins

I saw an answer to the same issue in Algorithm negotiation fail SSH in Jenkins

I am facing the same problem, but updating ss_config did not help and I still get the same error. I also have another problem, which maybe related to this. In Jenkins general configuration I added my build slave as a remote host and gave it hostname, port, username, and keyfile path, but it still says "Can't connect to server". I wonder why, because if I login to Jenkins machine I can easily connect to my remote host in the command line using the same keyfile.

Update:

This is the line I added to ssh_config:

KexAlgorithms diffie-hellman-group1-sha1,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1

This is the console output in 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:

Upvotes: 2

Views: 5044

Answers (1)

Ehsan Enayati
Ehsan Enayati

Reputation: 309

I figured it out, I am using Ubuntu 15.04 as remote host which uses ssh version 6.7 and this version disabled most of the encryption algorithm by default. And I needed to add this line:

KexAlgorithms diffie-hellman-group1-sha1,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1

NOT to the ssh_config, BUT to sshd_config.

Upvotes: 5

Related Questions