SFTP resolution fails with 'Auth cancel'


(commerce) #1

With 1.x we had the following:

repositories {
     mavenCentral()
 add(new org.apache.ivy.plugins.resolver.SshResolver()) {
  name = 'codeRepo' // used for debugging
  host = "code.example.com"
  user = codeUser
   publishPermissions = '0660'
  m2compatible = true
   keyFile = "${System.properties['user.home']}/.ssh/id_rsa" as File
  addArtifactPattern "/ivy-repository/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"
   addIvyPattern "/ivy-repository/[organisation]/[module]/[revision]/ivy.xml"
  }
    }

We translated that for gradle 2.0 to

repositories {
        mavenCentral()
        ivy {
   name = 'codeRepo' // used for debugging
                url = "sftp://code.example.com:22/ivy-repository"
  credentials {
    username codeUser
    password 'password'
   }
                //publishPermissions = '0660'
                layout "pattern", {
   m2compatible true
   artifact "/[organisation]/[module]/[revision]/[type]s/[artifact]-[revision].[ext]"
   ivy "/[organisation]/[module]/[revision]/ivy-[revision].xml"
  }
 }
    }

But it always tries to query a .pom file and because there is no it fails.


#2

I can’t see why Gradle would be looking for a .pom file in an ivy repository. Can you please post the actual error message you’re seeing? Even better if you can post the debug log via GitHub Gist.


(commerce) #3

Sorry you are right. It does not querry the ivy repository for the pom file. I missread the debug log. It querried mavenCentral for the pom file.

The sftp authentication is canceled

Caused by: com.jcraft.jsch.JSchException: Auth cancel
 at com.jcraft.jsch.Session.connect(Session.java:511)
 at com.jcraft.jsch.Session.connect(Session.java:183)
 at org.gradle.internal.resource.transport.sftp.SftpClientFactory$SftpClientCreator.createNewClient(SftpClientFactory.java:63)

I actually have the correct credentials there. I did log in with FileZilla using the same username password combination. I think it is something with “known_hosts”. But JSch is very hard to read and does not log any useful info.


#4

The SFTP functionality is pretty new, and may have limitations. Can you please provide the full debug logs, via GitHub Gist (or similar)?


(commerce) #5

Here is the debug log. https://gist.github.com/anonymous/a3042d52754a78e9f5dd I replaced the urls, product strings, etc I hope that helps


(commerce) #6

Maybe the stacktrace helps: https://gist.github.com/anonymous/754c79363c5654bf79ab


#7

Thanks for the report. This bug is now reported as GRADLE-3133.

At this time it’s not clear when we’ll be able to prioritise a fix.


(commerce) #8

I looked at the isue a bit further. The root cause is that our ssh server allows “publickey,keyboard-interactive” authentication while gradle’s JSch is configured to allow “gssapi-with-mic,publickey,keyboard-interactive,password”, but the implementation only works with “pasword”. “Auth Cancel” is reported by the “keyboard-interactive” method. I submitted a patch via github to limit the possible authentication methods to “password”, because it is the only one that works. I created a pull request https://github.com/gradle/gradle/pull/300