Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-39987

Unable to run the Build job on a slave node that has SSH key authenticaton enabled

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Blocker
    • Resolution: Unresolved
    • Component/s: ssh-agent-plugin
    • Labels:
      None
    • Environment:
      This is Jenkins ver. 2.19.1 which is installed on a CentOS 6.6 server. The slave node is a CentOS 7 server.
    • Similar Issues:

      Description

      1. Jenkins can connect to this slave node when I setup 'admin' user with adding the private key.

      [12/01/16 09:00:44] [SSH] Opening SSH connection to 192.168.177.157:22.
      [12/01/16 09:00:44] [SSH] Authentication successful.
      [12/01/16 09:00:44] [SSH] The remote users environment is:
      BASH=/bin/bash
      ----------------------
      <===[JENKINS REMOTING CAPACITY]===>channel started
      Slave.jar version: 2.62
      This is a Unix agent
      Evacuated stdout
      Agent successfully connected and online

      2. To create a Build job, in the Manage Jenkins --> Configure System --> SSH remote hosts, I add in the 'admin' user and hostname. After that I use this 'admin' user and hostname to set up connection to the slave node in the Build Job. In this setup user and hostname section, it doesn't have an option to add in the private key for the 'admin' user. So it shows "Authentication fail" when I run the Build job using "Execute shell script on remote host using ssh".

      3. I try to use the SSH Agent Plugin and follow steps in the Jenkins wiki page to install the "Apache Tomcat Native libraries" on the slave node:
      https://wiki.jenkins-ci.org/display/JENKINS/SSH+Agent+Plugin

      After I install the Apache Tomcat Native libraries on the slave node, it still shows "Authentication fail".

      [ssh-agent] Looking for ssh-agent implementation...
      [ssh-agent] Java/JNR ssh-agent
      [ssh-agent] Registered BouncyCastle on the remote agent
      [ssh-agent] Started.
      ....
      [SSH] Exception:Auth fail
      com.jcraft.jsch.JSchException: Auth fail
      at com.jcraft.jsch.Session.connect(Session.java:452)
      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:534)
      at hudson.model.Run.execute(Run.java:1720)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      at hudson.model.ResourceController.execute(ResourceController.java:98)
      at hudson.model.Executor.run(Executor.java:404)
      Build step 'Execute shell script on remote host using ssh' marked build as failure

      Please give your advice,
      Thank you

        Attachments

          Activity

          jimmyvo Jimmy created issue -
          jimmyvo Jimmy made changes -
          Field Original Value New Value
          Priority Minor [ 4 ] Major [ 3 ]
          jimmyvo Jimmy made changes -
          Priority Major [ 3 ] Blocker [ 1 ]
          jimmyvo Jimmy made changes -
          Summary Unable to run the Build job on a slave node that has SSH authenticaton enabled Unable to run the Build job on a slave node that has SSH key authenticaton enabled
          jimmyvo Jimmy made changes -
          Description 1. Jenkins can connect to this slave node when I setup 'admin' user with adding the private key.

          2. To create a Build job, in the Manage Jenkins --> Configure System --> SSH remote hosts, I add in the 'admin' user and hostname. After that I use this 'admin' user and hostname to set up connection to the slave node in the Build Job. In this setup user and hostname section, it doesn't have an option to add in the private key for the 'admin' user. So it shows "Authentication fail" when I run the Build job using "Execute shell script on remote host using ssh".

          3. I try to use the SSH Agent Plugin and follow steps in the Jenkins wiki page to install the "Apache Tomcat Native libraries" on the slave node:
          https://wiki.jenkins-ci.org/display/JENKINS/SSH+Agent+Plugin

          After I install the Apache Tomcat Native libraries on the slave node, it still shows "Authentication fail".

          {quote}[ssh-agent] Looking for ssh-agent implementation...
          [ssh-agent] Java/JNR ssh-agent
          [ssh-agent] Registered BouncyCastle on the remote agent
          [ssh-agent] Started.
          ....
          [SSH] Exception:Auth fail
          com.jcraft.jsch.JSchException: Auth fail
          at com.jcraft.jsch.Session.connect(Session.java:452)
          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:534)
          at hudson.model.Run.execute(Run.java:1720)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:404)
          Build step 'Execute shell script on remote host using ssh' marked build as failure
          {quote}

          Please give your advice,
          Thank you
          1. Jenkins can connect to this slave node when I setup 'admin' user with adding the private key.
          {quote}[12/01/16 09:00:44] [SSH] Opening SSH connection to 192.168.177.157:22.
          [12/01/16 09:00:44] [SSH] Authentication successful.
          [12/01/16 09:00:44] [SSH] The remote users environment is:
          BASH=/bin/bash
          ----------------------
          <===[JENKINS REMOTING CAPACITY]===>channel started
          Slave.jar version: 2.62
          This is a Unix agent
          Evacuated stdout
          Agent successfully connected and online{quote}

          2. To create a Build job, in the Manage Jenkins --> Configure System --> SSH remote hosts, I add in the 'admin' user and hostname. After that I use this 'admin' user and hostname to set up connection to the slave node in the Build Job. In this setup user and hostname section, it doesn't have an option to add in the private key for the 'admin' user. So it shows "Authentication fail" when I run the Build job using "Execute shell script on remote host using ssh".

          3. I try to use the SSH Agent Plugin and follow steps in the Jenkins wiki page to install the "Apache Tomcat Native libraries" on the slave node:
          https://wiki.jenkins-ci.org/display/JENKINS/SSH+Agent+Plugin

          After I install the Apache Tomcat Native libraries on the slave node, it still shows "Authentication fail".

          {quote}[ssh-agent] Looking for ssh-agent implementation...
          [ssh-agent] Java/JNR ssh-agent
          [ssh-agent] Registered BouncyCastle on the remote agent
          [ssh-agent] Started.
          ....
          [SSH] Exception:Auth fail
          com.jcraft.jsch.JSchException: Auth fail
          at com.jcraft.jsch.Session.connect(Session.java:452)
          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:534)
          at hudson.model.Run.execute(Run.java:1720)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:404)
          Build step 'Execute shell script on remote host using ssh' marked build as failure
          {quote}

          Please give your advice,
          Thank you
          Hide
          jimmyvo Jimmy added a comment - - edited

          I searched and tried some solutions online, but it still didn't work.

          I copy the bcprov-jdk15on-1.47.jar and bcpkix-jdk15on-1.47.jar from /var/lib/jenkins/plugins/ssh-agent/WEB-INF/lib to the /opt/jdk1.7.0_79/jre/lib/ext, but it still have the same error:

          "Caused by: java.lang.VerifyError: (class: org/bouncycastle/openssl/PEMReader$EncryptedPrivateKeyParser, method: parseObject signature: (Lorg/bouncycastle/util/io/pem/PemObject;)Ljava/lang/Object Incompatible argument to function"

          Jenkins ver. 2.19.1 which is installed on a CentOS 6.6 server with bouncycastle API Plugin: 2.16.0. The slave node is a CentOS 7 server.

          Note: I installed the Tomcat-Library-native on both Slave node and Jenkins. Jenkins can connect to the Slave node successfully, but it fails to use the Build job using "Execute shell script on remote host using ssh". Therefore, I cannot use Jenkins to automate the tasks in the Slave node. I appreciate if you have any advice.

          Show
          jimmyvo Jimmy added a comment - - edited I searched and tried some solutions online, but it still didn't work. I copy the bcprov-jdk15on-1.47.jar and bcpkix-jdk15on-1.47.jar from /var/lib/jenkins/plugins/ssh-agent/WEB-INF/lib to the /opt/jdk1.7.0_79/jre/lib/ext, but it still have the same error: "Caused by: java.lang.VerifyError: (class: org/bouncycastle/openssl/PEMReader$EncryptedPrivateKeyParser, method: parseObject signature: (Lorg/bouncycastle/util/io/pem/PemObject;)Ljava/lang/Object Incompatible argument to function" Jenkins ver. 2.19.1 which is installed on a CentOS 6.6 server with bouncycastle API Plugin: 2.16.0. The slave node is a CentOS 7 server. Note: I installed the Tomcat-Library-native on both Slave node and Jenkins. Jenkins can connect to the Slave node successfully, but it fails to use the Build job using "Execute shell script on remote host using ssh". Therefore, I cannot use Jenkins to automate the tasks in the Slave node. I appreciate if you have any advice.
          Hide
          jglick Jesse Glick added a comment -

          Try 1.14 and the native command.

          Show
          jglick Jesse Glick added a comment - Try 1.14 and the native command.
          Hide
          jimmyvo Jimmy added a comment -

          After I set the environment variable PATH for Java on the Slave node, then it worked.  However, when Jenkin ran the "Build Job" as "admin" role and "root" role, these roles could not function fully as I ran the tasks with these roles on a Putty that was connected to the Slave node.

          It could stop Apache, DS, and server on the Slave. However, It could not start Apache, DS.

           

          Note: The Slave node already had Apache and Java. I set the environment variable PATH for Java on the Slave node, using the those existed Apache and Java on the Slave node.

           

          Last time, I tried to upgrade the "SSH Agent Plugin" version from 1.3 to 1.13. This caused another error.

           

          Thank Glick for your advice.  I will try "1.14 and the native command.".

           

           

          Show
          jimmyvo Jimmy added a comment - After I set the environment variable PATH for Java on the Slave node, then it worked.  However, when Jenkin ran the "Build Job" as "admin" role and "root" role, these roles could not function fully as I ran the tasks with these roles on a Putty that was connected to the Slave node. It could stop Apache, DS, and server on the Slave. However, It could not start Apache, DS.   Note: The Slave node already had Apache and Java. I set the environment variable PATH for Java on the Slave node, using the those existed Apache and Java on the Slave node.   Last time, I tried to upgrade the "SSH Agent Plugin" version from 1.3 to 1.13. This caused another error.   Thank Glick for your advice.  I will try "1.14 and the native command.".    

            People

            • Assignee:
              Unassigned
              Reporter:
              jimmyvo Jimmy
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: