Skip to content

Instantly share code, notes, and snippets.

@jhochwald
Last active July 16, 2017 16:35
Show Gist options
  • Save jhochwald/93e69e92e1a09877e7fa028d933169af to your computer and use it in GitHub Desktop.
Save jhochwald/93e69e92e1a09877e7fa028d933169af to your computer and use it in GitHub Desktop.
Mozilla FireFox deployment customisation for Munki based Deployments/installation.
#!/usr/bin/env bash
# --------------------------------------------------------------------------------
# NAME: FireFox_Tweaks.sh
#
# SYNOPSIS: Mozilla FireFox ESR deployment customisation
#
# DESCRIPTION: Mozilla FireFox deployment customisation for Munki based
# Deployments/installation.
#
# NOTES: I use this with a Munki Deployment, but you might use with a local
# installation as well. Review my settings, before use it.
# Some settings are no (no longer) supported (legacy) or based on
# Windows, but I want to keep the files identical.
# I use this with the regular FireFox package, the developer edition,
## and the ESP (mainly) Release on a regular Munki deployment system.
#
# AUTHOR: Joerg Hochwald <joerg.hochwald@outlook.com>
# LICENSE: BSD 3-clause "New" or "Revised" License
# https://opensource.org/licenses/BSD-3-Clause
#
# INSTALL: Paste this in the postinstall_script section of the package (PLIST)
# --------------------------------------------------------------------------------
# Check if we are root
if (( $EUID != 0 )); then
echo "Please run as root"
exit
fi
export LANG="en_US.UTF-8"
export LANGUAGE="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
# Create the local-settings.js file
/bin/cat <<EOF > /Applications/Firefox.app/Contents/Resources/defaults/pref/local-settings.js
pref("general.config.filename", "mozilla.cfg");
pref("general.config.obscure_value", 0);
EOF
# Create the mozilla.cfg that contains our custom preferences
/bin/cat <<EOF > /Applications/Firefox.app/Contents/Resources/mozilla.cfg
//
lockPref("browser.startup.homepage_override.mstone", "ignore");
lockPref("browser.shell.checkDefaultBrowser", false);
lockPref("app.update.enabled", false);
lockPref("app.update.auto", false);
lockPref("app.update.mode", 0);
lockPref("app.update.service.enabled", false);
lockPref("datareporting.healthreport.service.enabled", false);
lockPref("datareporting.healthreport.uploadEnabled", false);
lockPref("datareporting.policy.dataSubmissionEnabled", false);
lockPref("toolkit.crashreporter.enabled", false);
Components.classes["@mozilla.org/toolkit/crash-reporter;1"].getService(Components.interfaces.nsICrashReporter).submitReports = false;
pref("browser.rights.3.shown", true);
pref("plugins.notifyMissingFlash", false);
pref("browser.shell.shortcutFavicons",true);
pref("browser.urlbar.trimURLs", false);
pref("browser.startup.homepage_override.mstone","ignore");
pref("geo.enabled", false);
pref("geo.wifi.uri", "");
pref("dom.battery.enabled", false);
pref("dom.gamepad.enabled", false);
pref("media.video_stats.enabled", false);
defaultPref("browser.startup.homepage","data:text/plain,browser.startup.homepage=http://www.enatec.io");
defaultPref("security.enterprise_roots.enabled", true);
defaultPref("network.automatic-ntlm-auth.allow-proxies", true);
defaultPref("network.automatic-ntlm-auth.trusted-uris", "build.enatec.net,sso.enatec.net,outlook.enatec.net,*.enatec.net");
defaultPref("browser.startup.page", 1);
defaultPref("config.lockdown.disable_themes", true);
defaultPref("browser.download.manager.closeWhenDone", true);
defaultPref("dom.disable_open_during_load", true);
defaultPref("permissions.default.image", 1);
defaultPref("javascript.enabled", true);
defaultPref("pref.advanced.javascript.disable_button.advanced", false);
defaultPref("security.enable_java", true);
defaultPref("security.default_personal_cert", "Ask Every Time");
defaultPref("browser.download.manager.showWhenStarting", false);
defaultPref("browser.download.manager.closeWhenDone", true);
defaultPref("browser.download.useDownloadDir", true);
defaultPref("browser.download.folderList", 2);
defaultPref("browser.tabs.autoHide", false);
defaultPref("browser.tabs.loadInBackground", false);
defaultPref("browser.history_expire_days", 7);
defaultPref("browser.history_expire_days.mirror", 7);
defaultPref("privacy.sanitize.sanitizeOnShutdown", true);
defaultPref("privacy.item.cookies", false);
defaultPref("privacy.item.downloads", false);
defaultPref("privacy.item.formdata", false);
defaultPref("privacy.item.history", false);
defaultPref("privacy.item.cache", true);
defaultPref("privacy.item.sessions", true);
defaultPref("privacy.sanitize.promptOnSanitize", false);
defaultPref("browser.safebrowsing.enabled", true);
defaultPref("general.smoothScroll", true);
defaultPref("general.autoScroll", false);
defaultPref("privacy.item.cache", true);
defaultPref("privacy.item.sessions", true);
defaultPref("network.cookie.cookieBehavior", 3);
defaultPref("browser.search.countryCode", "DE");
defaultPref("browser.search.hiddenOneOffs", "Amazon.com,Twitter,Wikipedia (en)");
defaultPref("browser.search.region", "DE");
defaultPref("browser.link.open_newwindow", 2);
defaultPref("browser.newtabpage.enhanced", true);
defaultPref("browser.newtabpage.storageVersion", 1);
defaultPref("network.predictor.cleaned-up", true);
defaultPref("gfx.direct2d.disabled", true);
defaultPref("layers.acceleration.disabled", true);
defaultPref("browser.cache.disk_cache_ssl", false);
defaultPref("privacy.donottrackheader.enabled", true);
defaultPref("privacy.donottrackheader.value", 1);
defaultPref("security.dialog_enable_delay", 2000);
defaultPref("security.enable_ssl3", true);
defaultPref("security.enable.tls", true);
lockPref("breakpad.reportURL", "");
lockPref("browser.tabs.crashReporting.sendReport", false);
lockPref("datareporting.healthreport.documentServerURI", "");
lockPref("datareporting.healthreport.service.enabled", false);
lockPref("datareporting.healthreport.uploadEnabled", false);
lockPref("datareporting.policy.dataSubmissionEnabled", false);
lockPref("datareporting.policy.dataSubmissionEnabled.v2", false); // Firefox 43+ ?
lockPref("dom.ipc.plugins.flash.subprocess.crashreporter.enabled", false);
lockPref("dom.ipc.plugins.reportCrashURL", false);
lockPref("toolkit.telemetry.archive.enabled", false);
lockPref("toolkit.telemetry.cachedClientID", "");
lockPref("toolkit.telemetry.enabled", false);
lockPref("toolkit.telemetry.prompted", 2);
lockPref("toolkit.telemetry.rejected", true);
lockPref("toolkit.telemetry.server", "");
lockPref("toolkit.telemetry.unified", false);
lockPref("toolkit.telemetry.unifiedIsOptIn", true);
lockPref("toolkit.telemetry.optoutSample", false);
lockPref("identity.fxaccounts.auth.uri", "");
lockPref("identity.fxaccounts.remote.force_auth.uri", "");
lockPref("identity.fxaccounts.remote.signin.uri", "");
lockPref("identity.fxaccounts.remote.signup.uri", "");
lockPref("identity.fxaccounts.settings.uri", "");
lockPref("services.sync.autoconnect", false);
lockPref("services.sync.engine.addons", false);
lockPref("services.sync.engine.bookmarks", false);
lockPref("services.sync.engine.history", false);
lockPref("services.sync.engine.passwords", false);
lockPref("services.sync.engine.prefs", false);
lockPref("services.sync.engine.tabs", false);
lockPref("services.sync.serverURL", "");
lockPref("breakpad.reportURL", "");
lockPref("browser.tabs.crashReporting.sendReport", false);
lockPref("datareporting.healthreport.documentServerURI", "");
lockPref("datareporting.healthreport.service.enabled", false);
lockPref("datareporting.healthreport.uploadEnabled", false);
lockPref("datareporting.policy.dataSubmissionEnabled", false);
lockPref("datareporting.policy.dataSubmissionEnabled.v2", false); // Firefox 43+ ?
lockPref("dom.ipc.plugins.flash.subprocess.crashreporter.enabled", false);
lockPref("dom.ipc.plugins.reportCrashURL", false);
lockPref("toolkit.telemetry.archive.enabled", false);
lockPref("toolkit.telemetry.cachedClientID", "");
lockPref("toolkit.telemetry.enabled", false);
lockPref("toolkit.telemetry.prompted", 2);
lockPref("toolkit.telemetry.rejected", true);
lockPref("toolkit.telemetry.server", "");
lockPref("toolkit.telemetry.unified", false);
lockPref("toolkit.telemetry.unifiedIsOptIn", true);
lockPref("toolkit.telemetry.optoutSample", false);
lockPref("browser.safebrowsing.enabled", false);
lockPref("browser.safebrowsing.downloads.enabled", false);
lockPref("browser.safebrowsing.malware.enabled", false);
lockPref("browser.urlbar.filter.javascript", true);
lockPref("network.cookie.cookieBehavior", 1);
lockPref("plugin.state.flash", 2);
lockPref("browser.pocket.enabled", false);
lockPref("signon.expireMasterPassword", true);
lockPref("browser.cache.disk.capacity", 1024);
lockPref("browser.cache.disk.smart_size.enabled", false);
lockPref("browser.cache.disk.smart_size.first_run", false);
lockPref("browser.cache.disk.smart_size.use_old_max", false);
EOF
# Create override.ini to suppress fristrun wizzard (e.g. Import Data)
/bin/cat <<EOF > /Applications/Firefox.app/Contents/Resources/browser/override.ini
[XRE]
EnableProfileMigrator=false
EOF
# Create the Directory structure
/bin/mkdir -p /Applications/Firefox.app/Contents/Resources/browser/profile/chrome
# Create userChrome.css to remove several elements
/bin/cat <<EOF > /Applications/Firefox.app/Contents/Resources/browser/profile/chrome/userChrome.css
/* UserChrome.css for Mozilla Firefox */
/* Remove access to user interface elements that are not suitable for application virtualization */
/* Options - Advanced - General - System Defaults */
#systemDefaultsGroup { display: none !important; }
/* Options / Advanced / Update / Firefox updates group box */
#updateApp { display: none !important; }
/* Help - About - Check for Updates button */
#updateButton { display: none !important; }
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment