Skip to content

porelli/firefox-sync

Repository files navigation

firefox-sync

The purpose of this repository is to provide a docker-compose that can be used to self host what otherwise Firefox sync would send to Mozilla's servers.

Disclaimer

  • ⚠️ The project is under development
  • ⚠️ Expect bugs, breaking changes and headache
  • ⚠️ This is not endorsed or supported by Mozilla in any way or form
  • ⚠️ Do not solely relay on this project to store your bookmarks, passwords and/or other important items

Security considerations

  1. - syncstorage-rs does NOT support account allowlisting. This means that ANY person that has network access to your server can use it.
    • This has been implemented with a SQL trigger workaround that prevents the token database to insert more rows when a new user tries to use the server. This is tested and prevents a new account from using your server if the number of MAX_USERS defined in your .env file is already reached.
    • Possible alternative (better) solutions:
      • implement the feature directly in syncstorage-rs
      • add the entire rest of the Mozilla stack so that authentication is performed and validated locally

Background

Mozilla's server side components are open source and Firefox allows to easily change the official endpoints. Some documentation is provided to install the each component on your own server but this is neither offically supported or very well maintened. Furthermore, there are no official Docker images that can be used to avoid installing everything manually; all the instructions and artifacts provided are focused on setting up a developer environment rather than a production self hosted service. For example, syncstorage-rs has a docker release on docker-hub but it is targeted to work exclusively with Google Spanner which is what Mozilla uses to provide the service.

Content and scope of this project

  • GitHub workflows to create docker images as vanilla as possible from Mozilla's code
  • Docker compose to setup required component to self host Mozilla sync components
  • examples to configure other parts of the infrastructure
  • instructions to setup your browser to use the self hosted infrastructure

Docker images currently published

All the images are updated weekly to the latest tag available from Mozilla's official repositories

Server setup

  1. clone this repositoy
  2. run ./prepare_environment.sh to automatically prepare your .env file and conf examples according with your variables
  3. setup your reverse proxy server
    1. if you use nginx, check the syncstorage-rs.conf as example
  4. start docker compose: docker compose up
  5. OPTIONAL: Install the systemd service (see firefox-sync.service) and enable it
    • all the containers are alredy set to restart automatically; stopping Docker (for example when you shutdown your computer) will automatically stop all the services gracefully and restart them once Docker is starting again

Firefox setup

Pre-requisite: if you already logged into your Firefox account you need to temporarily disconnect it

The below examples assume your server respond to this domain: firefox-sync.example.com

Desktop

  1. point a browser tab to about:config and search for identity.sync.tokenserver.uri
  2. change it from the default to https://firefox-sync.example.com/1.0/sync/1.5
  3. log in to Firefox and start syncing.

Debug

  1. check logs pointing a browser tab to about:sync-log

Android

  1. go to App Menu > Settings > About Firefox and click the logo 5 times. You should see a debug menu enabled notification
  2. go back to the main setting menu and you will see Sync Debug at the top, just under the Syncronize and save your data box. Tap on it
  3. tap on Custom Sync server and set it to https://firefox-sync.example.com/1.0/sync/1.5
  4. log in to Firefox and start syncing.

iOS

  1. go to App Menu > Settings and tap 5 times on the version number (i.e.: Firefox 127.1 (42781)) towards the bottom
  2. go back at the top of the main setting menu and you will see Advanced Sync Settings at the top, just under the Sync and Save Data. Tap on it
  3. activate Use Custom FxA Content Server and set Custom Account Content Server URI to https://firefox-sync.example.com/1.0/sync/1.5
  4. log in to Firefox and start syncing.

Credits