descriptionnone
repository URLhttps://github.com/pyllyukko/user.js.git
ownerits.an.address@protonmail.com
last changeSun, 7 Apr 2024 07:37:47 +0000 (7 10:37 +0300)
last refreshFri, 26 Apr 2024 14:50:31 +0000 (26 16:50 +0200)
content tags
add:
README.md

user.js

Firefox configuration hardening

A user.js configuration file for Mozilla Firefox designed to harden browser settings and make it more secure.

This is a default template with every possible hardening measure enforced. See the relaxed branch for a variant providing more usability

Build Status

Main goals

How to achieve this?

There are several parts to all this and they are:



Download

Different download methods are available:

Installation

Backups

Do note that these settings alter your browser behaviour quite a bit, so it is recommended to either create a completely new profile for Firefox or backup your existing profile directory before putting the user.js file in place.

To enable the Profile Manager, run Firefox with command-line arguments: firefox --no-remote -P

Single profile installation

Copy user.js in your current user profile directory, or (recommended) to a fresh, newly created Firefox profile directory.

The file should be located at:

OSPath
Windows 7%APPDATA%\Mozilla\Firefox\Profiles\XXXXXXXX.your_profile_name\user.js
Linux~/.mozilla/firefox/XXXXXXXX.your_profile_name/user.js
OS X~/Library/Application Support/Firefox/Profiles/XXXXXXXX.your_profile_name
Android/data/data/org.mozilla.firefox/files/mozilla/XXXXXXXX.your_profile_name and see issue #14
Sailfish OS + Alien Dalvik/opt/alien/data/data/org.mozilla.firefox/files/mozilla/XXXXXXXX.your_profile_name
Windows (portable)[firefox directory]\Data\profile\

With this installation method, if you change any of user.js settings through about:config or Firefox preferences dialogs, they will be reset to the user.js defined values after you restart Firefox. This makes sure they're always back to secure defaults when starting the browser. However this prevents persistently changing settings you don't consider appropriate. Either edit user.js directly, or use the system-wide installation method described below.

System-wide installation (all platforms)

Generate a file suitable for system-wide installation, by running make with one of the following targets:

Copy the produced file to the Firefox installation directory. The file should be located at:

OSPath
WindowsC:\Program Files (x86)\Mozilla Firefox\mozilla.cfg
Linux/etc/firefox/syspref.js, for older versions: /etc/firefox/firefox.js
Linux (Debian)/etc/firefox-esr/firefox-esr.js
Linux (Gentoo, Archlinux)/usr/lib/firefox/mozilla.cfg, might also be /usr/lib32/ or /usr/lib64/
OS X/Applications/Firefox.app/Contents/Resources/mozilla.cfg

Additional installation steps for Windows / OS X / Gentoo / Archlinux

Create local-settings.js in Firefox installation directory, with the following contents:

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

This file should be located at:

OSPath
WindowsC:\Program Files (x86)\Mozilla Firefox\defaults\pref\
OS X/Applications/Firefox.app/Contents/Resources/defaults/pref
Linux (Gentoo, Archlinux)/usr/lib/firefox/defaults/pref/, might also be /usr/lib32/ or /usr/lib64/

If mozilla.cfg still fails to load, you must add a blank comment to the top of mozilla.cfg like so:

//

Additional settings (policies)

Not all Firefox settings can be changed through user.js - some must be set in a separate policies.json file [1]. These policies apply system-wide.

To install policies.json from this repository, simply copy it to the appropriate directory (create it if it does not exist):

OSPath
WindowsC:\Program Files (x86)\Mozilla Firefox\distribution\
OS X/Applications/Firefox.app/distribution\
Linux (Debian)/etc/firefox-esr/policies/

Note that JSON does not support comments, hence settings are documented in custom *_comment keys. Mozilla maintains a list of available policies: [1] [2]. The Enterprise Policy Generator add-on can be used to generate policies.json files from a graphical interface.

Updating using git

For any of the above methods, you can keep your browser's user.js with the latest version available here: Clone the repository, and create a symbolic link from the appropriate location to the user.js file in the repository. Just run git pull in the repository when you want to update, then restart Firefox:

cd ~/.mozilla/firefox
git clone 'https://github.com/pyllyukko/user.js.git'
cd XXXXXXXX.your_profile_name
ln -s ../user.js/user.js user.js

Verifying

Verify that the settings are effective from about:support (check the "Important Modified Preferences" and "user.js Preferences" sections).

Verify that policies are effective from about:policies.


What does it do?

There's a whole lot of settings that this modifies and they are divided in the following sections.

Some of the settings in this user.js file might seem redundant, as some of them are already set to the same values by default. We chose to explicitely set their values, which ensures these settings are enforced if a future Firefox update changes the default value.

HTML5 / APIs / DOM

HTML5 / APIs / DOM related settings. Mozilla is keen to implement every new HTML5 feature, which have had unforeseen security or privacy implications. This section disables many of those new and yet to be proven technologies.

Misc

Settings that do not belong to other sections or are user specific preferences.

Extensions / plugins

Harden preferences related to external plugins

Firefox (anti-)features / components

Disable Firefox integrated metrics/reporting/experiments, disable potentially insecure/invasive/undesirable features

Automatic connections

Prevents the browser from auto-connecting to some Mozilla services, and from predictively opening connections to websites during browsing.

HTTP

HTTP protocol related entries. This affects cookies, the user agent, referer and others.

Caching

Enable and configure private browsing mode, don't store information locally during the browsing session

Improve visibility of security-related elements, mitigate shoulder-surfing

Cryptography

TLS protocol related settings

Cipher suites

This section tweaks the cipher suites used by Firefox. The idea is to support only the strongest ones with emphasis on forward secrecy, but without compromising compatibility with all those sites on the internet. As new crypto related flaws are discovered quite often, the cipher suites can be tweaked to mitigate these newly discovered threats.


Further hardening

This is not enough! Here's some other tips how you can further harden Firefox:

Add-ons

Here is a list of the most essential security and privacy enhancing add-ons that you should consider using:

Additional add-ons that you might consider using or reading about:

Known problems and limitations

Hardening your often implies a trade-off with ease-of-use and comes with reduced functionality. Here is a list of known problems/limitations:

In addition see the current issues. You can use the web console to investigate what causes websites to break.


FAQ

Does this user.js file fix all security problems?

No. Please read Known problems and limitations, the project's issue tracker, and report new issues there. Please open separate issues for each individual problem/question you may have.

Why are obsolete/deprecated entries included in the user.js file?

This project is aimed at Firefox versions between the current ESR and the latest Firefox release. We will wait for widespread deployment of the current ESR (eg. adoption in major Linux distributions) before removing deprecated/obsolete preferences. Presence of deprecated entries causes no known problems.

Installing the user.js file breaks xyz plugin/addon/extension, how can I fix it?

See https://github.com/pyllyukko/user.js/issues/100

Will there be an official addon/an android version/feature xyz?

Search the project issues.

How can I lock my preferences to prevent Firefox overwriting them?

See lockPref in System-wide installation.

Contributing

Yes please! All issues and pull requests are more than welcome. Please try to break down your pull requests or commits into small / manageable entities, so they are easier to process. All the settings in the user.js file should have some official references to them, so the effect of those settings can be easily verified from Mozilla's documentation.

Feel free to follow the latest commits RSS feed and other interesting feeds from the References section.

You may also reach other contributors through IRC (#user.js on Freenode) or Gitter.

For more information, see CONTRIBUTING


Online tests

Version checks

Fingerprinting tests

SSL tests

Other tests


References

Mozilla documentation

Other documentation

TLS/SSL documentation


Maintenance

Run make help to get a list of makefile targets used for frequent maintenance operations.

$ make help
locked_user.js      generate a locked configuration file
systemwide_user.js  generate a system-wide configuration file
debian_locked.js    generate a locked, system-wide configuration file
policies.json       generate policy file (https://github.com/mozilla/policy-templates/blob/master/README.md)
tests               run all tests
test-acorn          validate user.js syntax
test-shellcheck     check/lint shell scripts
000-tor-browser.js  download Tor Browser custom configuration reference
diff-tbb            differences between values from this user.js and tor browser's values
diff-tbb-2          differences between values from this user.js and tor browser's values (alternate method)
diff-tbb-missing-from-user.js           preferences that are present in tor browser's defaults, but not in this user.js
diff-sourceprefs.js download and sort all known preferences files from Firefox (mozilla-central) source
diff-upstream-duplicates                preferences with common values with default Firefox configuration
diff-upstream-missing-from-user.js      preferences present in firefox source but not covered by user.js
diff-upstream-deprecated                preferences in hardened user.js that are no longer present in firefox source
diff-stats          count preferences number, various stats
clean               clean automatically generated files/build/test artifacts
doc-whatdoesitdo    generate the README "What does it do?" section
doc-toc             generate the README table of contents
help                generate list of targets with descriptions

shortlog
2024-04-07 pyllyukkoMention DNT in the READMEmaster
2024-02-12 pyllyukkoMerge pull request #554 from nodiscc/network.http.refer...
2024-02-12 nodisccMerge branch 'master' into network.http.referer.trimmin...
2024-02-12 nodisccTrim HTTP referers
2024-02-12 pyllyukkoMerge pull request #553 from nodiscc/doc-xorigin-breakage
2024-02-12 nodisccdoc: add notice about network.http.referer.XOriginPolic...
2024-02-12 pyllyukkoMerge pull request #552 from nodiscc/browser.sessionsto...
2024-02-12 nodisccDon't remember recently closed tabs
2024-02-11 pyllyukkoEnable X25519Kyber768Draft00 (post-quantum key exchange)
2024-01-20 pyllyukkoUpdated links regarding dom.event.clipboardevents.enabl...
2024-01-17 pyllyukkoMerge pull request #548 from jxdv/speculative-content
2024-01-17 jxdvadd speculativeConnect
2023-07-22 pyllyukkoMerge pull request #546 from nodiscc/policies-json2
2023-07-20 nodisccdoc: README: fix typo
2023-07-20 nodiscctools/Makefile: remove policies.json target
2023-07-15 nodisccdoc: policies: syntax fixes
...
heads
2 weeks ago master
2 years ago relaxed