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

bindName and bindPassword not being displayed when created via Groovy

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Labels:
      None
    • Environment:
      JENKINS 2.46.3
      Active Directory Plug-in 2.4
    • Similar Issues:

      Description

      when using the below code to set the Active Directory properties, the BindDN and BindPassword are not being stored

      import jenkins.model.*
          import hudson.model.*
          import hudson.security.*
          import hudson.plugins.*
          import hudson.plugins.active_directory.*
          import hudson.*
          import jenkins.*
      
      def instance = Jenkins.getInstance()
      
      println "--> configure LDAP"
      String domain = "server.domain.com"
      String site = "site"
      String server = "server:3268"
      String bindName = "username"
      String bindPassword = 'password'
      
      adrealm = new ActiveDirectorySecurityRealm(domain, site, bindName, bindPassword, server)
      instance.setSecurityRealm(adrealm)
      
      println "--> configure LDAP... done"
       

      However the log in does appear to work - its just the credential screen that does not display correctly

        Attachments

          Issue Links

            Activity

            Hide
            mudpuppy Dennis Demarco added a comment - - edited

            I am having the same issue:

            It is not updating the config.xml correctly. Using the groovy script provided you can see the xml does not contain the attributes.

             

            I believe the reason why he could still log in, is that it may be defaulting to anonymous bind.

            
            <securityRealm class="hudson.plugins.active_directory.ActiveDirectorySecurityRealm" plugin="active-directory@2.4">
                <domains>
                  <hudson.plugins.active__directory.ActiveDirectoryDomain>
                    <name>server.domain.com</name>
                    <servers>server:3268</servers>
                    <bindPassword>{AQAAABAAAAAQbPfIw2czbgLjn6zCg0hU0tKLhMK4ei8flw7a/DpPsQM=}</bindPassword>
                  </hudson.plugins.active__directory.ActiveDirectoryDomain>
                </domains>
                <startTls>true</startTls>
                <groupLookupStrategy>AUTO</groupLookupStrategy>
                <removeIrrelevantGroups>false</removeIrrelevantGroups>
                <tlsConfiguration>TRUST_ALL_CERTIFICATES</tlsConfiguration>
              </securityRealm>

             

            Show
            mudpuppy Dennis Demarco added a comment - - edited I am having the same issue: It is not updating the config.xml correctly. Using the groovy script provided you can see the xml does not contain the attributes.   I believe the reason why he could still log in, is that it may be defaulting to anonymous bind. <securityRealm class="hudson.plugins.active_directory.ActiveDirectorySecurityRealm" plugin="active-directory@2.4">     <domains>       <hudson.plugins.active__directory.ActiveDirectoryDomain>         <name>server.domain.com</name>         <servers>server:3268</servers>         <bindPassword>{AQAAABAAAAAQbPfIw2czbgLjn6zCg0hU0tKLhMK4ei8flw7a/DpPsQM=}</bindPassword>       </hudson.plugins.active__directory.ActiveDirectoryDomain>     </domains>     <startTls>true</startTls>     <groupLookupStrategy>AUTO</groupLookupStrategy>     <removeIrrelevantGroups>false</removeIrrelevantGroups>     <tlsConfiguration>TRUST_ALL_CERTIFICATES</tlsConfiguration>   </securityRealm>  
            Hide
            mudpuppy Dennis Demarco added a comment -

            I'm runnning Jenkins on a linux box.

            Show
            mudpuppy Dennis Demarco added a comment - I'm runnning Jenkins on a linux box.
            Hide
            shaunadams Shaun Adams added a comment -

            I'm running this in a CentOs based Docker image

            Show
            shaunadams Shaun Adams added a comment - I'm running this in a CentOs based Docker image
            Hide
            myoung34 marc young added a comment - - edited

            Félix Belzunce Arcos any updates to this? Its still happening.

            <bindName/>

            is never populated

            Show
            myoung34 marc young added a comment - - edited Félix Belzunce Arcos any updates to this? Its still happening. <bindName/> is never populated
            Hide
            myoung34 marc young added a comment - - edited

            Behavior documented in Jenkins-48513

            Show
            myoung34 marc young added a comment - - edited Behavior documented in Jenkins-48513
            Hide
            marciu Petre Daniel Puiu added a comment -

            Having the same problem with Jenkins 2.89.2, active-directory:2.6.

            Show
            marciu Petre Daniel Puiu added a comment - Having the same problem with Jenkins 2.89.2, active-directory:2.6.
            Hide
            kpsimoulis Konstantinos Psimoulis added a comment -

            I was able to solve this issue by adding the following lines (On 2.6 and 2.8)

            adrealm.getDomains().each({
                it.bindName = adrealm.bindName
                it.bindPassword = adrealm.bindPassword
            })
            instance.setSecurityRealm(adrealm)
            instance.save()
            Show
            kpsimoulis Konstantinos Psimoulis added a comment - I was able to solve this issue by adding the following lines (On 2.6 and 2.8) adrealm.getDomains().each({ it.bindName = adrealm.bindName it.bindPassword = adrealm.bindPassword }) instance.setSecurityRealm(adrealm) instance.save()
            Hide
            jgrant216 Jeff G added a comment - - edited

            Thank you Konstantinos Psimoulis for the work around!

            Show
            jgrant216 Jeff G added a comment - - edited Thank you Konstantinos Psimoulis for the work around!

              People

              • Assignee:
                fbelzunc Félix Belzunce Arcos
                Reporter:
                shaunadams Shaun Adams
              • Votes:
                2 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated: