Using a Raspberry Pi to synchronize data

Firefox Sync

For many years now, Firefox has had its own integrated sync engine. This makes it possible to synchronize bookmarks, cookies, passwords, and so on across different browser installations. The data being synced up resides on servers hosted by Mozilla.

The process is considered secure because the browser encrypts and decrypts the data on the client side. Because Mozilla doesn't have the key, it cannot gain access to the data. In spite of this exemplary process, it still makes sense to operate your own sync server, especially if you are interested in making it more difficult for third parties to spy on your data.

The original server has been implemented in Python, but, in this case, I will use the lean PHP version FSyncMS, or Firefox Sync Minimal Server [4]. You should decompress the package in the root directory /var/www/ of the web server. You will find the command in Listing 2. The mv command makes the path somewhat easier to understand, and chown establishes the correct access rights. The data is saved in an SQLite3 database. The script also installs the necessary PHP module.

Listing 2

Installing FSyncMS

#!/bin/sh
# Install FSyncMS
wget "https://www.dataharbour.de/FSyncMS.tar.gz"
if [ -f "FSyncMS.tar.gz" ]; then
  tar -xvzpf "FSyncMS.tar.gz" -C /var/www
  mv "/var/www/FSyncMS" "/var/www/ffsync"
  chown -R www-data:www-data "/var/www/ffsync"
  rm -f "FSyncMS.tar.gz"
fi
# Install interface between PHP5 and SQLite
apt-get update
apt-get install php5-sqlite
/etc/init.d/lighttpd restart

You should call up the web page http://<RasPi-IP>/ffsync/ for the initial configuration of the sync server. It is important to remember to delete the setup.php file in the installation directory afterward. You should also check the content of the settings.php file; in particular, you might have to adjust the path of the server.

If you want to connect the server over the Internet, then you should move the SQLite file out of the web server directory and similarly adjust the new path in the configuration file.

Installation takes only a few minutes. The status page http://<RasPi-IP>/ffsync/index.php/ shows whether the installation has been successful. Even though you will receive an error message in response, this message actually means that the server is processing the request. Then, all you will have to do is set up an account and connect the Firefox browser on all of the participating devices to the account.

Before Firefox 29, Firefox Sync employed a single-use recovery key when pairing with a new device [5]. Both devices knew the secret key, enabling secure communications. A lost device meant a lost secret key and lost Sync data.

In newer versions, Firefox Sync uses the usual email address and password through Firefox Accounts (Figure 3), eliminating the "pairing" of devices and enabling you to recover data in a familiar way. To set this up, click Edit | Preferences and select the Sync tab. Next, click on Set Up Firefox Sync. In the dialog box that comes up, select Create a New Account and fill out the fields accordingly. You can recall any potential error reports directly in the browser via the pseudo-URL about:sync-log.

Figure 3: Firefox makes it easy to synchronize several browser installations on a central server – in this case, a Raspberry Pi.

Appointments and Addresses

Almost every smartphone user synchronizes appointments and calendar information with the manufacturer of the operating system, which is most often Google or Apple. This means that sensitive data can fall into the hands of third parties. Various open source projects attempt to offer a freeware alternative; one of the best known is called ownCloud.

From its beginnings, however, the ownCloud project has struggled with performance and stability problems. Instead of fixing these problems, the developers prefer to build "cool" features into each new version, often much to the dismay of users. The one advantage of ownCloud is that a number of providers offer ownCloud instances or accounts for a very good price. However, the low-cost accounts are of little help with the scenario presented here.

OwnCloud woos users with claims that user data will be secure. The data is encrypted before being placed on the provider servers. However, what the company doesn't tell you is that encryption is not performed on appointment and calendar data. Clients have access to both with the CalDAV or CardDAV protocols, neither of which offer client-side encryption. The data transport is accomplished via HTTPS.

This is reason enough to host the data by yourself; however, Baikal [6] could be a better alternative to self-hosting because of its performance and stability. The tool can only synchronize appointment and address data via the CalDAV or CardDAV protocols, but it does so flawlessly. It does not support groupware functions like public calendars and appointment planning across multiple calendars.

Buy this article as PDF

Express-Checkout as PDF

Pages: 8

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content