tinyapps.org / docs / Whitelist or blacklist websites in Ubuntu Linux


Purpose

Prevent access to certain sites (blacklisting) or all sites other than those specified (whitelisting) from Mozilla Firefox.

Environment

Setup DansGuardian

  1. sudo apt-get update && sudo apt-get install dansguardian tinyproxy
  2. Edit /etc/dansguardian/dansguardian.conf as follows:
    1. Delete or comment out the following line: UNCONFIGURED - Please remove this line after configuration
    2. Change proxyport = 3128 to proxyport = 8888 (8888 is Tinyproxy's default port; 3128 is Squid's default port)
    3. Change weightedphrasemode = 2 to weightedphrasemode = 0 to disable weightedphrasemode if desired
  3. Blacklist or whitelist:
  4. sudo dpkg-reconfigure dansguardian

Setup Firefox

  1. Create user.js inside of ~/.mozilla/firefox/randomstring.default/ and insert the following lines:
    lockPref("app.update.enabled", false);
    lockPref("network.proxy.http", "localhost");
    lockPref("network.proxy.http_port", 8080);
    lockPref("network.proxy.type", 1);
    lockPref("network.proxy.no_proxies_on", "");
    lockPref("network.proxy.share_proxy_settings", true);
  2. Prevent user from modifying:
    sudo chmod 644 user.js
    sudo chown root:root user.js

Notes

Updates

Sources


created: 2012.06.24, updated: 2016.04.22