How to Enable LDAP Authentication for Subversion on CentOS 6.2

This post will show the quick steps to enable LDAP authentication for existing subversion on linux CentOS 6.2. This guideline assumed that your existing subversion server has been configured properly and working with htpasswd user. This guideline also assumed that 389 LDAP has been installed but not yet configure in your subversion configuration file.

Prerequisites :
How to Install Httpd on CentOS 6.2
How to Install and Configure Subversion 1.6 on CentOS 6.2
How to Install 389 Directory Server on CentOS 6.2


1. Append /etc/hosts for ldap server fqdn. If your ldap server has been registered on DNS server, you can skip this step.

[root@svn ~]# vi /etc/hosts   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6 svn.ehowstuff.local svn ldap.ehowstuff.local ldap

2. Locate and open subversion.conf using vi editor

[root@svn ~]# vi /etc/httpd/conf.d/subversion.conf

3. Modify the existing subversion.conf to below :

LoadModule dav_svn_module     modules/
LoadModule authz_svn_module   modules/

<Location /svn/repos>
        DAV svn
        SVNParentPath /svn/repos
        AuthBasicProvider ldap
        AuthType Basic
        AuthzLDAPAuthoritative on
        AuthName "My Subversion server"
        AuthLDAPURL "ldap://ldap.ehowstuff.local:389/DC=ehowstuff,DC=local?uid?sub?(objectClass=*)" NONE
        AuthzSVNAccessFile /svn/permissions/svnaccess
        Require valid-user

4. Restart httpd service :

[root@svn ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]