I want to access my calendar and addressbook from my mainframe and from my notebook. I write exams at the moment so it is the best time to do something else. I’ve setup a webdav to store my adressbook and calendar so I can access it with KOrganizer, Mozilla Sunbird or KAdressbook from everywhere.
First we have to create a directory for the webdav databases (lock, user).
mkdir -p /var/lib/apache2/dav
chgrp www /var/lib/apache2/dav
chmod 775 /var/lib/apache2/dav
Now we need a user
htpasswd2 -c /etc/apache2/dav_users.db <username>
Change <username> to your user and enter a password. Now lets create the web accessible directory.
chgrp www /srv/www/webdav
chmod 775 /srv/www/webdav
The next step is to create a config file and add the dav modules.
Edit /etc/sysconfig/apache2 and add “dav” and “dav_fs” to the APACHE_MODULES variable. Then create a file /etc/apache2/mod_dav.conf with the following content:
# Location of the WebDAV lock database.
# XML request bodies are loaded into memory;
# limit to 128K by default
# Location of the WebDav Repository.
Alias /webdav "/srv/www/webdav"
# enable webdav for this directory
AuthName "WebDAV Server"
# htpasswd2 -c /etc/apache2/dav_users.db <username>
<LimitExcept GET OPTIONS>
Allow from all
and include it in /etc/httpd.conf
Now you can access your webdav directory with http://domain.tld/webdav
I’m sure you want to access your server the secure way, so we need mod_ssl and a certificate. I have an CACert account so I created a real one 😉
You have to create a CSR (Certificate Signing Request) for CACert. This file contains pieces of information about your cert and your public key.
It is used by the Certification Authority to sign your cert.
Generate an encrypted key
Type the following command to generate a private key that is file encrypted.
openssl genrsa -des3 -out server.key 1024
You will be prompted for the password to access the file and also when starting your webserver. Warning: If you lose or forget the passphrase, you must generate another certificate.
If you decide at a later stage that you would rather use an unencrypted key (cause you don’t want to enter the key at boot time), you may create an unencrypted version of server.key in server.key.unsecure by executing:
openssl rsa -in server.key -out server.key.unsecure
Request a Server Certificate
Log in to your CACert account and post the CSR, you’ll will receiver the server.crt by mail. Replace the server.key in /etc/apache2/ssl.key and server.crt in /etc/apache2/ssl.crt with your CSR and your cert.
Edit in /etc/sysconfig/apache2 the add to APACHE_SERVER_FLAGS the option -DSSL. Restart your apache2 and connect e.g. with konqueror to your webdav and log in: