CentOS WebDAV Quota (mod_dav)

2009 October 20
by Simon

This guide was originally carried out on CentOS 5.3 with Apache 2.2.3

Being able to set a quota (limit the total directory size) on a WebDAV share can be very useful. Unfortunately, this is not supported by the Apache module mod_dav yet. There is, a patch available though and patching then recompiling the module is not difficult.

You can get the patch here.

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:

[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:

[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:

[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:

[user@localhost ~]$ tar -xvzf httpd-2.2.3.tar.gz
[user@localhost ~]$ cd httpd-2.2.3

You can now apply the patch:

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

Configure it, enabling the modules:

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

And after it successfully configures:

[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:

<Location /dav>
Dav                                On
DAVSATMaxAreaSize       256000
DavMinTimeout               600
</Location>

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

Creative Commons License
This Calmblue guide by Simon Bell is licensed under a Creative Commons Attribution-Share Alike 2.0 UK: England & Wales License

No comments yet

Leave a Reply

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS