Closed pickfire closed 9 years ago
I use tor
with polipo
, why doesn't the /etc/hosts worked?
Unless I am mistaken, polipo and other local proxies bypass the /etc/hosts file. The obvious workaround is to add the following to the postprocess () { }
variable in hostsblock.conf:
postprocess () {
grep -v " localhost$" /etc/hosts | awk '{print $2}' > /etc/polipo/forbidden
killall -SIGUSR1 -- polipo
}
(If you have anything else in postprocess () {}
, make sure to put it before the line with awk
)
This will snag out all blocked domains from /etc/hosts (if that is the destination file you use) except for localhost (you definitely don't want to block that domain), strip out the 127.0.0.1 or 0.0.0.0, and dump out the results to /etc/polipo/forbidden
, where polipo keeps its own blocklist. the killall
line tells polipo to reload the /etc/polipo/forbidden
file.
Yeah, tor
and polipo
bypass /etc/hosts so you could just strip you the 127.0.0.1 and 0.0.0.0, but I don't think we should use awk
as it removes the comments.
From a user's perspective:
For those with technical knowledge: