Apr 10 2009
Update: If all you’re looking to do is use TOR with android, please use this tutorial. The below information is out of date for such uses.
- A jailbroken android install.
- Debian Armel on android.
- SSHD running in the chrooted debian environment.
Want to browse the web anonymously with your android device, without t-mobile recording your every move? Look no further.
Few are aware that the default android browser actually allows you to use an http proxy to connect to the web. It is a rather obscure setting to trigger, and there are no provisions for you to connect through a socks proxy, such as an ssh tunnel or the tor network. Luckily, privoxy handles all this for us. Privoxy is an http proxy that is able to forward http requests through the encrypted socks tunnel, and out to its intended recipient. In this tutorial, I will show you how to set your android browser to use privoxy, and how to configure privoxy to forward to a socks proxy.
Lets jump right in.
Using connectbot (available from the android market), ssh into your chrooted debian on localhost. Run:
apt-get install tor
This will fetch both tor and privoxy for you. Now, you’ll need to configure privoxy to forward its http requests through tor, or whatever other tunnel you’ve created through ssh (see my previous post, http://www.inputoutput.io/how-to-subvert-deep-packet-inspection-the-right-way/). Append the following line to your /etc/privoxy/config file:
forward-socks5 / localhost:9050 .
Change 9050 to whatever port your tor or ssh tunnel is listening on. Default is 9050 for tor. Now, start tor and privoxy with:
/etc/init.d/tor start privoxy /etc/privoxy/config
I had to make /dev/null world-writable for tor to stop complaining. You’ll have to run that last part every time you restart your android device. Now on to the annoying part. In terminal emulator (also available from the android market):
su sqlite3 /data/data/com.android.providers.settings/databases/settings.db SQLite version 3.5.9 Enter ".help" for instructions sqlite> INSERT INTO system VALUES (99, 'http_proxy', 'localhost:8118'); sqlite> .quit
Change 8118 to whatever port privoxy is listening on, but that port is the default. Now the browser is configured to use privoxy as its http proxy. Privoxy, in turn, is configured to forward connections through tor or the ssh tunnel. This means your done, congratulations!
If you want to stop the browser from using the proxy at any point, in terminal emulator:
su sqlite3 /data/data/com.android.providers.settings/databases/settings.db SQLite version 3.5.9 Enter ".help" for instructions sqlite> DELETE FROM system WHERE name='http_proxy'; sqlite> .quit
It’s quite frustrating to go through this process every time you want to switch between proxified and raw browsing, so I suggest installing a second browser such as ‘steel’ for your raw connection, and only using the default browser for proxified connections.