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

I'm trying to authenticate the Jenkins command line (CLI) and the system returns an error message (user authentication with AD), but the GUI works.

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Blocker Blocker
    • None
    • Windows Server 2008 R2 Standard

      I'm trying to authenticate the Jenkins command line (CLI) and the system returns an error message (user authentication with AD), authenticates through the GUI normally.

      Under the command and the error:

      c:\>java -jar jenkins-cli.jar -s http://correcaobuild login --username jesiel
      Password:
      hudson.security.UserMayOrMayNotExistException: Unable to retrieve the user information without bind DN/password configured
      at hudson.plugins.active_directory.ActiveDirectoryUnixAuthenticationProvider.retrieveUser(ActiveDirectoryUnixAuthenticationProvider.java:297)
      at hudson.plugins.active_directory.ActiveDirectoryUnixAuthenticationProvider.retrieveUser(ActiveDirectoryUnixAuthenticationProvider.java:185)
      at hudson.plugins.active_directory.ActiveDirectoryUnixAuthenticationProvider.retrieveUser(ActiveDirectoryUnixAuthenticationProvider.java:133)
      at hudson.plugins.active_directory.AbstractActiveDirectoryAuthenticationProvider.loadUserByUsername(AbstractActiveDirectoryAuthenticationProvider.java:27)
      at hudson.plugins.active_directory.ActiveDirectorySecurityRealm.loadUserByUsername(ActiveDirectorySecurityRealm.java:582)
      at hudson.cli.ClientAuthenticationCache.set(ClientAuthenticationCache.java:94)
      at hudson.cli.LoginCommand.run(LoginCommand.java:37)
      at hudson.cli.CLICommand.main(CLICommand.java:228)
      at hudson.cli.CliManagerImpl.main(CliManagerImpl.java:92)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:274)
      at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:255)
      at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:215)
      at hudson.remoting.UserRequest.perform(UserRequest.java:118)
      at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      at hudson.remoting.Request$2.run(Request.java:287)
      at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      at hudson.cli.CliManagerImpl$1.call(CliManagerImpl.java:63)
      at hudson.remoting.InterceptingExecutorService$2.call(InterceptingExecutorService.java:95)
      at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)

          [JENKINS-13940] I'm trying to authenticate the Jenkins command line (CLI) and the system returns an error message (user authentication with AD), but the GUI works.

          Gardner Bickford added a comment - You can use an API token: http://blog.cloudbees.com/2011/08/api-token-in-jenkins-rest-api.html

          IYYAPPAN R added a comment -

          Any particular Active Directory plugin version solved this issue ? Please let me know the version if it works for AD Authentication

          IYYAPPAN R added a comment - Any particular Active Directory plugin version solved this issue ? Please let me know the version if it works for AD Authentication

          I am having the same issue with Jenkins 1.576 and AD plugin 1.38.
          Is there any workaround for this issue?

          Dmitrijs Sahlovs added a comment - I am having the same issue with Jenkins 1.576 and AD plugin 1.38. Is there any workaround for this issue?

          Daniel Beck added a comment -

          Could anyone confirm gardner's workaround of using an API token instead of a password?

          Daniel Beck added a comment - Could anyone confirm gardner 's workaround of using an API token instead of a password?

          Could you please be more specific? Should I use something like
          java -jar jenkins-cli.jar -s http://example.net:port/jenkins/ login --username USERNAME --password APITOKEN?
          If yes, than I receive following exception:
          org.acegisecurity.BadCredentialsException: Either no such user 'username@example.net' or incorrect password; nested exception is javax.naming.AuthenticationException: [LDAP: error code 49 - 80090308: LdapErr: DSID-0C0903AA, comment:AcceptSecurityContext error, data 52e, v1772 ]

          Dmitrijs Sahlovs added a comment - Could you please be more specific? Should I use something like java -jar jenkins-cli.jar -s http://example.net:port/jenkins/ login --username USERNAME --password APITOKEN? If yes, than I receive following exception: org.acegisecurity.BadCredentialsException: Either no such user 'username@example.net' or incorrect password; nested exception is javax.naming.AuthenticationException: [LDAP: error code 49 - 80090308: LdapErr: DSID-0C0903AA, comment:AcceptSecurityContext error, data 52e, v1772 ]

          Daniel Beck added a comment -

          Right, that would have been it. I guess not.

          Daniel Beck added a comment - Right, that would have been it. I guess not.

          If there are no quick workaround for this, could you please advice me if there is a possibility to run jenkins-cli automatically via passphrase protected ssh-key(Running script,
          providing password for key-file as a parameter). For now I can see, that the only way I can see how to use passphrase-protected keys is to type password by hands. Can this be automated?

          Dmitrijs Sahlovs added a comment - If there are no quick workaround for this, could you please advice me if there is a possibility to run jenkins-cli automatically via passphrase protected ssh-key(Running script, providing password for key-file as a parameter). For now I can see, that the only way I can see how to use passphrase-protected keys is to type password by hands. Can this be automated?

          marlene cote added a comment - - edited

          I am having a heck of time trying to setup ssh access to jenkins cli.. Is this issue still in the latest version of jenkins?
          org.jenkins-ci.main:jenkins-war:1.611
          AD 1.39
          I have tried using username password, ssh keys, etc. to no avail.

          marlene cote added a comment - - edited I am having a heck of time trying to setup ssh access to jenkins cli.. Is this issue still in the latest version of jenkins? org.jenkins-ci.main:jenkins-war:1.611 AD 1.39 I have tried using username password, ssh keys, etc. to no avail.

          Scott Tatum added a comment -

          Setting to unassigned as I have no access to Accurev, and am no longer the maintainer of this plugin.

          Scott Tatum added a comment - Setting to unassigned as I have no access to Accurev, and am no longer the maintainer of this plugin.

          In AD 2.0 I am not able to re-produce this issue with neither

          java -jar jenkins-cli.jar -s http://localhost:8080/jenkins/ who-am-i --username <user> --password <passwd>
          
          java -jar jenkins-cli.jar -s http://localhost:8080/jenkins/ -i /Users/fbelzunc/.ssh/id_rsa who-am-i
          

          If this issue still exists, please re-open and provide full details to reproduce it.

          Félix Belzunce Arcos added a comment - In AD 2.0 I am not able to re-produce this issue with neither java -jar jenkins-cli.jar -s http: //localhost:8080/jenkins/ who-am-i --username <user> --password <passwd> java -jar jenkins-cli.jar -s http: //localhost:8080/jenkins/ -i /Users/fbelzunc/.ssh/id_rsa who-am-i If this issue still exists, please re-open and provide full details to reproduce it.

            Unassigned Unassigned
            jesiel Jesiel Moraes da Conceição
            Votes:
            6 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: