Mozilla Firefox autoconfig

Firefox - Autoconfig

Posted By: pmietlicki

Published to Work on Jun 16, 2015

Configuration file

Create the config file (.cfg) where the firefox binary (or executable) is located, for example, firefox.cfg
Under Linux : /usr/lib/firefox/
Under Windows : C:\Program Files (x86)\Mozilla Firefox
Under OSX : /Applications/Firefox.app/Contents/MacOS

The important values to centralize the configuration are :

lockPref("autoadmin.append_emailaddr",false);
lockPref("autoadmin.global_config_url","http://yourserver.com/autoconfig/firefox.js");

Some information about these values could be found on :
http://web.mit.edu/~firefox/www/maintainers/config.html
https://mike.kaply.com/2012/03/16/customizing-firefox-autoconfig-files/
https://developer.mozilla.org/en-US/Firefox/Enterp...

Enable the configuration

You'll have to find the global settings for firefox, the default one for the system.

Under Linux : /etc/firefox/syspref.js
Under Windows : C:\Program Files (x86)\Mozilla Firefox\default\pref\autoconfig.js (create it)
Under OSX : /Applications/Firefox.app/Contents/MacOS/defaults/pref/autoconfig.js (create it)

Change it by adding these 2 lines :

pref("general.config.obscure_value", 0);
pref("general.config.filename", "firefox.cfg");

The first line "obscure_value" means that you don't want the file to be encrypted (disable byte shifting).

The centralized configuration

It is the file that will be read and load by firefox each time you launch it. You can set a lot of information or actions inside it, for example to change the home page, you can do :

// Set default homepage - users can change 
lockPref("browser.startup.page", 1); 
lockPref("browser.startup.homepage", "http://pascal-mietlicki.fr");

Debugging autoconfig

To be sure that the configuration file is really loaded, you can launch firefox in debug mode with this command :

NSPR_LOG_FILE=debug.log NSPR_LOG_MODULES=MCD:5 AUTOCONFIG_DEBUG=1 firefox &
cat debug.log

If the debug.log file is empty that means that the autoconfig is not functional. You should at least see something like that :

1359808640[7f0badb38580]: general.config.filename = firefox.cfg
-1359808640[7f0badb38580]: evaluating .cfg file firefox.cfg with obscureValue 0
-1359808640[7f0badb38580]: running MCD url http://yourserver.com/autoconfig/firefox.js

Tags: autoconfig, firefox

Archive