Firefox's Policies
The policies file contains your (organization’s) customizations to Firefox. It can e.g. include a custom homepage. It is placed next to the Firefox executable in the distributions/ directory. To find it using python, you can use
#! /usr/bin/env python3
import shutil
import sys
from pathlib import Path
from pathlib import PurePath
def resolve_dir(exe="firefox"):
"""@return location of policy file (currently linux)"""
ff_exe = Path(shutil.which(exe)).resolve()
return PurePath(ff_exe).parent
def policies_file(exe="firefox"):
"""@return location of policy file (currently linux)"""
ff_dir = Path(resolve_dir(exe), "distribution")
ff_dir.mkdir(exist_ok=True)
return Path(ff_dir, "policies.json")
An example policies file to install some addon helpers is
{
"policies": {
"Extensions": {
"Install": [
"https://addons.mozilla.org/firefox/downloads/file/1737313/adultblacklist-0.5.0-an+fx.xpi",
"https://addons.mozilla.org/firefox/downloads/file/3455237/web_site_filter-1.6.4-an+fx.xpi",
"https://addons.mozilla.org/firefox/downloads/file/3904539/web_site_filter-1.6.4-an+fx.xpi",
"https://addons.mozilla.org/firefox/downloads/latest/sas"
],
"Locked": [
"@wsf",
"{b52acdad-e4a6-44da-afc9-9bd22572db99}"
]
},
"DisableTelemetry": true,
"SearchEngines": {
"Default": "DuckDuckGo",
"Add": [
{
"Name": "DuckDuckGo",
"URLTemplate": "https://duckduckgo.com/?q={searchTerms}&t=h_&kp=1&ia=web",
"Method": "GET",
"IconURL": "https://duckduckgo.com/favicon.ico",
"Alias": "Ducky",
"Description": "Duck Duck Goose"
}
]
}
}
}