Firefox Sync Server : create your own Sync Server
|Operating System||Debian 7|
|Website||Firefox Sync Server Website|
Firefox Sync, originally branded Mozilla Weave, is a browser synchronization feature that allows users to partially synchronize bookmarks, browsing history, preferences, passwords, filled forms, add-ons and the last 25 opened tabs across multiple computers.
It keeps user data on Mozilla servers, but the data is encrypted in such a way that no third party, not even Mozilla, can access user information.
Firefox Sync was originally an add-on for Mozilla Firefox 3.x and SeaMonkey 2.0, but it has been a built-in feature since Firefox 4.0 and SeaMonkey 2.1.
First of all, we need to install those dependencies :
aptitude install python-dev mercurial python-virtualenv make gcc
Then we will install MariaDB.
To install MariaDB, it's unfortunately not embedded in Debian, so we'll add a repository. First of all, install a python tool to get aptkey :
aptitude install python-software-properties
Then let's add this repository (https://downloads.mariadb.org/mariadb/repositories/) :
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db add-apt-repository 'deb http://mirrors.linsrv.net/mariadb/repo/10.0/debian wheezy main'
We're now going to change apt pinning to prioritize MariaDB's repository :
Package: * Pin: release o=MariaDB Pin-Priority: 1000
Then install MariaDB :
aptitude update aptitude install mariadb-server
Now we will need that package also to be able to build the server.
aptitude install libmariadbclient-dev
We can now get the sources :
cd /usr/share hg clone https://hg.mozilla.org/services/server-full firefox_sync cd firefox_sync
And launch the build :
Let's install the latest Python module and Guinicorn (WSGI HTTP Server) :
./bin/pip install Mysql-Python ./bin/pip install gunicorn
We are going to create a dedicated user for this application and reset rights :
groupadd firefoxsync useradd -d /usr/share/firefox_sync -g firefoxsync -r -s /bin/bash firefoxsync chown -Rf firefoxsync. /usr/share/firefox_sync
Alright, all the installation is now finished. Let's configure everything.
You need to create a database and user (fit with your informations) :
CREATE DATABASE firefox_syncdb; CREATE USER 'firefox_sync'@'localhost' IDENTIFIED BY 'password'; GRANT ALL ON firefox_syncdb.* TO 'firefox_sync'@'localhost' IDENTIFIED BY 'password'; FLUSH privileges;
4.2 Sync Server
Edit the configuration to set database informations :
[captcha] use = true public_key = xxxxxxxxxxxxxxxxxxxxxxxx private_key = xxxxxxxxxxxxxxxxxxxxxxxx use_ssl = false [storage] backend = syncstorage.storage.sql.SQLStorage sqluri = mysql://firefox_sync:[email protected]:3306/firefox_syncdbstandard_collections = false # Set quota and size use_quota = true quota_size = 5120 pool_size = 100 pool_recycle = 3600 reset_on_return = true display_config = true create_tables = true [auth] backend = services.user.sql.SQLUser sqluri = mysql://firefox_sync:[email protected]:3306/firefox_syncdbpool_size = 100 pool_recycle = 3600 create_tables = true # Uncomment the next line to disable creation of new user accounts. #allow_new_users = false [nodes] # You must set this to your client-visible server URL. fallback_node = http://firefoxsync.deimos.fr:5000/ [smtp] host = localhost port = 25 sender = [email protected] [cef] use = true file = syslog vendor = mozilla version = 0 device_version = 1.3 product = weave
|It's preferable to use SSL connection. If you have autosigned certificates, open manually the URL with firefox to accept them and avoiding errors|
If you're not going to use Nginx, check that your firewall port is open on 5000 port number :
iptables -t filter -A INPUT -p tcp --dport 5000 -j ACCEPT
For more security and if you're going to use a web server like Nginx, it's better to listen only on localhost. In addition, you need to change the 'use' parameter from http to gunicorn. And to finish, you also need to change the log path :
Then let's create those folders :
mkdir -p /var/log/firefoxsync /var/run/firefoxsync chown firefoxsync. /var/log/firefoxsync /var/run/firefoxsync
You can now try to manually launch the server if you want and sync a user :
su - firefoxsync -c '/usr/share/firefox_sync/bin/gunicorn_paster /usr/share/firefox_sync/development.ini &'
Then kill it once you've tested it as we're going to add an init script for it.
Adapt the configuration to your needs :
Then enable it :
ln -s /etc/nginx/sites-available/firefoxsync.deimos.fr /etc/nginx/sites-enabled/ service nginx reload
As there is no init script to launch it automatically on boot, we're going to change that :
Then update it on runlevels and start it :
cd /etc/init.d chmod 755 firefoxsync update-rc.d firefoxsync defaults /etc/init.d/firefoxsync start
You will see logs are verbose enough to install a logrotate script :
To upgrade the sever, simply run those commands as root :
/etc/init.d/firefox_sync stop cd /usr/share/firefox_sync su - firefoxsync hg pull hg update make build exit /etc/init.d/firefox_sync start
On the client side, there is one account to create and specify the url of the server. Then you could associate all your device to this account.