Webdav

Please note that this is a draft version.

The following tutorial explains how to enable WebDAV access to your MBWE using lighttpd. To use this tutorial you will need to enable ssh access and install Optware.

The benefits of using WebDav are:

  • WebDav is supported natively in the most common operating systems (Mac OS X, Linux, Windows XP-Vista)
  • WebDav can be secured using ssl encryption
  • WebDav can be used to transfer large files (larger than 8mb)
  • WebDav is used by many other programs and protocols (e.g. CalDav, calendar sharing; Zotero Firefox Extension)

Install Optware lighttpd and mod_webdav dependancies

The build of lighttpd that comes built into the MBWE does not support WebDav. You will need to replace inbuilt lighttpd with Optware version (thanks frater). mod_webdav also requires some extra packages (libxml2 and sqlite), you should also install some of the mod_auth dependancies here as well (openldap and openssl):

# ipkg install lighttpd libxml2 sqlite openssl openldap
# ldconfig

Backup inbuilt lighttpd and create symbolic link to Optware version:
# cd /usr/sbin/
# mv lighttpd lighttpd.org
# ln -s /opt/sbin/lighttpd lighttpd
# chown -R www-data:www-data /var/log/lighttpd
# /etc/init.d/lighttpd.sh restart

Backup your lighttpd.config file:

# cp /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.bak

Edit lighttpd.conf

Change the server.modules section in lighttpd.conf to load mod_webdav. This section should look something like this:

server.modules          = (
                            "mod_auth",
                            "mod_access",
                            "mod_alias",
                            "mod_cgi",
                            "mod_fastcgi",
                            "mod_webdav",
                            "mod_accesslog"
)

To enable WebDav access on the /dav folder in your webroot add this to the bottom of your lighttpd.conf file:

$HTTP["url"] =~ "^/dav($|/)" {
    webdav.activate = "enable"
#    webdav.sqlite-db-name = "/var/run/lighttpd/lighttpd.webdav_lock.db"
    dir-listing.activate = "enable"
    webdav.is-readonly = "disable"
    auth.require = ( "/dav" => ( "method"  => "digest",
                               "realm"   => "nas admin",
                               "require" => "valid-user" ) )
}

This section of the config file tells lighttpd to activate WebDav on the /dav folder (/usr/www/lib/dav, so remember to mkdir it) and its subfolders (but not on folders like /david).
auth.require ensures that people need a password to access the WebDav share, in this example it uses the same user/pass as your webinterface admin.
webdav.sqlite-db-name is commented out because I have not got this working properly yet. This means that there is currently no locks or props support.

Enable encryption

I have also enabled encryption support by appending the following to my lighttpd.conf:

$SERVER["socket"] == ":443" {
                                    ssl.engine  = "enable"
                                    ssl.pemfile = "/etc/lighttpd/server.pem"
                                   }

You will need to create your own ssl certificate, this is explained elsewhere in the wiki.
Page tags: lighttpd optware webdav
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License