Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-12694

Executing remote tasks through SSH fails when using key

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • 5.11.0
    • 4.3.3, 4.4, 5.7.2, 5.9.4, 5.9.7
    • None

      Steps to reproduce

      1. Create a job with a task of type SSH that could run SSH commands on a remote server.
      2. Choose the authentication type to either Key without passphrase OR key with passphrase
      3. Enter a command such as "mkdir /home/smaiyaki/hello"
      4. Run the build and it will fail with the following error in the build logs.
        Failed to connect to host
         	net.schmizz.sshj.userauth.UserAuthException: Exhausted available authentication methods
         	        at net.schmizz.sshj.userauth.UserAuthImpl.authenticate(UserAuthImpl.java:114)
         	        at net.schmizz.sshj.SSHClient.auth(SSHClient.java:205)
         	        at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:305)
         	        at com.atlassian.bamboo.plugins.scp.SshTask.execute(SshTask.java:82)
         	        at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:187)
         	        at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:93)
         	        at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:87)
         	        at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:206)
         	        at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:103)
         	        at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:111)
         	        at com.atlassian.bamboo.build.pipeline.concurrent.NamedThreadFactory$2.run(NamedThreadFactory.java:52)
        	        at java.lang.Thread.run(Thread.java:722)
         	Caused by: net.schmizz.sshj.userauth.UserAuthException: publickey auth failed
         	        at net.schmizz.sshj.userauth.UserAuthImpl.handle(UserAuthImpl.java:157)
         	        at net.schmizz.sshj.transport.TransportImpl.handle(TransportImpl.java:474)
         	        at net.schmizz.sshj.transport.Decoder.decode(Decoder.java:127)
         	        at net.schmizz.sshj.transport.Decoder.received(Decoder.java:195)
         	        at net.schmizz.sshj.transport.Reader.run(Reader.java:72)
        

      The following appears in the server logs:

      2013-01-30 22:11:45,417 INFO [qtp35496097-123] [AccessLogFilter] sultan GET http://localhost:1044/bamboo44/ajax/viewPlanUpdates.action?sinceSystemTime=0&lastProject= 158047kb
      2013-01-30 22:11:45,532 DEBUG [qtp35496097-123] [AccessLogFilter] END: sultan GET http://localhost:1044/bamboo44/ajax/viewPlanUpdates.action?sinceSystemTime=0&lastProject= 158047kb-68706kb 115ms
      2013-01-30 22:11:50,056 ERROR [7-BAM::Default Agent::Agent:pool-16-thread-1] [Promise] <<authenticated>> woke to: net.schmizz.sshj.userauth.UserAuthException: publickey auth failed
      2013-01-30 22:11:50,056 INFO [7-BAM::Default Agent::Agent:pool-16-thread-1] [UserAuthImpl] `publickey` auth failed
      2013-01-30 22:11:50,062 INFO [7-BAM::Default Agent::Agent:pool-16-thread-1] [ExecuteBuildTask] TESTA-SCP-JOB1-12: Running post build plugin 'NCover Results Collector'
      2013-01-30 22:11:50,092 INFO [7-BAM::Default Agent::Agent:pool-16-thread-1] [NCoverBuildProcessor] inside NCoverBuildProcessor.call()
      

      This issue is replicable even with the default SSH port of 22. Changing the authentication type to password works fine.

      Edits

      The password authentication also fails if the SSH port is not the default 22 with the error message below thrown in the build logs:

      Failed to connect to host
      java.net.ConnectException: Connection refused: connect
      at java.net.DualStackPlainSocketImpl.connect0(Native Method)
      at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:69)
      at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
      at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
      at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:157)
      at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
      at java.net.Socket.connect(Socket.java:579)
      at net.schmizz.sshj.SocketClient.connect(SocketClient.java:70)
      at net.schmizz.sshj.SocketClient.connect(SocketClient.java:77)
      at net.schmizz.sshj.SocketClient.connect(SocketClient.java:103)
      at com.atlassian.bamboo.plugins.scp.SshTask.execute(SshTask.java:74)
      at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:187)
      at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:93)
      at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:87)
      at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:206)
      at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:103)
      at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:111)
      at com.atlassian.bamboo.build.pipeline.concurrent.NamedThreadFactory$2.run(NamedThreadFactory.java:52)
      at java.lang.Thread.run(Thread.java:722)
      

        1. bamboo51231.png
          bamboo51231.png
          57 kB
        2. screenshot-1.jpg
          screenshot-1.jpg
          70 kB

              Unassigned Unassigned
              smaiyaki Sultan Maiyaki (Inactive)
              Votes:
              29 Vote for this issue
              Watchers:
              42 Start watching this issue

                Created:
                Updated:
                Resolved: