Quota (limit the total directory size) for WebDAV

Quota (limit the total directory size) for WebDAV

Postby daliose » Wed Sep 01, 2010 8:56 am

I found a really nice patch for our WebDAV server.
This patch is easy to install and even the quota settings are simple to set.
Unfortunately, this is not supported by the Apache module mod_dav yet.

You can get the patch here: http://www.geocities.jp/t_sat7/webdav/webdav.html

You need to download the most recent ’system-independent’ version of the patch. If you have trouble translating the page it was the first link in the second group of links, about a third down the page, just use wget like this:


Code: Select all
[user@localhost ~]$ wget http://leche.goodcrew.ne.jp/webdav/webdav-2.2.11-quota-2.4any.txt



Next you need to download the Apache source code. First, double check which version of Apache you have installed:

Code: Select all
[user@localhost ~]$ rpm --query --info httpd



In my case it was version 2.2.3. Head over to http://archive.apache.org/dist/httpd/ and you should be able to find yours, again wget is your friend:

Code: Select all
[user@localhost ~]$ wget http://archive.apache.org/dist/httpd/httpd-2.2.3.tar.gz



Extract the tar file, then cd to the httpd directory:

Code: Select all
[user@localhost ~]$ tar -xvzf httpd-2.2.3.tar.gz
[user@localhost ~]$ cd httpd-2.2.3



You can now apply the patch:

Code: Select all
[user@localhost httpd-2.2.3]$ patch -p2 < /home/user/webdav-2.2.11-quota-2.4any.txt



Configure it, enabling the modules:

Code: Select all
[user@localhost httpd-2.2.3]$ ./configure --enable-modules=most --enable-mods-shared=all



And after it successfully configures:

Code: Select all
[user@localhost httpd-2.2.3]$ make



You will now have versions of mod_dav.so and mod_dav_fs.so with support for quotas built in:

/home/user/httpd-2.2.3/modules/dav/main/.libs/mod_dav.so

/home/user/httpd-2.2.3/modules/dav/fs/.libs/mod_dav_fs.so

Copy them over your original versions in /usr/lib/httpd/modules restart Apache and you’re ready to go (it might be a good idea to back up your original modules before hand).


Apache config options

The extra option you can now add in your Apache config is ‘DAVSATMaxAreaSize’, this allows you to limit the total size of the WebDAV enabled directory.

For example:

Code: Select all
<Location /dav>
Dav                                On
DAVSATMaxAreaSize       256000
DavMinTimeout               600
</Location>


A couple of notes on usage:
*‘DAVSATMaxAreaSize’ is also inherited by sub-directories that have their own directory entry in your Apache config
*‘DAVSATMaxSize’ is in kB’

If you are now looking for a kb/mb/gb/tb calculator, take a look here: http://www.t1shopper.com/tools/calculate/

I have successful compiled the patch into our running Apache server. The first time, when I restarted Apache, I got an error about a non existing path. (Sorry, I don't remember the full error message), but after 2. try to restart, Apache works as requested and I was able to set quotas for all WebDAV directories.
daliose
Site Admin
 
Posts: 228
Joined: Thu Jun 24, 2010 2:09 pm

Return to WebDAV

Who is online

Users browsing this forum: No registered users and 1 guest

cron