/ Tutorial

For the Paranoids: Install Your Own Firefox Sync Server

Many people use Google Chrome, because they like it's fancy syncing feature. You know, open a tab on your PC and just continue on your phone. Or because of the nice built-in password manager. Just save that damn password and it's securely stored in your Google account and available everywhere.

But what about privacy? You can forget it when you use Chrome. You have no privacy there. Google can read all of your browser history, passwords and bookmarks.

Since the Quantum release, I switched to Firefox and really like that browser. Besides being a little bit faster, it's also completely open source (not like Chrome which is based on the open source Chromium) and Mozilla is a non-profit organization, so they aren't trying to use your data to show you personalized ads and generate a ton of revenue. But what makes Firefox even better is the possibility to use your own sync server.

Yep, you can run your own server, which is storing your bookmarks, add-on list, history, passwords, opened tabs, settings etc. And it's pretty easy to install with Docker.

You may know it from my previous post, I'm in love with Docker and even more since I discovered docker-compose and how beneficial it is to describe your whole server setup in a single YML-file. I assume, you know the basics of docker-compose.

The code for Firefox's sync server is hosted on GitHub and there's also a tutorial installing it the difficult way (directly on your server). There's a Dockerfile in the repository, but they didn't add it to Docker Hub and also give no instructions of how to use it.

Because we are not the first people facing this problem and searching for an easier way of how to install the Firefox sync server with Docker, someone already solved this problem for us.

You just need to paste this snippet in your services section in your docker-compose.yml-file:

    image: crazymax/firefox-syncserver:latest
    container_name: firefox-syncserver
      - 5000:5000
      - your-firefox-sync-volume:/data
      - TZ=Europe/Paris
      - FF_SYNCSERVER_PUBLIC_URL=http://localhost:5000
      - FF_SYNCSERVER_SECRET=5up3rS3kr1t
    restart: always

Make sure to also define the your-firefox-sync-volume or mount a folder for it.

I used this in conjuction with the popular nginx-proxy, to make proxy the service and make it available at my own domain with automatic HTTPS. If you also do it, you should set FF_SYNCSERVER_FORCE_WSGI_ENVIRON to true, because otherwise it might fail, due to not corresponging urls. The nginx-proxy tries to access http://yourawesomeurl.tld but you set FF_SYNCSERVER_PUBLIC_URL to https://yourawesomeurl.tld. (Just to warn you 😉.)

After you are done with that and deployed your Docker configuration to your server. open the URL in your browser (Firefox obviously) and see, if it show you a success message. Then proceed...

Now we have our sync server up and running. Now let's also use it.

It took me quite some time to figure out, where to set your sync server in Firefox, so here's what worked for me:

  1. Go to about:config and search for identity.sync.tokenserver.uri.
  2. Now change replace https://token.services.mozilla.com/1.0/sync/1.5 with https://yourawesomeurl.tld/token/1.0/sync/1.5. Don't forget the token, because the self hosted Firefox sync server is exposing the token server in a subdicrectory.
  3. Just to make sure everything is set up correctly, log out of Firefox (if you logged in before) and restart the browser.
  4. Now go to the settings, login with your Firefox account and the synchronization can start.

Remember: Although you have your own sync server, you still need to use Mozilla's account server. You can also run your own account server, but that's another topic. Using your own sync server, you only need Mozilla's server for signing in. So they will probably only have your name and email, but all your data (like bookmarks etc.) is stored on your own server now.

I hope this tutorial helped you and saved you from a few headaches, I got when I tried to setup my own Firefox Sync Server. Let me know, if it worked for you!



I'm a developer and a blogger. And I like to blog about software and development.

Read More