Provisioning and configuration management | Firefox, Thunderbird

Does fedora have a community that automates provisioning and configuration?

Provisioning a system is easy these days and with fedora’s support of kickstart there is plenty of good information availble to do just about anything. Combined with ansible the rest of the configuration is nicely automated even when only builtin features are used.

Still I find I need help figuring some details out. For instance, how do I set user_pref("webgl.disabled", true); as the default for new user accounts? I could add a line in each user’s user.js file for each firefox profile but it would be nice to start with it already set before a new user starts up firefox for the first time.

This is just a guess, but I might try creating a /etc/skel/.mozilla/firefox/distribution/preferences.json file containing the following before adding the users.

{
  "Global": {
    "id": "steppybug",
    "version": 1.0,
    "about": "Stephen Serafin"
  },
  "Preferences": {
    "webgl.disabled": true
  }
}

There is some documentation here.

2 Likes

Note that the scope of /etc/skel is limited to new profiles.
Here’s a way to customize the defaults for all profiles:

sudo ln -f -s -T . /etc/firefox/defaults
sudo tee /etc/firefox/pref/local.js << EOF > /dev/null
pref("webgl.disabled", true);
EOF

A similar provisioning method also works for Thunderbird.

2 Likes

It took me a few tries to get it right and properly tested;-) Now I have two ways, the first is dropping a file next to prefs.js

cat user.js
user_pref("webgl.disabled", true);

in each profile of each user does get the effect.

The better way, thanks @vgaetera, is to drop a file into /etc/firefox/defaults/pref

cat /etc/firefox/defaults/pref/local.js
pref("webgl.disabled", true);

I was able to convince myself that I messed up earlier in my testing when I could see that firefox indeed was accessing /etc/firefox/defaults/pref/local.js

strace -o firefox.strace /usr/lib64/firefox/firefox -P
1 Like

I don’t follow what the symlink is doing. . is an alias for the current directory, but you didn’t cd in an earlier step. What am I missing?

Edit: Now I get it. Evaluation of the . is delayed. :person_facepalming:

Are defaults/pref and pref different things though? For example, one might be to set initial defaults (if the setting is not elsewhere specified) whereas the other might be to configure overrides. I thought I saw a statement about a feature along those lines when I was browsing earlier. Let me check my history …

Edit:

From mozilla.github.io – policy-templates – preferences:

Previously you could only set and lock a subset of preferences. Starting with Firefox 81 and Firefox ESR 78.3 you can set many more preferences. You can also set default preferences, user preferences and you can clear preferences.


Hmm, this note from a little further down on that page might be hinting at why you are having difficulty changing this setting:

“user” preferences persist even if the policy is removed, so if you need to remove them, you should use the clear policy.

It looks like Mozilla has managed to make these settings really difficult to manage.

1 Like

According to the linked documentation, that method supports preferences only for listed prefixes, and webgl. is not listed there.

My testing results confirm that it works only partially:

sudo ln -f -s -T . /etc/firefox/policies
jq << EOF | sudo tee /etc/firefox/policies.json > /dev/null
{"policies":{"Preferences":{
"webgl.disabled":{"Value":true},
"ui.key.menuAccessKeyFocuses":{"Value":false}
}}}
EOF
1 Like