This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new Linux.com!

Linux.com

Feature: Apache & Web Servers

Turn Apache into a collaborative authoring platform with mod_dav

By Murthy Raju on August 17, 2007 (4:00:00 PM)

Share    Print    Comments   

Ever thought about how nice it would be if you could edit the files stored on your Web server directly without the cumbersome download-edit-upload routine? Web-based Distributed Authoring and Versioning (WebDAV) is the way to do it. A WebDAV server works like a file server that uses HTTP as the underlying protocol. It facilitates collaborative editing and versioning. If you manage a Web server or an enterprise document management system, where different authors need to edit resources, WebDAV is a useful way of providing write access to them. You can use the Apache modules mod_dav and mod_dav_fs for basic WebDAV functionality, while a Subversion module for Apache, mod_dav_svn, provides versioning support.

WebDAV is a set of extensions for HTTP that facilitate collaborative Web authoring. It extends HTTP by adding methods for operations such as locking and unlocking, setting properties, searching based on a property, and deleting. Properties are the metadata that describe the resource; they can be any arbitrary key-value pairs. For instance, a resource may have a property called "TargetAudience" with a value "Accounts Department Staff." Versioning support is designed as an extension to WebDAV for maintaining different versions of the same resource on a server. Versioning support for WebDAV is popularly known as Delta-V.

Here are some of the major features of WebDAV:

Authoring:

  • File download and upload
  • Overwrite protection through locking
  • Information about the resource (metadata) on the server stored as a collection of properties
  • Copy or move the resource on the server
  • Access control
  • Searching

Versioning:

  • Check in, check out, cancel check out, update
  • Version control
  • Version reports
  • Merge

Setting up your Apache server for basic WebDAV functionality is fairly straightforward. mod_dav and mod_dav_fs are bundled with Apache and are installed by default. You can have WebDAV functionality up and running in three simple steps:

  1. Make sure that you have the following lines in your Apache configuration file httpd.conf and that they are uncommented:
    LoadModule dav_module modules/mod_dav.so
    LoadModule dav_fs_module modules/mod_dav_fs.so
    
  2. Make sure that the following lines are present in your httpd.conf file:
    DAVLockDB /var/lib/dav/lockdb
    Alias /dav /var/www/html/davRepository
    <location /dav>
    Dav On
    </location>
    
  3. Make sure that the permissions on the directory that you want to make available over WebDAV and the files inside it have suitable permissions, as Apache needs to access them.

Reload your Apache configuration by running /etc/init.d/httpd reload as root to make the configuration changes effective. Now you can add some files into the directory /var/www/html/davRepository and test the setup from a WebDAV client.

You should keep security considerations in mind when you set up a file share based on WebDAV. You can implement access restrictions using Apache's access control directives. You can also make these resources password-protected through authentication, using any of the mechanisms that Apache supports, such as Basic or Digest. You should never enable WebDAV functionality on Apache until you have access control in place.

WebDAV clients

Firefox has limited support for WebDAV. It can present the list of folders and files in the WebDAV folder, but you can only read files, and not make any modifications through the browser. You can view the directory listing using the URL http://hostname/dav/. This directory listing is similar to the regular directory listings generated by Apache.

If you want to upload new files to this folder or modify one of the existing folders, you can use a WebDAV-aware file browser like Nautilus and Konqueror. The URL for Nautilus is dav://hostname/dav. Once you've displayed the contents of this folder in the Nautilus window, you can simply drag and drop files from it to the local folders, or vice versa.

DavExplorer is a standalone DAV client written in Java. Unlike many other tools, it has support for WebDAV features such as editing metadata and versioning.

Cadaver is a command-line WebDAV client that ships with many Linux distributions. Its command syntax is similar to that of command-line FTP clients. You can launch cadaver by typing cadaver hostname/WebDAV share location -- for example, http://www.myhost.com/dav/. This puts you in a cadaver shell, much like an FTP shell, in which you can type commands like get, put, mget, and mput. Cadaver also has support for more WebDAV methods than file browsers like Nautilus, including methods like propset, propget, and propdel for managing the metadata related to the resource.

davfs2

Even though you may have support at the file browser level available for WebDAV, without support at a lower level, many non-WebDAV-aware applications cannot use or manipulate these resources effectively. davfs2 is a Linux filesystem driver that lets you mount WebDAV folders into your filesystem. Once mounted, you can treat WebDAV resources as virtual local resources.

davfs2 uses neon, a WebDAV client library, with a C interface. Download neon and install it, if it is not already installed. Download the davfs2 source archive, unpack it, and run configure, make, and make install as root, and you are all set to mount WebDAV shares into your filesystem.

Once davfs2 is installed you can mount a share in the dav directory on the server example.com at the mount point /mnt/dav on the localhost using the command mount -t davfs http://example.com/dav/ /mnt/dav.

davfs2 supports mounting even when the client is behind a proxy. It supports various authentication schemes, such as basic authentication and Kerberos. You can tweak davfs2 settings such as the location of client certificates, proxy settings, and various timeouts by editing the configuration file /usr/local/share/davfs2/davfs2.conf.

Versioning

In the above example, the Apache configuration directive Dav on enables DAV functionality for the given location and sets up the default filesystem provider (driver) called mod_dav_fs as the back end to interface with the filesystem. The main responsibilities of the provider are to provide lock and metadata management and to interface with the filesystem on the server. mod_dav is modular, and it can work happily with providers other than the default mod_dav_fs. mod_dav_svn is one such driver that makes Subversion repositories available over WebDAV. You can download mod_dav_svn as an RPM file and install it. For a simple mod_dav_svn configuration, add these lines to Apache's configuration file:

DAVLockDB /var/lib/dav/lockdb
<location /dav>
Dav svn
SVNPath /var/www/davrepo1
</location>

For a detailed discussion on the use of Subversion with Apache, see Version Control with Subversion.

WebDAV is a great way to turn the Web into a writable medium. With tools that are available across platforms and support for versioning, you can use WebDAV as a replacement for other file sharing mechanisms, as it makes the process of collaboration easier and more productive.

Murthy Raju teaches computer science and manages a small network of Linux computers at Rishi Valley School in India. He has worked in systems and network administration and technical support for various open source and commercial products on Linux, Unix, and Windows platforms for seven years.

Share    Print    Comments   

Comments

on Turn Apache into a collaborative authoring platform with mod_dav

Note: Comments are owned by the poster. We are not responsible for their content.

Turn Apache into a collaborative authoring platform with mod_dav

Posted by: Koldo on August 20, 2007 10:31 PM
How must I to begin ?

#

WebDAV Still Leaves A Lot To Be Desired

Posted by: Anonymous [ip: 38.118.20.90] on August 22, 2007 07:21 PM

WebDAV is nice, but lacking in some key areas -- notably authorization.



AuthENTICaction is handled nicely by Apache; plugins exist for LDAP, even "/etc/shadow" authentication. Authorization, however -- controlling who has access to which resources -- is pretty weak. At the filesystem level, all files need to be readable/writeable by the "httpd" process. Then, once connected, any authenticated user assumes that UID. You can't, for example, restrict access to a directory to only two people.



For many simple cases, this might be okay, but as soon as you start doing anything "industrial-strengthed" WebDAV starts to show its shortcomings.



Also, the "Versioning" part is misleading. One would think that "Web Distributed Authoring and Versioning" would actually INCLUDE versioning. No, it's merely a nice way of saying, "OH! You can use it with Subversion." You still have to USE Subversion, though -- i.e., run "svn co http://www.blablablah.com/dav/svn/lmnop..."



If WebDAV truly supported versioning, it would handle it transparently: when you save (upload or "PUT") a file, it should generate the appropriate historical information behind the scenes. Then you should be able to ask for, e.g., "/dav/myfile.txt?revision=1.2" or whatever.



I'm hopeful that these issues will be addressed in the future.



The idea of a web-based filesystem is certainly intriguing, though...



--

:- Dabe (www.Dabe.com)

#

Turn Apache into a collaborative authoring platform with mod_dav

Posted by: Anonymous [ip: 78.160.62.100] on December 07, 2007 05:51 AM
<a href="http://www.ramvideos.info">ram videos</a> <a href="http://www.justvideo.info">arab videos</a> <a href="http://www.yotobe-yutup.info">arab dance</a> <a href="http://www.videousa.info">hot dance</a>

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya