About
Side Projects
Blog
2023-08-23

Blocking Web Sites on Firefox

Firefox has an ability to configure some behaviours for all users on a host via a “policy”. On a linux host policy files can be found at /etc/firefox/policies/. This mechanism can be used to block web-sites.

Create a file in this directory; something like blockedsites.json would be suitable. Edit this file with;

{
  "policies": {
     "WebsiteFilter": {
       "Block": [
         "*://www.somesite.co.nz/*",
         "*://www.someothersite.de/*"
       ]
     }
  }
}

Restart Firefox and when you now browse to these sites, a page will be shown indicating that the site is disallowed.