Last active
October 18, 2019 19:40
-
-
Save Bigous/a52ca0a84c6cd42595b8828aec05f22c to your computer and use it in GitHub Desktop.
Create a SVN server with CentOS 7 and apache authenticating through LDAP (Active Directory)
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
#!/bin/bash | |
yum -y update | |
yum -y install httpd mod_ldap mod_authnz_external mod_ssl openssl | |
sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/sysconfig/selinux | |
setenforce 0 | |
systemctl stop firewalld | |
systemctl disable firewalld | |
chkconfig httpd on | |
systemctl start httpd | |
yum -y install subversion mod_dav_svn | |
mkdir -p /var/svn/repos | |
mkdir -p /var/svn/config | |
echo "Alias /svn /var/svn/repos" > /var/svn/config/subversion.conf | |
echo "RedirectMatch ^(/svn)$ $1/" >> /var/svn/config/subversion.conf | |
echo \<Location /svn\> >> /var/svn/config/subversion.conf | |
echo " DAV svn" >> /var/svn/config/subversion.conf | |
echo " SVNParentPath /var/svn/repos" >> /var/svn/config/subversion.conf | |
echo " SVNListParentPath on" >> /var/svn/config/subversion.conf | |
echo " AuthzSVNAccessFile /var/svn/config/svnaccessfile" >> /var/svn/config/subversion.conf | |
echo " #SSLRequireSSL" >> /var/svn/config/subversion.conf | |
echo " AuthBasicProvider ldap" >> /var/svn/config/subversion.conf | |
echo " AuthType Basic" >> /var/svn/config/subversion.conf | |
echo " AuthName \"My Subversion server\"" >> /var/svn/config/subversion.conf | |
echo " AuthLDAPURL \"ldap://YourLDAPServer:YourLDAPPort/DC=Your,DC=com,DC=br?sAMAccountName?sub?(objectClass=*)\" NONE" >> /var/svn/config/subversion.conf | |
echo " AuthLDAPBindDN \"[email protected]\"" >> /var/svn/config/subversion.conf | |
echo " AuthLDAPBindPassword \"password\"" >> /var/svn/config/subversion.conf | |
echo " require ldap-attribute objectClass=user" >> /var/svn/config/subversion.conf | |
echo \</Location\> >> /var/svn/config/subversion.conf | |
ln -s /var/svn/config/subversion.conf /etc/httpd/conf.d/ | |
svnadmin create /var/svn/repos/teste | |
echo "[groups]" > /var/svn/conf/svnaccessfile | |
echo "admin =" >> /var/svn/conf/svnaccessfile | |
echo "" >> /var/svn/conf/svnaccessfile | |
echo "[/]" >> /var/svn/conf/svnaccessfile | |
echo "* = r" >> /var/svn/conf/svnaccessfile | |
echo "" >> /var/svn/conf/svnaccessfile | |
echo "[teste:/]" >> /var/svn/conf/svnaccessfile | |
echo "* = r" >> /var/svn/conf/svnaccessfile | |
echo "your.user = rw" >> /var/svn/conf/svnaccessfile | |
chown -R apache.apache /var/svn | |
service httpd restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment