WebDAV + iCal

As it feels good to be free from any restrictions here is a link to an article that teaches you how to configure your own Apache server to act as a WebDav server for iCal : shawnwall.com – teach(“webDAV + iCal”)).

And following is the story itself – a copy/paste for my own archives and for those days in the future that the above link no longer works:


introduction

this article will show you how to configure webDAV support for apache on your os x box, as to enable support for storing your ical calendars so you won’t have to pay for .mac services. the webdav configuration settings throughout this document were originally found in an cached webdav article at goliveheaven written by jeep hauser, which are used throughout this document to set up webdav for integration with ical. the credit for the technical underpinnings goes to him.

requirements are a mac running os x 10.2 with root enabled, ical installed, and some knowledge of editing files in a unix shell using an editor such as vi or emacs. also, for access of your stored calendars from outside locations, you will need permanent broadband access for your mac, and know its IP address.

preparation

open up a new session in the Terminal Application, su to root, and execute the following commands:

CD /Library/Webserver/Documents
mkdir DAVdocs
mkdir ../DAVLock
chown www:www DAVdocs
chown www:www ../DAVLock

in the lines above we created the directories necessary for our setup, and changed the ownership permissions so that apache can access them correctly. now that we have prepared for the configuration changes, we will need to setup apache to work with webDAV.

apache configuration

change your directory to /etc/httpd/ and edit the file httpd.conf using the command emacs httpd.conf or your favorite editor’s command. first we need to enable the webDAV module by searching for the following two lines [they are separate in the file] and uncomment them one at a time [remove the #]:

#LoadModule dav_module libexec/httpd/libdav.so

#AddModule mod_dav.c

next we will need to insert the appropriate apache directivies to identify our webDAV settings and preferences. insert it before the code block containing:

<Directory "/Library/WebServer/Documents">

the code block to insert is:

#
# Settings for WebDAV Server
#
DAVLockDB /Library/WebServer/DAVLock/DAVLock
DAVMinTimeout 600
DAVDepthInfinity On

<Directory /Library/WebServer/Documents/DAVdocs>
DAV On
AllowOverride AuthConfig
AuthName "DAV Restricted"
AuthType Basic
AuthUserFile /Library/WebServer/users
<Limit PUT POST DELETE PROPFIND PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
Require valid-user
</Limit>
</Directory>

you are now done editing the apache configuration file, so please save it, and exit your editor [C-x C-s C-x C-c in emacs].

security

after setting up apache to be able to function with the webdav server, next we will secure the webserver so that ruffians will not attempt to also store their calendars and do various other malicious things to your beloved computer (like connect to it with goliath and screw with your files). to do this we will protect the DAVdocs directory with apache’s built in access control. first let’s create a the password file that apache will refer to for access control:

root# CD /Library/Webserver
root# htpasswd -c users davuser
New password:
Re-type new password:
Adding password for user davuser

the htpasswd command created a file called users and the first user created was called davuser. be sure to enter a secure password, and write it down in case you forget it. next we will create the .htaccess file to secure our DAVdocs directory. we will put this file in the directory we wish to protect, and it will reference the password file we created when the directory is accessed through a web browser. first change directory to /Library/Webserver/Documents/DAVdocs/ then create the new file called .htaccess containing the following text:

AuthName "DAV Restricted"
AuthType Basic
AuthUserFile /Library/WebServer/users

require valid-user

be sure to also chown www:www .htaccess also. our work is complete, so we must restart apache by either going to System Preferences->Sharing and stopping/starting Personal Web Sharing, or by typing apachectl graceful restart in the command prompt. next we are ready to test things out.

testing

to test out what we’ve done, point your web browser to http://your.ip.or.hostname/DAVdocs/ and see if apache will prompt you for a username and password, if so enter davuser and the password you entered earlier. the directory should be empty right now.

fire up ical and select one of your calendars, then click Calendar->Publish in the drop down menu. Choose the ‘Publish on a web server’ option, and ical will prompt you for a URL, username, and password. the URL is the same http://your.ip.or.hostname/DAVdocs/ you tested earlier, and enter the same htaccess login information. your .ics should now be published, and is ready to be emailed to others for access, or ready for download on another mac [if you are lucky enough to have more than one in your home or office such as i].

conclusion

apache, webdav, and ical should all be working together, and i hope you enjoy using them. keep in mind that if you are in the only one in your group of friends with a static IP on your broadband connection, you could set up your machine as the webDAV server for your group of friends. you can add more logins to the htpasswd file you created by typing htpasswd users name in the /Library/Webserver/ directory, where name is the username of the user you wish to add.

i am pleasantly surprised with ical considering it is only a 1.0 application at the time this article is being written, and it already appears quite stable and full of features. if you have any questions or comments regarding this article let me know at wall at shawnwall dot com.

resources

© shawn wall 2000-5

This entry was posted in asides, code. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • Word of the Moment

      "Voice or no voice, the people can always be brought to the bidding of the leaders. That is easy. All you have to do is tell them they are being attacked, and denounce the pacifists for lack of patriotism and exposing the country to greater danger. It works the same in any country." - Hermann Goering (1893 - 1946), 2nd in command of the Third Reich
  • You can LIVE CHAT with me!

  • MyDiet

  • iPhone

  • Asides

    • Day Grid Balancer . David Seah writes, "I really suck at work-life balance, and have started to crave some way of visually representing the essential elements of a good ...

    • Tweetie for iPhone and the Mac too - atebits. Hesitant to get another Twitter application for my phone but due to good reviews I was looking at their site and then downloaded the desktop ...

    • Function Reference « WordPress Codex. Many questions can be answered here, and definitely a useful stop before heading over to the user forum to ask: The files of WordPress define many ...