Uploaded image for project: 'Ivy'
  1. Ivy
  2. IVY-1234

Ivy fails to publish to remote repository IF a proxy is set and the proxy has NO credential requirements.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 2.2.0-RC1
    • 2.3.0-RC1
    • Core
    • None
    • Snow Leopard 10.6.4 running Squid 3.0 and Artifactory 2.2.5

    Description

      I've just come across this problem and I believe it's critical. I've searched on JIRA for similar issues and I can't find anything.

      I have this configured in my ivysettings.xml:

      ivysettings.xml
      <credentials host="localhost" realm="Artifactory Realm" username="admin" passwd="password"/>
      

      Which is the default credentials for Artifactory 2.2.5.

      I have this resolver as a remote:

      ivysettings.xml
       <url name="artifactory-snapshots">
                      <ivy pattern="http://localhost:8081/artifactory/libs-snapshots-local/[organisation]/[module]/[revision]/ivy-[revision].xml" />
                      <artifact pattern="http://localhost:8081/artifactory/libs-snapshots-local/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
        </url>
      

      Whenever I attempt to publish, Ivy is reporting this issue:

      build.xml
      BUILD FAILED
      /Users/david/development/tmp/ant/includes/ivy.xml:25: impossible to publish artifacts for com.as#xmltransformer;0.1.0-SNAPSHOT: java.io.IOException: Access to URL http://localhost:8081/artifactory/libs-snapshots-local/com.as/xmltransformer/0.1.0-SNAPSHOT/xmltransformer-0.1.0-SNAPSHOT.jar was refused by the server: User anonymous is not permitted to deploy 'com.as/xmltransformer/0.1.0-SNAPSHOT/xmltransformer-0.1.0-SNAPSHOT.jar' into 'libs-snapshots-local:com.as/xmltransformer/0.1.0-SNAPSHOT/xmltransformer-0.1.0-SNAPSHOT.jar'.
      	at org.apache.ivy.util.url.AbstractURLHandler.validatePutStatusCode(AbstractURLHandler.java:79)
      	at org.apache.ivy.util.url.BasicURLHandler.upload(BasicURLHandler.java:225)
      	at org.apache.ivy.util.url.URLHandlerDispatcher.upload(URLHandlerDispatcher.java:82)
      	at org.apache.ivy.util.FileUtil.copy(FileUtil.java:148)
      	at org.apache.ivy.plugins.repository.url.URLRepository.put(URLRepository.java:84)
      	at org.apache.ivy.plugins.repository.AbstractRepository.put(AbstractRepository.java:130)
      	at org.apache.ivy.plugins.resolver.RepositoryResolver.put(RepositoryResolver.java:234)
      	at org.apache.ivy.plugins.resolver.RepositoryResolver.publish(RepositoryResolver.java:216)
      	at org.apache.ivy.core.publish.PublishEngine.publish(PublishEngine.java:281)
      	at org.apache.ivy.core.publish.PublishEngine.publish(PublishEngine.java:260)
      	at org.apache.ivy.core.publish.PublishEngine.publish(PublishEngine.java:172)
      	at org.apache.ivy.Ivy.publish(Ivy.java:600)
      	at org.apache.ivy.ant.IvyPublish.doExecute(IvyPublish.java:311)
      	at org.apache.ivy.ant.IvyTask.execute(IvyTask.java:277)
      	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
      	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
      	at org.apache.tools.ant.Task.perform(Task.java:348)
      	at org.apache.tools.ant.Target.execute(Target.java:390)
      	at org.apache.tools.ant.Target.performTasks(Target.java:411)
      	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
      	at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
      	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
      	at org.apache.tools.ant.Project.executeTargets(Project.java:1249)
      	at org.apache.tools.ant.Main.runBuild(Main.java:801)
      	at org.apache.tools.ant.Main.startAnt(Main.java:218)
      	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
      	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
      

      Notice how it is attempting to publish using anonymous credentials.

      I am running squid 3.0 on my machine to speed up internet access, but it is an anonymous proxy - there is no username or password required.

      Looking at the latest source from svn, in IvyAuthenticator:

      IvyAuthenticator.java
       String proxyHost = System.getProperty("http.proxyHost");
              if (getRequestingHost().equals(proxyHost)) {
                  String proxyUser = System.getProperty("http.proxyUser");
                  if ((proxyUser != null) && (proxyUser.trim().length() > 0)) {
                      String proxyPass = System.getProperty("http.proxyPassword", "");
                      Message.debug("authenicating to proxy server with username [" + proxyUser + "]");
                      result = new PasswordAuthentication(proxyUser, proxyPass.toCharArray());
                  }
              } else {
                  Credentials c = CredentialsStore.INSTANCE.getCredentials(getRequestingPrompt(),
                      getRequestingHost());
                  Message.debug("authentication: k='"
                          + Credentials.buildKey(getRequestingPrompt(), getRequestingHost()) + "' c='" + c
                          + "'");
                  if (c != null) {
                      result = new PasswordAuthentication(c.getUserName(), c.getPasswd().toCharArray());
                  }
              }
      

      What appears to be happening is that the requesting host == localhost, it attempts to get the proxy user, which is subsequently null, it then completely skips over the attempt at line 91 (Credentials c = ...) to retrieve the configured credentials, thus it then attempts to log in anonymously which fails...

      I believe anyone running a proxy on their machine (or more seriously I suppose if their company has an anonymous proxy between the developer/build machine and the repository) then as it stands currently, any attempts to publish will fail.

      If I can be of any further assistance, please do let me know.

      =david=

      Attachments

        1. IVY-1234.patch
          2 kB
          David Harrigan

        Activity

          People

            maartenc Maarten Coene
            dharrigan David Harrigan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: