tor2web: how to run a proxy

Want to set up a proxy of your own? Here's how:

  1. Get a server. For simplicity, we'll assume you're running a recent version of Ubuntu. (Don't have a server? You can get one using Amazon's EC2 with Ubuntu AMIs.)

  2. Install the latest version of Tor. (Details here.)

    Give Tor a second to start up. Soon you should be able to visit hidden services using Tor's SOCKS proxy. You can test this with:

    curl -i --socks4a 127.0.0.1:9050 http://duskgytldkxiuqc6.onion/

  3. apt-get install privoxy

    Squid (our cache) doesn't currently speak SOCKS; Privoxy is required to translate normal HTTP requests to SOCKS.

    Replace /etc/privoxy/config with our Privoxy config and restart:

    /etc/init.d/privoxy restart

    You should now be able to visit hidden services thru Privoxy. You can test this with:

    curl -x 127.0.0.1:8118 http://duskgytldkxiuqc6.onion/

  4. apt-get install squid

    Squid is a caching proxy; it speeds up tor2web requests by caching the results.

    Edit /etc/default/squid and set SQUID_MAXFD to 65536 instead of 1024.

    Download rewriteurl.pl and place it in /etc/squid and make it executable. Test it with:

    echo "http://duskgytldkxiuqc6.tor2web.com/foo" | ./rewriteurl.pl

    (It should return http://duskgytldkxiuqc6.onion/foo.)

    Then replace /etc/squid/squid.conf with our Squid config and restart:

    /etc/init.d/squid restart

    You should now be a tor2web server. Test this with:

    curl -H "Pragma: none" -H "Host: duskgytldkxiuqc6.tor2web.com" -i http://127.0.0.1/

    Run it again and it should return instantly from the cache.

That's it!

Send your IP address to me@aaronsw.com and ask to be added to the *.tor2web.com round-robin. This will allow your server to respond to requests from the public for Tor hidden services.

If you have trouble with the process or would like a different way of doing it, let me know. If you want to build scripts or tools to simplify this process, that would be great too. You might also be interested in running a Tor relay.

See also: Is this legal?

maintained by Aaron Swartz (me@aaronsw.com)