apache ldap active directory jenkins

May 26, 2011

How to pass authentication with apache ldap active directory jenkins

What is Jenkins?

Jenkins is an extendable open source continuous integration server.

Install Jenkins on Redhat

# sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
# sudo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
# yum install jenkins

Modify Config file to select port you want it to run on

# nano -w /etc/sysconfig/jenkins

Start Jenkins

# /etc/init.d/jenkins start

Now you can start stop jenkins like this

root@somebox-> service jenkins stop
Shutting down Jenkins                                      [  OK  ]
root@somebox-> service jenkins start
Starting Jenkins                                           [  OK  ]

Jenkins Apache Auth Configuration

Also Apache can be used to reverse proxy jenkins with LDAP authentication:

# yum install mod_authz_ldap.x86_64

(APACHE CONFIG to reverse proxy jenkins to HTTPS with LDAP Authentication)

  ### start jenkins

  ProxyRequests Off
  SSLProxyEngine On
  SSLEngine on
  SSLCertificateFile /path/to/mysite.com.crt
  SSLCertificateKeyFile /path/to/mysite.com.key
  SSLCertificateChainFile /path/to/mycaCA.crt

  
    Order deny,allow
    Allow from all
  




		  #LDAP ACCESS
      AuthName "Authorized Access Only"
      AuthType Basic
      AuthzLDAPMethod ldap
      AuthzLDAPServer [REMOVED FOR SECURITY]:389
      AuthzLDAPBindDN "[REMOVED FOR SECURITY]"
      AuthzLDAPBindPassword [REMOVED FOR SECURITY]
      AuthzLDAPUserBase "[REMOVED FOR SECURITY]"
      AuthzLDAPUserKey sAMAccountName
      AuthzLDAPUserScope subtree
      
      require valid-user




  #Reverse proxy jenkins (being serverd locally on port 50005)
  ProxyPreserveHost on
  ProxyPass / http://10.0.0.1:50005/
  ProxyPassReverse / http://10.0.0.1:50005/