Login Register


Tutorial setting up a homemade tor proxy server with a rasberry pi. filter_list
Author
Message
setting up a homemade tor proxy server with a rasberry pi. #1
This tutorial Isn't meant for pure beginners. It's better for you to have some experience with networking and linux just to have a base knowledge of what you are doing.
*there are external links that lead to other tutorials.
  1. What you'll need:

    You'll need a few things to run this tutorial:
    • Raspberry Pi model B - Ethernet is required
    • Ethernet cable
    • WiFi adapter
    • SD Card (4GB or greater) with Raspbian on it. You can either copy the Raspbian image onto it or buy a ready-made Raspbian card
    • Power supply for your Pi & a Micro USB cable
    • USB Console cable (optional) - this makes it a little easier to debug the system
    • Case for your Pi (optional)
    • A SD or MicroSD card reader (optional)


  2. Preparation


    When done you should have a Pi that is booting Raspbian, you can connect to with a USB console cable and log into the Pi via the command line interface.

    Now we can set it up to be used as an AP.
    It is possible to do this tutorial via ssh on the Ethernet port or using a console cable.

    If using a console cable, even though the diagram on the last step shows powering the Pi via the USB console cable (red wire) don't connect the red wire and instead power it from the wall adapter. Keep the black, white and green cables connected as is.

  3. Install TOR


    Essentially, this tutorial just follows the tor "anonymizing middlebox" writeup here.

    Log into your pi by Ethernet or console cable and run
    Code:
    sudo apt-get install tor

    Edit the tor config file by running
    Code:
    sudo nano /etc/tor/torrc

    and copy and paste the text into the top of the file, right below the the FAQ notice.
    *edit it to suit your needs. YMMV*
    Code:
    Log notice file /var/log/tor/notices.log VirtualAddrNetwork 10.192.0.0/10 AutomapHostsSuffixes .onion,.exit AutomapHostsOnResolve 1 TransPort 9040 TransListenAddress 192.168.42.1 DNSPort 53 DNSListenAddress 192.168.42.1

    Edit the host access point
    Code:
    sudo nano /etc/hostapd/hostapd.conf

    Change your routing tables

    +Flush+
    Code:
    sudo iptables -F sudo iptables -t nat -F

    +route ssh+
    Code:
    sudo iptables -t nat -A PREROUTING -i wlan0 -p tcp --dport 22 -j REDIRECT --to-ports 22

    +route DNS+
    Code:
    sudo iptables -t nat -A PREROUTING -i wlan0 -p udp --dport 53 -j REDIRECT --to-ports 53

    +route TCP traffic+ *this is key to it working*
    Code:
    sudo iptables -t nat -A PREROUTING -i wlan0 -p tcp --syn -j REDIRECT --to-ports 9040

    +double check iptables+
    Code:
    sudo iptables -t nat -L

    If all is good, we'll save it to our old NAT save file
    Code:
    sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"

    It will automatically get loaded when the networking is set up on reboot

    Next we'll create our log file
    Code:
    sudo touch /var/log/tor/notices.log sudo chown debian-tor /var/log/tor/notices.log sudo chmod 644 /var/log/tor/notices.log

    Check it with
    Code:
    ls -l /var/log/tor

    Start the tor service manually
    Code:
    sudo service tor start

    Check its really running (you can run this whenever you're not sure, it something is wrong you'll see a big FAIL notice
    Code:
    sudo service tor status

    Finally, make it start on boot
    Code:
    sudo update-rc.d tor enable

  4. Test It!
    You should see it in your wireless connections list now. Connect with it using the password you set in the hostapd.conf file.

Now credit where credit is Due. I found this tutorial on Adafruit.com

I'll add other parts to it from my own experiences or others.

Thank you all.

Reply





Messages In This Thread
setting up a homemade tor proxy server with a rasberry pi. - by Null_Byte - 03-23-2014, 08:12 AM



Users browsing this thread: