int128 / gradle-ssh-plugin

Gradle SSH Plugin
https://gradle-ssh-plugin.github.io
Apache License 2.0
318 stars 60 forks source link

Auth fail when ssh-agent = true #280

Open a-p-o opened 7 years ago

a-p-o commented 7 years ago

Environment info

gradle-ssh-plugin-2.7.0 (groovy-ssh-2.7.0, jsch-0.1.53, groovy-2.4.7, java-1.8.0_77)

Steps to reproduce

  1. Configure remotes with SSH agent.
  2. Write a deploy task with an arbitrary session.
  3. Run deploy task.
plugins {
    id 'org.hidetake.ssh' version '2.7.0'
}

remotes {
    does_work {
        host = 'host'
        user = 'alex_ordonez'
        agent = true
//      passphrase = 'dontpostmeonline'
        identity = file("${System.properties['user.home']}/.ssh/id_rsa")
    }
    does_not_work {
        host = 'host'
        user = 'alex_ordonez'
//      agent = true
        passphrase = 'dontpostmeonline'
        identity = file("${System.properties['user.home']}/.ssh/id_rsa")
    }
}

The output from Gradle is:

Session #2 failed: java.lang.RuntimeException: java.lang.RuntimeException: com.jcraft.jsch.JSchException: Auth fail
:deploy FAILED

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/alex/projects/project/build.gradle' line: 78 // Line with ssh.run in deploy task

* What went wrong:
Execution failed for task ':deploy'.
> 1 of 2 session (50%) failed

BUILD FAILED
ghost commented 7 years ago

It does not work for me too:

serv1 {
    host = '****'
    user = 'root'
    knownHosts = allowAnyHosts
    agent = true
    identity = file("${System.properties['user.home']}/.ssh/id_rsa")
  }

Output:

* What went wrong:
Execution failed for task ':uploadFile'.
> Auth fail

But if I use username & plain password, it works fine.

dav-otero commented 7 years ago

It fails as well for me. Doing ssh directly from the command line works.

Note that this has started happening to me after Sierra OSX upgrade.

More info:

If I remove the passphrase form id_rsa, then it works just fine, BUT ONLY IF I REMOVE "agent" or I set it to "false"