Monthly Archives: April 2012

Privoxy via ssh tunnel

So I started to use privoxy to block ads before they get to the web-browser(check out privoxy-blocklist). But I still wanted to be able to tunnel my traffic via ssh while browsing the web from places other then my house, in the past I would use a ssh socks5 proxy: ssh -D <someport>

To be able to use both, you need to take advantage of another awesome builtin feature of ssh, ssh local port forwarding (more info on ssh port forwarding)
to do this, set up privoxy, and get the adblock list going, in my example I’ll keep privoxy on it’s default port: 8118

once privoxy is going(on the remote server), and only listening on localhost (/etc/privoxy/config)

You can set up the ssh local port forward on your computer by:
$ ssh -L 50000:localhost:8118
(port 50000 can by anything, that does not matter)

then to test to make sure it works you can do:
telnet localhost 50000
then type /
you should see:

telnet localhost 50000
Trying ::1…
Connected to localhost.
Escape character is ‘^]’.
HTTP/1.1 400 Invalid header received from client
Proxy-Agent: Privoxy 3.0.19
Content-Type: text/plain
Connection: close

Invalid header received from client.
Connection closed by foreign host

Once that is working, you can set up the proxy settings in firefox/chromium

For Firefox, go to:

Preferences > Advanced > Network > Settings

For Chromium you can use:

$ chromium --proxy-server="localhost:50000"


It’s also fun to turn on debug¬† 1024 # Log the destination for requests Privoxy didn’t let through, and the reason why.
then tail -f /var/log/privoxy/logfile
Useful to know if you have to remove any of the blocks, eg the default.action:promotions   one
it screws up newegg: