Onion Pi: Created by Lady Ada
Onion Pi: Created by Lady Ada
Guide Contents 2
Overview 3
Who is this good for? 3
What is Tor? 3
What you'll need 5
Preparation 6
Install Tor 9
Test It! 14
Do more... 16
Set up as a Wifi-to-Wifi Tor middlebox 16
Configure Tor to make your Exit Node in a particular country only 16
Set up as a Tor Relay or Exit Node 16
Donate to the Tor Project 16
Feel like someone is snooping on you? Browse anonymously anywhere you go with the Onion Pi Tor proxy. This is fun
weekend project that uses a Raspberry Pi, a USB WiFi adapter and Ethernet cable to create a small, low-power and
portable privacy Pi.
Using it is easy-as-pie. First, plug the Ethernet cable into any Internet provider in your home, work, hotel or
conference/event. Next, power up the Pi with the micro USB cable to your laptop or to the wall adapter. The Pi will
boot up and create a new secure wireless access point called Onion Pi. Connecting to that access point will
automatically route any web browsing from your computer through the anonymizing Tor network.
What is Tor?
Tor is an onion routing service - every internet packet goes through 3 layers of relays before going to your destination.
This makes it much harder for the server you are accessing (or anyone snooping on your Internet use) to figure out
who you are and where you are coming from. It is an excellent way to allow people who are blocked from accessing
websites to get around those restritions.
Journalists use Tor to communicate more safely with whistleblowers and dissidents. Non-governmental
organizations (NGOs) use Tor to allow their workers to connect to their home website while they're in a foreign
country, without notifying everybody nearby that they're working with that organization.
A branch of the U.S. Navy uses Tor for open source intelligence gathering, and one of its teams used Tor while
deployed in the Middle East recently. Law enforcement uses Tor for visiting or surveilling web sites without
leaving government IP addresses in their web logs, and for security during sting operations.
BEFORE YOU START USING YOUR PROXY - remember that there are a lot of ways to identify you, even if
your IP address is 'randomized'. Delete & block your browser cache, history and cookies - some browsers
allow "anonymous sessions". Do not log into existing accounts with personally identifying information (unless
you're sure that's what you want to do). Use SSL whenever available to end-to-end encrypt your
communication. And read https://www.torproject.org/ for a lot more information on how to use Tor in a smart
and safe way
This tutorial is a great way to make something fun and useful with your Raspberry Pi, but it is a work in
progress. We can't guarantee that it is 100% anonymous and secure! Be smart & paranoid about your Tor
usage.
Chances are you've got a couple of these items already. If not, our Onion Pi starter pack (http://adafru.it/1410) has
everything you need
Make sure to expand the filesystem to the entire disk or you may run out of space (this is done by default now on
Raspbian when you boot it)
However, don't configure WiFi - you can log in over Ethernet or Serial console
Set up and test the Ethernet connection - in general this means just plug into Ethernet before
booting (https://adafru.it/aUB)
Check that you can ssh to, or ping from the Raspberry Pi
For WiFi, you do not need to configure anything. and that your Wifi adapter is recognized and shows up as wlan0
when you run ifconfig wlan0
When done you should have a Pi that is booting Raspbian, has working Ethernet, and you can connect to with a USB
console cable and log into the Pi via the command line interface.
Then follow our Pi-as-Access-Point tutorial (https://adafru.it/cg6)to set up the Pi as a wifi access point router.
When done you should be able to connect to the Pi as a WiFi access point and connect to the internet through it.
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) we suggest not connecting the red wire and instead powering from the wall adapter. Keep the black, white
and green cables connected as is.
If you hate typing a lot, this script from breadk will do it all (https://adafru.it/cge) for you! Make sure to read through the
script to make sure you don't want to change anything! (More about how to use it here! (https://adafru.it/cgf)) We do
suggest going step by step so you can have the experience of all the upkeep tasks.
and copy and paste the text into the top of the file, right below the the FAQ notice.
Time to change our ip routing tables so that connections via the wifi interface (wlan0) will be routed through the tor
software.
Type the following to flush the old rules from the ip NAT table
sudo iptables -F
sudo iptables -t nat -F
If you want to be able to ssh to your Pi after this, you'll need to add an exception for port 22 like this (not shown in the
screenshot below)
Type the following to route all DNS (UDP port 53) from interface wlan0 to internal port 53 (DNSPort in our torrc)
Type the following to route all TCP traffic from interface wlan0 to port 9040 (TransPort in our torrc)
sudo iptables -t nat -A PREROUTING -i wlan0 -p tcp --syn -j REDIRECT --to-ports 9040
Next you can check that the ip tables are right with
It will automatically get loaded when the networking is set up on reboot (as we did in the last tutorial on making a Pi
access point)
Check it with
ls -l /var/log/tor
Check its really running (you can run this whenever you're not sure, it something is wrong you'll see a big FAIL notice
Connect to it using the password you entered into the hostapd configuration file
You can open up a Terminal or command prompt and ping 192.168.42.1 to check that your connection to the Pi is
working. However you won't be able to ping outside of it because ping's are not translated through the proxy
To check that the proxy is working, visit a website like http://www.ipchicken.com (https://adafru.it/cg4) which will
display your IP address as it sees it and also the matching domain name if available. The IP address should not be from
BEFORE YOU START USING YOUR PROXY - remember that there are a lot of ways to identify you, even if
your IP address is 'randomized'. Delete your browser cache, history and cookies (some browsers allow
"anonymous sessions") and read https://www.torproject.org/ for a lot more information on how to use TOR in
a smart and safe way