måndag 9 september 2013

tor2web: how to run a proxy *Not ttetsted*

Want to set up a proxy of your own? Here's how! For simplicity, we'll assume you're running a recent version of Ubuntu, but the instructions should be easy to adapt to any other OS. (Don't have a server? You can get one using Amazon's EC2 with Ubuntu AMIs.)

# Install the latest version of tor, with the tor2web flag
sudo apt-add-repository http://deb.torproject.org/torproject.org
gpg --keyserver keys.gnupg.net --recv 886DDD89
gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -
sudo apt-get update
sudo apt-get install deb.torproject.org-keyring dpkg-dev autoconf
sudo apt-get build-dep tor
git clone git://git.torproject.org/debian/tor.git
cd tor
curl https://trac.torproject.org/projects/tor/raw-attachment/ticket/2553/0001-Add-support-for-an-enable-tor2web-mode-DEB_BUILD_OPT.patch | patch -p 1
./autogen.sh
echo "all:" > src/test/Makefile
echo "check:" >> src/test/Makefile
echo "install:" >> src/test/Makefile
DEB_BUILD_OPTIONS="enable-tor2web-mode" fakeroot debian/rules binary
cd ..
sudo dpkg -i tor_0.2.3.12-alpha-1_amd64.deb
# (this will return an error, ignore it)
sudo sh -c "echo Tor2webMode 1 >> /etc/tor/torrc"
sudo /etc/init.d/tor restart

# Install privoxy to translate normal web requests to SOCKS, which Tor speaks:
sudo apt-get install privoxy
sudo sh -c "curl http://tor2web.org/conf/privoxy-config > /etc/privoxy/config"
sudo /etc/init.d/privoxy restart

# Install Apache to serve web requests
sudo apt-get install apache2
sudo sh -c "curl http://tor2web.org/conf/apache2.conf > /etc/apache2/apache2.conf"
sudo sh -c "curl http://tor2web.org/conf/tor2web.org-ss.crt > /etc/apache2/tor2web.org.crt"
sudo sh -c "curl http://tor2web.org/conf/tor2web.org-ss.key > /etc/apache2/tor2web.org.key"

# Make the cache directory (edit apache2.conf if you want this somewhere else)
sudo mkdir /mnt/apache2-cache
sudo chown www-data /mnt/apache2-cache

sudo /etc/init.d/apache2 restart
To debug, you can check the individual components to make sure they work:
# Tor
curl -i --socks4a 127.0.0.1:9050 http://duskgytldkxiuqc6.onion/
# privoxy
curl -x 127.0.0.1:8118 http://duskgytldkxiuqc6.onion/
# Apache
curl -k -H "Pragma: none" -H "Host: duskgytldkxiuqc6.tor2web.org" -i https://127.0.0.1/
# run again to see if it serves from cache:
curl -k -H "Pragma: none" -H "Host: duskgytldkxiuqc6.tor2web.org" -i https://127.0.0.1/
That's it!
Send your IP address to info@tor2web.org and ask to be added to the *.tor2web.org round-robin. This will allow your server to respond to requests from the public for Tor hidden services. (We'll also send you the real SSL keys; the ones above are only for testing purposes.)
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?
info@tor2web.org
Tor2Web was originally developed by Aaron Swartz and Virgil Griffin and is
developed and mainteined by the HERMES Center for Transparency and Digital Human Rights
to report abuse, please contact abuse@tor2web.org
Skicka en kommentar