Building a Simple Calendar Server with Fedora and WebDAV
From FedoraNEWS.ORG
Written by Joost Soeterbroek on 2005-11-20
| Table of contents |
Introduction
Would you like to be able to view and edit your personal calendar and todo items from any location? It is relatively easy to set up and configure your own 'calendar server' on Fedora using just the Apache webserver and WebDAV. In this article I will show you how I've done it, plus I'll show you some other options that you might find interesting if you are a Fedora developer or supporter.
Server Configuration
You will need to store your calendar files on an Apache webserver with the DAV module enabled (this module is enabled by default on Fedora Linux). You can verify this by looking for the existence of the WebDAV lockfile location in your /etc/httpd/conf/httpd.conf file:
<IfModule mod_dav_fs.c> # Location of the WebDAV lock database. DAVLockDB /var/lib/dav/lockdb </IfModule>
You should also verify that the permissions and ownership of the directory are such that the webserver can write to it:
$ sudo ls -la /var/lib/dav/ total 28 drwx------ 2 apache apache 4096 Nov 18 20:52 . drwxr-xr-x 20 root root 4096 Oct 16 14:14 .. -rw-r--r-- 1 apache apache 0 Nov 18 20:52 lockdb.dir -rw-r--r-- 1 apache apache 1024 Nov 18 21:13 lockdb.pa
Next we need to create a directory on the webserver to serve our calendar files from:
$ sudo mkdir -p /var/www/html/cal $ sudo mkdir -p /etc/httpd/passwd/
The next step is to enable WebDAV for this directory. WebDAV stands for "Web-based Distributed Authoring and Versioning" and it enables us to edit and manage the calendar files on a Web server remotely from any calendar application. (See also www.webdav.org for more information on WebDAV.)
In /etc/httpd/conf/httpd.conf add these lines:
<Location /cal/> DAV On AuthType Basic AuthName "WebDAV Restricted" AuthUserFile /etc/httpd/passwd/passwords require user webdav </Location>
Restart the Apache webserver:
service httpd restart
This will enable WebDAV on your webserver only for the directory /cal and require anyone to authenticate with a username and password to make modifications. In this example the password will be stored in a file called /etc/httpd/passwd/passwords, and the username required will be "webdav".
We will create a new user and password to authenticate to the webserver. The username we will create should be limited to WebDAV operations only, in order to minimise the risk of your server being compromised. Later on we will configure the calendar client with this username and password.
Create a password file in /etc/httpd/passwd/passwords:
$ htpasswd -c /etc/httpd/passwd/passwords webdav
Now let's start by creating a new calendar file with some defaults:
$ sudo vi /var/www/html/cal/test.ics BEGIN:VCALENDAR VERSION :2.0 PRODID :-//Mozilla.org/NONSGML Mozilla Calendar V1.0//EN BEGIN:VEVENT UID :7805dc3c-7dd2-11b2-aa4f-a532c4236f23 SUMMARY :test event STATUS :TENTATIVE CLASS :PRIVATE X-MOZILLA-ALARM-DEFAULT-LENGTH :30 X ;MEMBER=AlarmEmailAddress :joebloggs@example.com DTSTART :20051117T100000 DTEND :20051117T110000 DTSTAMP :20051120T092422Z END:VEVENT END:VCALENDAR
Make sure it is readable and writable by the webserver:
$ sudo chown -R apache:apache /var/www/html/cal
Now that we've set up the basics we need to check that the authentication and WebDAV setup are working correctly.
On the client host open your Mozilla Firefox web browser and point it to the location of the calendar file we've just created on the webserver, e.g. http://www.example.com/cal/test.ics. Observe that you will be prompted for a username and password. Authenticate yourself with the username 'webdav' and the password you created before. You should now be able to see the raw contents of the calendar file you created earlier.
If this is working for you we should also check correct WebDAV operation with a webdav client. In this example below we will use cadaver, a command-line WebDAV client.
In a terminal window type in the following command (you may need to install the cadaver package first):
$ cadaver http://www.example.com/cal Authentication required for WebDAV Restricted on server `www.example.com': Username: webdav Password:
On the cadaver client prompt you can try this for example:
dav:/cal/> cp test.ics test2.ics Copying `/cal/test.ics' to `/cal/test2.ics': succeeded. dav:/cal/> delete test2.ics Deleting `test2.ics': succeeded. dav:/cal/> dav:/cal/> exit Connection to `www.example.com' closed
Now that we are sure that everything is set up correctly, we move on to the next step, the client setup.
Client Configuration
We will configure a client which can understand the vCalendar protocol. There are a number of client applications on a number of different OS's that understand the vCalendar protocol, the protocol of the .ics calendar files.
On the Mac we can use iCal, on Windows we can use Outlook and the Mozilla Firefox calendar extension.
On Fedora Linux we can use either Evolution (check if you've installed evolution-webcal RPM), KOrganizer or the Mozilla calendar client. I was able to correctly configure Evolution for my calendar files on the server, but read-only. Next, I tried the Mozilla Firefox Calendar extension which worked like a charm (see the screenshots below).
In order to install the Mozilla Calendar extension on Fedora linux point your Mozilla Firefox browser to http://www.mozilla.org/projects/calendar/download.html. Follow the installation instructions. Once you are done you will need to restart the Mozilla Firefox browser. The Calendar can now be found under the 'Tools' menu option. Note that the installation procedure is exactly the same for any other OS/platform running Firefox.
Configure the client for your calendar file:
File -> New Calendar file
Enter a name and a color for the calendar. Next, enter the Remote Server URL using the following syntax: http://<username>:<password>@<webserver>/cal/<calendar_file>, with the webdav username and password you created earlier cleverly embedded in the URL string , as in this example dialog:
Press OK. You should now be able to view and edit your new calendar.
With the procedure described in this article you can create as many calendars as you want, for example one for everyone in your family or organisation. You can view and compare multiple calendars in the same window using different colors to distinguish between them.
One other neat feature is that you can view (read-only in most cases) calendar files that other people have published on the web. Two interesting examples of public on-line calendars for Fedora developers and enthusiasts are shown below:
The link on this page http://fedora.redhat.com/participate/schedule/ will add the Fedora schedule, including the todo items, to your calendar application.
If you want to keep track of certain components in RedHat's bugzilla application, note that the bug list screen provides you with a link called 'iCalendar'. Clicking on this link will allow you to track all the activities and bugs reported for that particular component.
This is how it will all look in the Mozilla Firefox calendar:
Resources
- http://fedora.redhat.com/participate/schedule/
- http://www.macdevcenter.com/lpt/a/2732
- http://www.webdav.org/
- http://www.twilight-systems.com/flacco/mozcal/
- http://www.vetula.com/blog-radio/stories/2002/11/19/publishingEventsInMozilla.html
About the author
Joost Soeterbroek is currently working as a Linux Consultant/Engineer. He can be reached at <joost AT soeterbroek.com>




