How to install addons's or arkenfox profile in template vm so it is there in disposable vm?

What i am trying to do ?
setup some addons ublock origin, etc, and user js arkenfox in template vm, or in any other way, such that whenever i create a disposable vm, the addons are there, and i am not fingerprinted. As the fingerprint of every non whonix qube with firefox is the same. So security is helped by creating separate qubes but not privacy,

Any help or ideas in this regard?

1 Like

I’d first create separate template for browsing. Then would create disposable template from it, for browsing in disposables. There you can install addons or to setup any persistence to disposables in a way you comprehended.

1 Like

I’m not sure this is possible in the distro templates, since one is not able to run Firefox in the template and create the hidden .mozilla directory there.

If you create a regular appVM, you can then run Firefox and download the add-ons and user.js to the .mozilla directory in the new appVM and set them up according to your preference. Once you have a workable setup, simply make this appVM your disposable template for Firefox. Good idea to clear any cookies, etc, first. Unfortunately each dispVM you spawn from this one will have the same Firefox profile. However, you can routinely create new disposable appVM templates and simply copy your (modified) user.js and add-on files to these templates. Each of these will have a unique Firefox profile.

If there’s a way to avoid this hassle and create a new Firefox profile with each spawn of a dispVM, I’d definitely like to know about it as well…

I’ve also been trying to add custom user.js (like arkenfox’s) but without creating a profile with a permanent fingerprint (I still want a new profile to be created each time a new VM is started).

So far I’ve only managed to define a set of policies (but still not close to what arkenfox can do):

This can still get you some useful settings and addons installed automatically.

Can you please elaborate this? Did you try what I suggested?

Sure, Qubes strongly discourages running software in the distro templates (eg, debian-11, fedora-34), so there will be nowhere to put the user.js file since one needs to run firefox to build the /home/user/.mozilla directory. The Qubes templates doc even mention firefox in particular:

A template should be used only for installation of packages, and nothing more, so it should never get a chance to actually run /usr/bin/firefox and get infected from it, in case it was compromised.

As I understand your post, you’re creating an appVM and using it as a disposable template, by, for example, checking the “Disposable VM Template” box in the qubes settings of the appVM. This method is what I was also recommending, but each dispVM will reuse the same firefox profile created in this appVM. I’m curious to learn if firefox policies allow for a way around this weakness, sounds interesting…

Yes, if you make a policies.json in /etc/firefox/policies within the template, a fresh profile will be created in each temp VM without ever having to run firefox within the template. It’s fairly straight forward to make, just look at what parameters interest you on the firefox github link I posted.

2 Likes

Never managed to get AutoConfig to work! Will have to invest some more time into it

If someone would ask me, I’d think this is absolutely wrong.

  1. I didn’t say to run firefox and/or customize it in a template, but in a dvm template, which is by it’s nature appVM.
  2. To create an appVM then to do to it whatever and then to promote it to dvm template is absolutely unnecessary, and probably not recommended, since I never read something similar in documentation. On the contrary, you first create dvm template, then customize it. For each purpose, I’d create separate dvm template, for example: one for clearnet, one for tor, one with no-net, and so on and so on…
  3. I never said that you have to run firefox in any template, but before you posted your reply I rather pointed to a post which explains how to set it up without running firefox in a dvm template. So, if I were you, I’d probably checked it, tried it and only then would claim what you did.

I’m writing this because there are a lot of new users recently, or inexperienced ones (for which I consider myself too) and claiming things has to be supported with strong facts, otherwise could mislead users to an unforeseen consequences regarding their security and anonymity, and we don’t know their threat models which can be extremely sensitive, not to say dangerous.

I agree with all of suggestions made by @enmus and @BEBF738VD. A step-by-step guide to creating a template for disposable VMs using Firefox policies and AutoConfig would be fantastic. It seems like others have implemented this setup (custom add-ons and user.js) without ever running Firefox, but I don’t see an easy path for to replicating this without some kind of guide. Glad to know that it’s at least possible though.

To be clear, my response was referencing the use of the term template in the OP. The distinction between a “distro” template and a “dvm” template can be confusing for anyone new to Qubes. The latter is an appVM used as a template for dispVMs, so the customization happens in the appVM, not the template on which it’s based.

what i am trying to do is use a policies. json file to configure firefox each time it starts , i even found a salt of policies,json file here somethwere in the forum .
how this would work is, i would place, the policy, json file somewhere in the root of template vm and every disposable vm will autoconfigure firefox off of it.

installing extensions is possible without creating profiles by sudo apt install webext-ublock-origin-firefox.
But i want to harden firefox by usre js file
i believe it was mentioned in this post
question is does anyone know how to exactly use a policy.json file and can anyone tell me how to use it

You can also install extension via the policies.json file:

It’s very simple really. You start with an empty file named policies.json and then you go through the github link above and add all the policies that matter to you.
You can see that for each policy they include instructions for Windows, MacOS and general policies.json. You want to look at the latter and copy what’s needed to your file.

If for example you want to install ublock, block cookies and disable a few other things (ie telemetry, studies, pocket) the policies.json file would like like the following:

policies.json
{
  "policies": {
    "Cookies": {
      "AcceptThirdParty": "never",
      "Behavior": "reject-tracker-and-partition-foreign",
      "ExpireAtSessionEnd": true,
      "Locked": false
    },
    "DisableFirefoxStudies": true,
    "DisablePocket": true,
    "DisableTelemetry": true,
    "EnableTrackingProtection": {
      "Value": true,
      "Locked": false,
      "Cryptomining": true,
      "Fingerprinting": true
    },
    "Extensions": {
      "Install": [
        "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin"
      ]
    }
  }
}
1 Like

But i want to harden firefox by usre js file

There are a few files in your system that can receive the content of
user.js (eg: /etc/firefox-esr/firefox-esr.js).

You could append your user.js to it.

how to exactly use a policy.json

I use it mostly to install extensions.
The hard part was to figure out the right url and identifiants;
Fortunately there is an extension for that :
https:github.com/mkaply/queryamoid/releases/tag/v0.1

Otherwise its usage is documented by mozilla.

I don’t think it’s possible to use a user.js file directly without also creating a Firefox profile in the disposable template. To avoid having a profile in the default state of your dispVM either try @dal’s idea of appending firefox-esr.js and/or port the rules from user.js into a config file as described by Mozilla and the following post:

If your threat model for the dispVM allows for it, then simply running Firefox in the appVM before creating the disposable template will allow you to use the user.js file directly. This method is not appropriate if you’re trying to preserve anonymity in your dispVMs, for example, but is fine if you want an established identity along with the other benefits of a dispVM such as non-persistence of cookies or malware…

I am going to use the policies.json file and base the disposable vm’s off of them.
Anyone already doing this and has a policies.json file that i can use??
Or is there any tool to convert arkenfox or any other user js to policies.json directly???
Thanks.

https://ffprofile.com/

What are you suggesting by posting this link? It would be good to know that.

This guide solves the original question:

2 Likes