I want to not be able to go to any site unless it's on a whitelist, and I'd rather not use something like Privoxy, can I do that with Ubuntu?
I'm thinking that perhaps I can use /etc/hosts
, /etc/hosts.allow
, and/or /etc/hosts.deny
. My first thought would be to somehow block everything using hosts.deny
and then create the whitelist in hosts.allow
. Is that possible? And if so how do I define something like "all sites direct to localhost" in hosts.deny
and then "except these sites" in hosts.allow
?
To block all sites with
hosts.deny
you should putALL: ALL
in your/etc/hosts.deny
file.But there are some better ways to do this, for example:
Using a firewall like
iptables
, with firewall you can block all HTTP, HTTPS, whatever traffic you want and allow it for some spacial IP, domain, etc.Read this: https://unix.stackexchange.com/questions/212233/iptables-to-block-all-websites
Using something like
dnsmasq
:Read this: https://www.linuxquestions.org/questions/linux-networking-3/how-to-block-all-websites-except-2-a-667350/