Thursday, August 21, 2008

Self Hosted: Foxmarks Bookmarks Server (WebDAV)

A while ago I stumbled upon Google Browser Sync and got instantly hooked - I don't mind selling my soul to Google, it's a small price to pay for the comfort of having all my bookmarks, passwords and browsing history get automatically synchronized between all the computers I happen to use.

Privacy is for the weak.

And then something terrible happened: the service was discontinued. Did I learn my lesson? heck no. It had already become part of my routine, to bookmark some website at work, so as to check it out in detail later, at home (and vice versa).

Like, I imagine, many other disenchanted GBS users, I started looking into other synchronization solutions. The only other service that is meant to provide the same, and more, features is Mozilla Weave. But it's still in early beta, and as I write this they don't accept new users into their system. Which leaves us sync-hungry dolts with bookmarks-only synchronization services.

I've picked Foxmarks, because they sync the built-in browser bookmarks, and not some separate online list of links. Plus, the bookmarks can be stored on my own (WebDAV) server!

The Foxmarks support wiki points to an article that explains how to setup WebDAV on Apache2. I basically followed their instructions, but that HOWTO is a bit outdated - it took some futzing around before I got it right. I recommend reading the mod_dav section in the Apache2 Manual, and a more recent HOWTO at howtoforge.com.

So here's how I did it:

  1. enable modules:
    a2enmod dav_fs 
    a2enmod auth_digest
    
  2. create the directory for bookmarks storage:
    mkdir -p /var/www/foxmarks/.webdav

  3. generate passowrd (zungbang is the username - use your own!):
    htdigest -c /var/www/foxmarks/.webdav/.digest-password foxmarks-webdav zungbang

  4. make sure all files are owned by the www-data user:
    chown -R www-data:www-data /var/www/foxmarks

  5. create /etc/apache2/sites-available/foxmarks:
    <VirtualHost *:80>
    ServerName foxmarks.example.com # fake! fake! fake!
    ServerAdmin webmaster@example.com
    DocumentRoot /var/www/foxmarks
    <Directory />
    Options FollowSymLinks
    AllowOverride None
    order allow,deny
    Allow from all
    </Directory>
    Alias /webdav /var/www/foxmarks/.webdav
    <Location /webdav>
    DAV On
    AuthType Digest
    AuthName "foxmarks-webdav"
    AuthDigestProvider file
    AuthUserFile /var/www/foxmarks/.webdav/.digest-password
    Require valid-user
    </Location>
    ErrorLog /var/log/apache2/error.log
    LogLevel warn
    CustomLog /var/log/apache2/access.log vhost_combined
    </VirtualHost>
    


  6. enable the new site and restart the webserver:
    a2ensite foxmarks
    /etc/init.d/apache2 restart
    


  7. test the setup with cadaver
    aptitude install cadaver
    cadaver http://foxmarks.example.com/webdav
    
    you should be prompted for a username and password and succefully log in - use help to list available commands.



  8. install the Foxmarks add-on, and configure it to access your own server at: http://foxmarks.example.com/webdav/foxmarks.json


It took several browser restarts before the Foxmarks browser add-on agreed to connect to my server for the first time (this happened on three different machines). Other than this initial mess, Foxmarks now works like a charm, correctly synchronizing my bookmarks. By the time I had this working though, an enterprising fellow found a way to hack Mozilla Weave into using a private server for storage. It too uses WebDAV, so most of the stuff above still applies. I guess I'll switch to Mozilla Weave eventually, but it'll take a while.

 [01 Sep 2008] UPDATE: "works like a charm" was a bit of an exaggeration... a few minutes ago I found out that the bookmarks store file foxmarks.json simply disappeared - I don't know how or why, but it was definitely gone. It wasn't a big deal though - I just restored the file from the nightly backup. I could've probably also attempted to "force overwrite of server bookmarks" by hitting the Upload button at the advanced tab in the Foxmarks settings dialog box, but I didn't.

 [13 Sep 2008] UPDATE #2: It happened again. Well, not quite - this time the file foxmarks.json was still there, yet it was truncated at about half its size, and the Foxmarks add-on refused to synchronize (I got a tiny red question mark right next to the Foxmarks icon in the status bar). I tried the Upload button and it worked. I'm not amused.

 [16 Oct 2008] UPDATE #3: as of version 2.5.0 Foxmarks provides password synchonization - I've been using it for the past three days and it seems to be working nicely. I'm not sure about using Mozilla Weave anymore, but who knows...

 [17 Apr 2009] UPDATE #4: I've recently updated Foxmarks to Xmarks version 3.0.2. The option to use my own server was automatically disabled, so I had to re-enable it. But for some reason I couldn't get it to sync - I only got an unspecified error in the log. I was finally able to get it working by forcing Xmarks to download the bookmarks and passwords from the server (press the Download button in the Manual Overwrite section of the Advanced tab in the Xmarks settings dialog box).

I also disabled all the options under the Discovery tab - I don't need it, and I guess it requires an Xmarks account anyway.

Mozilla Weave Beta is now open again to new users but it requires Firefox v3.5, and I'm using Iceweasel 3.0.2 (Debian/Squeeze), so it's not an option yet.

2 comments:

  1. "Privacy is for the weak."

    That has to be one of the stupidest things I've heard in a long time. You've obviously never lived in a country with very little freedom.

    Calling people "weak" because they value their privacy is arrogant and foolish.

    ReplyDelete
    Replies
    1. Well, Mr. Anonymous, I was lamenting my own weakness in using google's bookmark sharing service, trading my own privacy for comfort.

      The whole point of this post was to demonstrate how to *maximize* privacy by storing the bookmarks on your own, self hosted, webserver.

      I'm sorry you missed the point, I'm sorry that you missed my sarcasm here, I'm sorry that you came out as both arrogant and foolish in your response.


      Delete