In this post I will explain how to create a custom firefox installation for an enterprise environment.
I will start with explaining how to extract the original setup-file, than how to change the default settings, how to create lock settings, changing the default website, add default extensions and finally how to create a new compact setup-file. This post focus on the windows installer but some parts can also be used for OS X or Linux (than again… good luck using those two in an automated enterprise environment).
The following tools are needed and you can download them by following the links:
- Windows build-in extractor
- Firefox setup file (en-US)
- 7zSD.sfx and app.tag (only needed when you create a new setup-file)
Note: about 7zSD.sfx and app.tag: you can also use the 7zSD.sfx from the 7-zip website, but it will give you a different setup-icon in the end. To create the app.tag-file, save the code in an ASCII-file (notepad) and save as app.tag (example).
Open Firefox Setup 5.0.1.exe with 7-zip and extract to an empty folder. If you have 7-zip installed you can right-click on the Firefox Setup 5.0.1.exe > 7-zip > extract to “Firefox Setup 5.0.1\” (fig01.png, fig02.png)
Default settings can be changed by an end-user. In this example we will use Google as default search engine, but an end-user could prefer Bing and using this method will give them the possibility to customize this. The end-user preferences will be stored in his own profile and the change will be limited to that profile. Warning: Not all options work so be sure to test them out!
Navigate to core\defaults\pref\ and open/create custom.js with a text-editor (fig03.png).
To find the default keys and values, open firefox and enter about:config in the address bar (fig04.png).
In our example we add the following line to custom.js:
Locked preferences are the same as default settings, with the exception that user can’t change the setting. Locked preferences are grayed out in the options menu our shown italic in about:config(fig05.png). In our example we will prevent client updates (and corresponding messages), because users don’t have the necessary right to do an update. But we will allow them to update there add-ons (or extensions) because updated add-ons are stored inside there profile. Firefox will also check once a week for an add-on update instead of the default one day.
First navigate to core\defaults\pref\ folder and create/modify the text file custom.js (fig06.png).
Add the following lines:
pref("general.config.obscure_value", 0); pref("general.config.filename", "mozilla.cfg");
Next, navigate to core\ and create or modify the text file: mozilla.cfg (fig07.png).
Important: on the first line, add 2 slashes (//). In this file you can define the locked preferences almost in the same way like the default settings. But instead of using pref, you need to use the lockPref function:
To disable the client update function add the following lines in mozilla.cfg:
lockPref("app.update.enabled",false); lockPref("app.update.auto", false);
For the add-ons add:
lockPref("extensions.update.enabled", true); lockPref("extensions.update.interval", 604800000); lockPref("extensions.update.notifyUser", true); lockPref("extensions.update.url", "https://versioncheck.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%¤tAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%");
The interval is 604800000 milliseconds, which is 7 days or once a week.
fig05.png, fig06.png, fig07.png, fig08.png:
Changing the default homepage
Changing the default homepage is maybe the most common thing for a enterprise setup. But since version 4 from Firefox, changing this setting is harder than you would expect from an “open” browser.
In the core-folder you find the file omni.jar. Unlike standard jar-files, which are zip-files, this is an optimized version using a python script. The big disadvantage is that 7-zip is unable to open the file because it handles compressed files really strict. Lucky for us, the extractor build into windows is less strict.
Rename the file omni.jar to omni.zip (fig09.png) and right click on the file > Extract All… (fig10.png, fig11.png). Go to the folder where you extracted the files (normally \core\omni) and navigate to chrome\en-US\locale\branding (fig12.png) . Open the file browserconfig.properties with a text-editor and change the setting browser.startup.homepage (fig13.png). Notice the little square in fig13.png? That’s just a line break under *nix, you can just remove it.
Go to the omni-folder and compress all the files and folders to omni.zip. You can use 7-zip if you like, because this time we aren’t going to use an optimized version. (fig14.png) Rename the file to omni.jar. Than move this file to the core-folder (fig15.png). It’s best to do a little clean-up and remove omni.zip and the folder omni.
fig09.png, fig10.png, fig11.png, fig12.png, fig13.png, fig14.png, fig15.png:
Download the add-ons (use save as…) (fig16.png) and extract the .xpi file with 7-zip to an empty folder inside core\extensions (fig17.png, fig18.png). In the folder where you extracted the add-on, you will find the file install.rdf. This is an XML-file and you just need to open it with a text-editor. Inside the xml element <rdf:description> you find the xml element <em:id> (fig19.png). Rename the folder of the add-on to the value of <em:id> (fig20.png).
fig16.png, fig17.png, fig18.png, fig19.png, fig20.png:
Little note: In the future you won’t need to extract the .xpi file and you just need to place them inside core\extensions. It’s on the roadmap of the Mozilla team.
Creating the Setup File
The next and final step is optional, you can go to the extraction folder of the setup file an just run setup.exe (fig21.png). It depends on the way you deploy the installation, but in most cases you are better off with one compact setup file.
To do this select the setup.exe and core-folder and compress to a 7-zip container (fig22.png)
Move this file to the folder where you stored 7zSD.sfx and app.tag. (fig23.png)
Open a command prompt, navigate to the folder and use the following command (fig24.png):
copy /b 7zSD.sfx+app.tag+"Firefox Setup 188.8.131.52z" "Customized Firefox Setup 5.0.1.exe"
Note: You need to change Firefox Setup 184.108.40.206z to the name you have used to create the 7-zip container.
And that’s it, Customized Firefox Setup 5.0.1.exe is now you customized Firefox installation file.
fig21.png, fig22.png, fig23.png, fig24.png:
I hope you find this guide useful to create a customized setup for you enterprise environment.
If you have any comments or remarks, feel free to do so. The same way for spelling error’s, English isn’t my native language, so please if you find one (and I’m sure you do), let me know.