Restrict access to you subversion Server

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
################################################Svn Config
LoadModule dav_svn_module                 /usr/lib/apache2/mod_dav_svn.so
LoadModule authz_svn_module               /usr/lib/apache2/mod_authz_svn.so
 
 
ServerName svn.yourdomain.local
 
 
DAV svn
SVNPath /var/www/svn1
AuthType Basic
AuthName "Your SVN repository name"
AuthUserFile "/etc/subversion/passwd"
 
Order Deny,Allow
Allow from all
Require user dev

How to setup minimal Subversion Server.

Easy Svn Install without Ldap under Open Suse:

1 – zypper Install svn

2 – zypper install apache2

3 – Create Repository

svnadmin -create /var/www/svn1/

4 – Create passwd

htpasswd -c “/etc/subversion/passwd” dev   —> Insert password

5 – Apache Config

################################################Svn Config

LoadModule dav_svn_module                 /usr/lib/apache2/mod_dav_svn.so
LoadModule authz_svn_module               /usr/lib/apache2/mod_authz_svn.so

<VirtualHost *:80>
ServerName svn.yourdomain.local
<Location /svn>
DAV svn
SVNPath /var/www/svn1
AuthType Basic
AuthName “Your SVN repository name”
AuthUserFile “/etc/subversion/passwd”
# everyone can read but only user “dev” can commit
<LimitExcept GET PROPFIND OPTIONS REPORT>
Require user dev
</LimitExcept>
</Location>
</VirtualHost>

Rewrite_mod and missed files

How to replace missed files using mod_rewrite.

Here my mod_rewrite rule to check and replace missed image with NotAv.jpg icon.

#Start rewrite Engine
RewriteEngine on

#if /var/www/ “Requested file name” is not equal to (f)inded
RewriteCond /var/www%{REQUEST_FILENAME} !-f

#then rewrite all file in /public not finded with NotAv.jpg image
RewriteRule ^/public/.*$ /public/images/NotAv.jpg [PT]

#Log directives.
RewriteLog rewrite.log
RewriteLogLevel 1

Apache Http WebDav Configurations

Here a example of base configuration for Apache Http and WebDav:

1) First of All you have to create a .htaccess file:
[ApacheRoot]/bin/htpasswd -c /usr/local/apache2/.htpasswd username

2) Create an include in your httpd.con (I prefer to create a folder and include all *.conf file) :
Include conf/include/*.conf

3) create a dav.conf file and put it in the include dir.
####      dav.conf
#Loading Mudels
LoadModule dav_module                     modules/mod_dav.so
LoadModule dav_fs_module                  modules/mod_dav_fs.so

#Dav lck and timeout
DavLockDB /var/lock/dav/DavLock
DAVMinTimeout 600

#WebDav Virtual host enabled
<VirtualHost *:80>
ServerName dav.your.domain
Alias /dav /var/www/dav
<Location /dav>
AuthType Basic
DAV On
AuthName “WebDAV”
AuthUserFile “/usr/local/apache2/.htpasswd”
Options None
Require user username
</Location>
<Location />
Order Allow,Deny
Allow from all
</Location>
</VirtualHost>
4) Restart your Apache.

5) Now you should connect with a WebDav Client.