The new Firefox synchronizer

Mobile Devices

Using the sync server with a mobile Android device requires some extra effort. Configuring for Firefox is not easy because the mobile version of Firefox cannot be configured via the pseudo URL about:config. The box called "Configuring the Mobile Version of Firefox" contains a set of directions you can follow. Additionally, you can expect some bugs and limitations that will require workarounds.

Configuring the Mobile Version of Firefox

The mobile version of Firefox also synchronizes automatically with the Mozilla sync server after you log in to a Mozilla account. However, moving to your own server is not as easy with the mobile version as it is with the desktop version [2].

To begin, you will need to install the Firefox add-on fxa-custom-server-addon, which is currently in an experimental state. Then, the Firefox menu offers a dialog in which you should enter https://api.accounts.firefox.com/v1 for the login server and the address of your sync server. As indicated, only port 80 works here. At this point, you should either register a new account or log in to an existing account.

If you make a mistake, you will need to delete the account completely via the Android settings and start over from the beginning. One drawback of Firefox is that synchronization only works for all of the data when global background synchronization has been enabled.

The hosts file in Android is not accessible to the standard user. Thus, you can only communicate with the server via its IP address. This approach is not only inconvenient but it does not work with the Firefox sync server because the server expects contact to be established via the URL associated with public_url. The solution is to use your own DNS server, which can be installed with the command:

sudo apt-get install dnsmasq

Although Dnsmasq can deliver a high level of performance, you only need basic functionality. The service makes all of the host names from the local /etc/hosts file available on the network. The service retrieves addresses for remote computers via the configured DNS server from /etc/resolv.conf. Thus, only the hosts file has to be maintained on the Raspberry Pi. In the extended WiFi settings on the smartphone, you enter the IP address of the Rasp Pi as the first DNS server.

The second hurdle appears in the form of a bug in the mobile version of Firefox. This bug has been around since version 33 and should have been taken care of a long time ago. Nonetheless, it was still present in version 35. As a result, the mobile browser can only talk with the sync server when it listens on the default port 80 or 443.

You can deal with this shortcoming in two ways. The most obvious approach would be to change the port from 5000 to 80 in syncserver.ini. Because ports with port numbers under 1024 are privileged, they are reserved for services that execute with root privileges. An additional issue here is that the standard web server port would now be blocked by using it for this special service.

The proper solution involves a second "normal" web server that runs on the Raspberry Pi and supports so-called virtual hosts. For example, the server itself processes requests made to pi.myprivatenet.de but redirects requests made to ffsync.myprivatenet.de to the sync server on port 5000. The /etc/hosts file has to contain the names for both of these hosts. Additionally, both hosts have to use the same IP address.

This sounds more complicated than it actually is. Using commands from Listing 3, the lean web server Lighttpd can be installed and prepared for its tasks. Listing 4 shows how to configure the redirection of requests made to the sync server. Last but not least, you should change the host entry in syncserver.ini from 0.0.0.0 to 127.0.0.1 and the entry public_url from http://pi.myprivatenet.de:5000/ to http://ffsync.myprivatenet.de/. The first modification makes it impossible for the server to be accessed from outside the network. The second modification assigns the new URL to which the server will react.

Listing 3

Installing Lighttpd

01 # Install web server
02 sudo apt-get update
03 sudo apt-get install lighttpd
04
05 # activate proxy module
06 sudo lighty-enable-mod proxy
07
08 # create configuration file for the redirection of requests
09 # and copy data from Listing 3 to the file
10 nano /etc/lighttpd/conf-enabled/99-ffsync.conf
11
12 # do a fresh load of the configurations
13 sudo /etc/init.d/lighttpd force-reload

Listing 4

Redirect Requests

01 # redirection of ffsync.myprivatenet.de to the sync server
02 # for the file /etc/lighttpd/conf-enabled/99-ffsync.conf
03
04 $HTTP["host"] =~ "ffsync.myprivatenet.de" {
05     proxy.server  = ( "" =>
06             (( "host" => "127.0.0.1", "port" => 5000 ))
07     )
08 }

Only with Mozilla

This setup lets the sync server support both desktop and mobile versions of Firefox. However, nothing will work properly without first logging in to Mozilla. The ARM architecture of the Rasp Pi does not accommodate the Mozilla login server, even though Mozilla makes the server and rudimentary documentation available as open source downloads. Most of the server code is implemented with the help of Node.js in JavaScript. JavaScript is platform independent, but the Node.js plugins use native code for increased performance.

Some of these extensions use very special x86 commands (SSE) that ARM does not support. Thus, the code is not portable and cannot be installed and used successfully on the Raspberry Pi or other members of the Rasp Pi family. This may change in the future, but the status quo is what it is.

Buy this article as PDF

Express-Checkout as PDF

Pages: 6

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