Proxy Web Traffic

From UbuntuPhone
Jump to navigation Jump to search

There is an assigned bug to sort out blocking webbugs and trackers, in the meantime there is Privoxy...


Follow Install Packages to install privoxy, then start it:

apt-get install privoxy
service privoxy start

Edit /etc/environment and add:


Reboot the phone to change the root filesystem to read-only and to ensure that sessions have the env vars above set (you can check in a terminal with printenv).

Visit to test it is working.

SSH tunnel

Set the root file system to be read-write and edit /etc/privoxy/config adding this line with the port the ssh tunnel will be on, in this case 3128:

forward-socks5   /      .

Add a list of local networks you don't want the tunnel to be used for (so you can use the web browser to login to public wifi networks for example):

forward         192.168.*.*/     .

Create a script to start a ssh tunnel, eg ~/bin/proxy containing something like this (remove the v for non-verbose output in the terminal):


if [[ $1 ]]; then
  echo "Run this script like this:"
  echo "/bin/bash $0 server-name-from-ssh-config-file"

ssh -vTnN -C -F "$HOME/.ssh/config" -D 3128 $REMOTE_SERVER

This works best if you have short names for servers in your ~/.ssh/config and have ssh keys set up.

Start the tunnel (note you might need to run it as follows unless you ssh to localhost first and have ~/bin/ in your $PATH, then you can simply type proxy after you chmod 750 ~/bin/proxy):

bash ~/bin/proxy your-ssh-server

Visit a page that reports your IP address, eg


If your network is very unreliable, try adding this to /etc/privoxy/config:

keep-alive-timeout 300