Even though the tutorial is extensive it’s fairly easy if you already have WebDav setup on your server. Actually, these instruction on how to setup apache with webdav is excellent.
(via Create your own Mozilla Weave server | Remco Bressers’ Blog)
Create your own Mozilla Weave server
updated: Fri Jul 18 : Added SSL VirtualHost configuration for a secure environment.
Mozilla Weave is a pretty neat extension to the pretty neat Firefox 3 browser. This extension can synchronize your bookmarks, cookie data, saved passwords, history and form data to a WebDAV server maintained and hosted by Mozilla.
Since Weave is only at version 0.2.2 (at the time of writing), the project is heavily in development and the WebDAV server is dead slow and offline from time to time. The nice thing about free mozilla stuff is that almost everything is possible, even building your own WebDAV server.
We don’t just want a WebDAV server, but we want the exact same setup as Weave uses, including tight user authentication and security on the storage. The only thing that really bothers me, is that there’s still no satisfying solution for quota support in WebDAV, except for using patched mod_dav and Apache versions.
As a base system, i’m using CentOS 5.2
Apache
First, we’re going to install Apache, and configure the stuff
# yum install httpd# vi /etc/httpd/conf/httpd.confMake sure the mod_dav and mod_dav_fs modules are loaded in the configuration file
LoadModule dav_module modules/mod_dav.soLoadModule dav_fs_module modules/mod_dav_fs.so<IfModule mod_dav_fs.c> DAVLockDB /var/lib/dav/lockdb</IfModule>The last section is there by default, but i’ll just post what’s really needed to get things working.
Now, we’re going to build the VirtualHost
<VirtualHost *:80>ServerName weave.yourdomain.com DocumentRoot /home/www/weave.yourdomain.com/wwwErrorLog /var/log/httpd/weave_yourdomain_com-error.log CustomLog /var/log/httpd/weave_yourdomain_com-access.log combined<Directory "/home/www/weave.yourdomain.com/www">Options Indexes FollowSymLinks AllowOverride AuthConfig Limit Order allow,deny Allow from all AuthType Basic AuthName "WebDAV Restricted" AuthUserFile /home/www/weave.yourdomain.com/passwords require valid-user</Directory><Location /> DAV On </Location></VirtualHost>
As you can see, we’re using the directory /home/www/weave.yourdomain.com/www as our DocumentRoot. Valid users from the file /home/www/weave.yourdomain.com/passwords can browse to the DocumentRoot. We will restrict further user-access by using .htaccess files in the “users” directory lateron.
The <Location /> statement enables DAV on the DocumentRoot.
Now, let’s save the thing and create the necessary directories:
cd /home/wwwmkdir -p weave.yourdomain.com/www/user/remcochown -R apache:apache weave.yourdomain.comFor each user, we’ll create a .htaccess file in their directory:
cd /home/www/weave.yourdomain.com/www/user/remcovi .htaccess require user remcochown apache:apache .htaccessFinally, we’ll make the passwords file:
htpasswd -c /home/www/weave.yourdomain.com/passwords remcoNew password:Re-type new password:That’s it for the installation. Next up: Weave!
Weave
I’m using Weave 0.2.2, downloaded from http://people.mozilla.com/~cbeard/weave/dist/
If you never used Weave before. It’s necessary to first make a profile at Mozilla. After Weave is succesfully configured and syncing to a Mozilla server, you can change properties.If you have configured Weave, click on the Weave logo in the bottom right of your screen and select ‘Preferences’. After that, sign out on your current Weave login at Mozilla. Click on the Advanced tab and change your Server Location to http://weave.yourdomain.com and start a Sign In.
Et Voila! You are connected to your own Weave WebDAV server. Start syncing at real speeds
If you encounter problems, you can always look at the activity log. If you STILL encounter problems, try to flush server data.Weave over HTTPS / SSL
If you want to have a secure connection, you will need SSL for that. Installation is already done when you have installed Apache on CentOS 5. If you have doubt, check to see if you have mod_ssl and openssl installed with Yum or whatever tool you’re using.
To use SSL, you have to create the next VirtualHost next to the VirtualHost you already created on port 80. Ofcourse you can also completely disable the VirtualHost on port 80 if you really really don’t want a plain connection.
The configuration you have to add is the following :
<VirtualHost *:443> ServerName weave.yourcomain.com DocumentRoot /home/www/weave.yourdomain.com/www ErrorLog /var/log/httpd/weave_yourdomain_com-error.log CustomLog /var/log/httpd/weave_yourdomain_com-access.log combined <Directory "/home/www/weave.yourdomain.com/www"> SSLRequireSSL Options Indexes FollowSymLinks AllowOverride AuthConfig Limit Order allow,deny Allow from all AuthType Basic AuthName "WebDAV Restricted" AuthUserFile /home/www/weave.yourdomain.com/passwords require valid-user </Directory> <Location /> DAV On </Location>SSLEngine onSSLProtocol all -SSLv2SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOWSSLCertificateFile /etc/pki/tls/certs/localhost.crtSSLCertificateKeyFile /etc/pki/tls/private/localhost.key<Files ~ "\.(cgishtmlphtmlphp3?)$"> SSLOptions +StdEnvVars</Files><Directory "/var/www/cgi-bin"> SSLOptions +StdEnvVars</Directory>SetEnvIf User-Agent ".*MSIE.*" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0</VirtualHost>
NoteNote that when you are using a self-signed certificate (like i do), you need to browse to https://weave.yourdomain.com/ and accept the certificate, before it will work in Weave. If you don’t do this, Weave will give you the error “Username / password incorrect”.
Note #2
If you happen to be running Weave 0.2.5 and notice a huge memory and CPU increase, disable the TAB synchronization. There’s a known bug in 0.2.5 that eats your memory.
Download Weave now at:
http://people.mozilla.com/~cbeard/weave/dist/latest-weave.xpi


