Subversion + HTTP with AD authentication, local authorization, on RHEL7
I wanted our users to be able to user their AD credentials for SVN access. I first thought about putting everything in AD, including two groups for each repo (one read, one write), but I ended up only using AD for authentication, leaving the permissions to a local file since there is only one SVN server.
That is how the apache conf file looks like:
<VirtualHost *:443>
ServerName servername.domain
## Vhost docroot
DocumentRoot "/var/www/html"
## Directories, there should at least be a declaration for /var/www/html
<Location "/repos">
Require valid-user
Require ldap-user
Dav svn
AuthType Basic
AuthName "Use your Windows Credentials"
AuthBasicProvider file ldap
AuthUserFile /etc/httpd/conf/auth-conf-svn
AuthLDAPURL "ldap://DC1/dc=example,dc=domain?sAMAccountName?sub?(objectClass=*)"
AuthLDAPBindDN "user@domain"
AuthLDAPBindPassword "password"
SVNParentPath /var/www/svn
AuthzSVNAccessFile /etc/svn-acl-conf
</Location>
</VirtualHost>
That is how the apache conf file looks like:
<VirtualHost *:443>
ServerName servername.domain
## Vhost docroot
DocumentRoot "/var/www/html"
## Directories, there should at least be a declaration for /var/www/html
<Location "/repos">
Require valid-user
Require ldap-user
Dav svn
AuthType Basic
AuthName "Use your Windows Credentials"
AuthBasicProvider file ldap
AuthUserFile /etc/httpd/conf/auth-conf-svn
AuthLDAPURL "ldap://DC1/dc=example,dc=domain?sAMAccountName?sub?(objectClass=*)"
AuthLDAPBindDN "user@domain"
AuthLDAPBindPassword "password"
SVNParentPath /var/www/svn
AuthzSVNAccessFile /etc/svn-acl-conf
</Location>
</VirtualHost>
By using /var/www/svn for directory, your SELinux contexts will be correct with the default policy because of this rule:
/var/www/svn(/.*)? all files system_u:object_r:httpd_sys_rw_content_t:s0
This configuration will first check for a user in /etc/httpd/conf/auth-conf-svn, and if it can't find the specified user, it will do an ldap query on DC1.
If a valid user is found, it will check the ACL file (/etc/svn-acl-conf) to see if the user has access (read only or commit) to the repo.
This recipe has been tested on a RHEL7 (Red Hat Enterprise Linux 7) server, but should work on a Centos 7 server as well.
This recipe has been tested on a RHEL7 (Red Hat Enterprise Linux 7) server, but should work on a Centos 7 server as well.
Comments