Set LDAP_BIND_USER
and LDAP_BIND_PASSWORD
environment variables in the system (e.g. when creating your Docker container, etc).
-
-
Save actionjack/f6b32545ea099006785a616c828c1d91 to your computer and use it in GitHub Desktop.
Jenkins init.groovy.d LDAP Authentication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jenkins.model.* | |
import hudson.security.* | |
import org.jenkinsci.plugins.* | |
String server = 'ldaps://ldap.mllrjb.com:636' | |
String rootDN = 'o=mllrjb.com' | |
String userSearchBase = '' | |
String userSearch = 'uid={0}' | |
String groupSearchBase = 'ou=Groups' | |
String bindDn = env.LDAP_BIND_USER; | |
String bindPassword = env.LDAP_BIND_PASSWORD; | |
boolean inhibitInferRootDN = false | |
SecurityRealm ldap_realm = new LDAPSecurityRealm(server, rootDN, userSearchBase, userSearch, groupSearchBase, bindDn, bindPassword, inhibitInferRootDN) | |
Jenkins.instance.setSecurityRealm(ldap_realm) | |
Jenkins.instance.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment