provides software and services that enable enterprises
Live Chat 1-888-673-6564

Open Source Software Technical Articles

  • Home
  • Search
  • Source Code Scanning Tools
  • Products and Support
  • Services
  • Cloud Services
  • Open Source Training
  • Enterprise OSS Blog
  • Wazi Technical Blog
  • About Wazi
  • Attributions and Licensing
  • Supply Chain Compliance
  • How to Contribute
  • Contributors
  • Resources Library
  • Partners
  • Customers
  • Community
  • Company
  • Careers
  • News and Events
  • Contact Us

Subscribe to Wazi by Email

Your email:

click-here-to-chat-with-an-online-representative


Enterprise Developer Support 24 x 7 for Apache, CentOS, Tomcat, PostSQL and more. Get a Support Quote by clicking here!


Latest Posts

  • Build your own custom modules for Drupal 7
  • CentOS system administration using text-based user interfaces
  • Quickly create custom software packages with FPM
  • More easy RSS for your websites via Google and Yahoo! APIs
  • Get RSS for your website using jQuery and PHP
  • JSF tip: How to create bookmarkable pages
  • MySQL Workbench simplifies MySQL management tasks
  • Use Perl to enhance ModSecurity
  • The secret to great reporting with Drupal 7
  • A more colorful LibreOffice unveiled

Connect with Us!

Current Articles | RSS Feed RSS Feed

How to Customize the Firefox 3 Installer

Posted by Glen Bettridge on Tue, Oct 21, 2008
  
Email This Email Article  
Tweet  
  

With adoption of Firefox on the increase, enterprise IT shops face a challenge: how to provide Firefox to their users while keeping a handle on security. To address this, we suggest creating a customized Firefox installer preconfigured with the extensions and settings approved by your IT department. This tutorial takes you through that process.

Before You Start


Before customizing Firefox, avoid headaches by looking carefully at which extensions best suit your needs. You, or your IT team, should also thoroughly research the Firefox settings and create a list of those you wish to include.

Extensions


One of Firefox's greatest strengths is its diverse collection of extensions. Extensions such as NoScript or CookieSafe can be used to secure Firefox, while AdBlock or one of its variants could help reduce unwanted traffic to ad servers. Before building a customized installer, you will need to decide which extensions best meet your needs and the needs of your users. With an eye toward security policies and customer requests, browse the Firefox Add-on Repository and download the (Firefox 3-compatible) add-ons that best meet your needs.

Settings


Firefox offers a large number of settings, many of which aren't accessible through the standard preferences/options dialog window. To see the available options, enter "about:config" in Firefox's location bar. This will display a list of all settings. While the list is intimidating, Mozilla publishes a reference to all of the settings. Review the  options and collect a list of settings for which you'd either like to set a custom default value or completely lock down to a specific value.

What You Will Need


Once you've decided what extensions and settings you'd like in your spiffy custom installer, there are a few components you'll need.


For a custom Windows installer, grab

    • A current, standard Firefox 3 installer for Windows.

    • A current app.tag file from Mozilla's site (copy the appropriate text from http://lxr.mozilla.org/mozilla/source/browser/installer/windows/app.tag into a text file called app.tag).

    • A 7zSD.sfx file from Mozilla's site (download this from http://lxr.mozilla.org/mozilla/source/other-licenses/7zstub/firefox/7zSD.sfx?raw=1).

    • The 7zip command line utility (currently at http://downloads.sourceforge.net/sevenzip/7za457.zip).


For a custom Linux installer,you'll need to

    • Grab a current standard Firefox 3 binary for Linux.

    • Have familiarity with tar and gzip.



You'll also need copies of each extension you wish to include in the installer (the xpi files), and the list of settings and values.


Note for Mac users: I'm working on a version of this article for Firefox 3 on the Mac, but I'm still sorting out the details of repackaging a dmg file.

Meat & Potatoes


Creating Your Settings File


The settings file I'm going to describe is basically just a Javascript file with a set of calls to two Firefox-defined JS functions, defaultPref and lockPref. Unsurprisingly, the defaultPref function can be used to specify a default value for a setting and lockPref sets the value for the setting so that it cannot be changed by the user. Each has similar arguments:

 

function defaultPref(prefName, value)
function lockPref(prefName, value)


so, for example, you could set the default home page using

defaultPref("browser.startup.homepage","http://www.mycompany.com/portal");



or, you could require that the browser always check for updates

lockPref("app.update.enabled",true);



You can find additional information about these and other preference Javascript functions for Firefox in "MCD, Mission Control Desktop AKA AutoConfig" at the Mozilla Developer Center.

Use the list of settings you prepared to build a settings file. For the rest of the article, I'll refer to this file as "firefox.cfg", although you can use any name you prefer.

Note: Since the settings file is a Javascript file, there are many sophisticated and clever javascript tricks you can include, but I'm not going to cover any of them.

Making Your Extensions Manually Installable


The next step is to prepare your chosen extensions to be manually installed. For each extension,


    • Unzip the xpi file (using 7zip, WinZip, Zip-Info or your preferred tool). You'll end up with a folder probably with the same name as the extension (for example, NoScript)

    • In the folder, find the file called install.rdf, open it in a text editor and find the <em:id> tag under the <Description> tag. This is the unique ID of the extension ({73a6fe31-595d-460b-a920-fcc0f8843232} for NoScript)

    • Change the name of the extension folder to the extension's ID (e.g. Change the "NoScript" folder to "{73a6fe31-595d-460b-a920-fcc0f8843232}")

 

19a98812-f823-48dc-841e-bf029c63c6d7


 

On To the Installer


Now we're ready to rebuild the installer.

Windows Installer


Let's walk through the process for the Windows installer and then I'll describe the somewhat simpler process on Linux.


  • The Firefox installer is basically a self-extracting 7zip archive. You can open the 3.0.3 installer into a directory called "firefox-win" using

7za x -ofirefox-win "Firefox Setup 3.0.3.exe"


  • Copy each of the renamed extension folders into firefox-winonlocalized\extensions\ (assuming Windows path style). That's all that needs to be done for a generic extension installations. If the extensions add new settings, the installer will use the default values for those settings. Those settings could also be added to the firefox.cfg file, if you needed to change them, but I won't go into details here.

  • Create a file called firefox.cfg in firefox-win
    onlocalized\ where the firefox.exe file is located. Here's an example firefox.cfg which provides some basic security settings (note that everything in the example config file is commented out so it can be tested without affecting any settings at all; uncomment the settings you'd like to try).

  • Open firefox-win
    onlocalized\greprefs\all.js in a text editor and add the following lines

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


      This causes Firefox 3 to load the settings in the firefox.cfg file.

    1. Build a new exe installer from the firefox-win folder: cd into firefox-win and execute the following commands

        1. 7za a -t7z ..\custom.7z

        1. cd ..

        1. copy /b 7zSD.sfx+app.tag+custom.7z FirefoxCustomInstall.exe

 

Linux Installer


When you download Firefox for Linux, instead of an installer, you'll just have a tarball. This means you can untar it, walk through steps 2-4 in the Windows process and re-archive the directory.

Finishing Up


Distribute your newly created .exe to users and you're set!

Follow @openlogic
Follow @CloudSwing

This work is licensed under a Creative Commons Attribution 3.0 Unported License
Creative Commons License.Follow @openlogic
Follow @OSCloudServices

This work is licensed under a Creative Commons Attribution 3.0 Unported License
Creative Commons License.
Tags: Technical, Firefox, Tutorial

Comments

Currently, there are no comments. Be the first to post one!
Post Comment
Name
 *
Email
 *
Website (optional)
Comment
 *

Allowed tags: <a> link, <b> bold, <i> italics

Loading...
Error sending email
Email sent successfully

Email article
Email To : 
Your name : 
Message : (maximum 200 characters)
Home | Search | Source Code Scanning Tools | Products and Support | Services | Cloud Services | Open Source Training | Enterprise OSS Blog | Wazi Technical Blog | Resources Library | Partners | Customers | Community | Company | Careers | News and Events | Contact Us
Products
OpenLogic Exchange (OLEX)
License Compliance Module
OSS Discovery
OSS Deep Discovery
OpenUpdate
Services
Open Source Support
CentOS Support
Scanning & Compliance
Open Source Training
Professional Services
Solutions
Support & Indemnification
Open Source Governance
Open Source Scanning
Open Source Provisioning
Consulting & Training
Contact Us
1-888-673-6564


© 2013 OpenLogic, Inc. All rights reserved.
Site Map  |  Privacy Policy