Phew, what a long title. Whatever. What do we need? First of all, a Debian system. I’m preffering a Debian Etch ‘n Half at this point. On that system, we need an Apache (2) and the PAM authentication module:
~# aptitude install apache2 libapache2-mod-auth-pam
Now, first of all we activate SSL and WebDAV:
~# a2enmod ssl
~# a2enmod dav
~# a2enmod dav_fs
Next, we tell our Apache to listen on 443, for SSL:
echo "Listen 443" >> /etc/apache2/ports.conf
Then, we configure our SSL VirtualHost:
NameVirtualHost *:443
<VirtualHost *:443>
ServerName my.serv.er
ServerAdmin webmaster@serv.er
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/my.serv.er.crt
SSLCertificateKeyFile /etc/apache2/ssl/my.serv.er.key
DocumentRoot /var/www/
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
</VirtualHost>
The certificate-folder needs to be created and the certificates need to be generated:
~# mkdir /etc/apache2/ssl
~# openssl genrsa -out /etc/apache2/ssl/my.serv.er.key 1024
~# openssl req -new -days 365 -key /etc/apache2/ssl/my.serv.er.key -x509 -out /etc/apache2/ssl/my.serv.er.crt
Next, we add the WebDAV/PAM settings to our SSL-VHost, while /home/pub is the folder we’d like to publish:
...
DAVLockDB /var/lib/apache2/DAVLockDB
Alias /pub /home/pub/
<Location /pub>
DAV On
AuthType Basic
AuthName "WebDAV"
AuthPAM_Enabled On
#AuthPAM_FallThrough Off
AuthUserFile /etc/shadow
ForceType text/plain
Require valid-user
</Location>
...
And last but not least, we (unfortunatelly) need to add the user www-data to the group shadow:
adduser www-data shadow
Now we can restart our Apache and enjoy the pleasure of WebDAV. If it should not work, check the permissions you set for the directory you’re publishing.
And what could this be used for? For example, as self-made iDisk. :-)
Enjoy.