Pages

Saturday, December 28, 2019

How to avoid being spied : so you can turn a Raspberry Pi into your own Tor server


Access to the network of networks in a safe and anonymous way is possible thanks to projects such as Tor. And with Onion Pi, Tor joins Raspberry Pi to create an anonymous home proxy

In case you don't know him yet, Tor is an interesting project that aims to make our internet connections something secure and anonymous away from the control of companies or governments. And among its main exponents we have Tor Browser, a web browser based on Mozilla Firefox plus several add-ons and configurations that allow us to access web pages without a trace.

Although Tor Browser is available for Windows, macOS and Linux, and there are also official and unofficial versions for other platforms such as Android, iPhone or iPad, if you have several devices connected to the internet and you want them all to access anonymously, you may want use a solution like Onion Pi.

Onion Pi is a Raspberry Pi device that has Tor installed and works as an anonymous proxy. Thus, if you access the Internet from Onion Pi as an intermediary instead of directly from your router, you can navigate more freely avoiding security and privacy problems.

You can purchase Onion Pi from the official website of its managers, Adafruit, but like any open source project, you can set up your own Onion Pi yourself. Let's see what you need for it.

To create our own anonymous proxy based on Tor and Raspberry Pi we will need, on the one hand, the necessary hardware to start up a Raspberry Pi device.

Although the configurations may vary, the basic elements we need are a Raspberry Pi motherboard, a housing to protect it from dust and external elements, a Wi-Fi module to send and receive signal in good condition, an Ethernet cable to connect the Raspberry Pi to the router, a power adapter and, finally, a microSD card to host the software.
Optionally, you will need a keyboard and mouse to configure the Raspberry Pi and connect it to a monitor or TV.

As usual, from the official Raspberry Pi website we can find packages that include everything you need to launch a fully functional Raspberry Pi device.

Installing and configuring the software


Once the hardware is assembled, the first time we start it, we must install the software. In this sense, if we have purchased a microSD card with pre-installed NOOBS, it will offer us a graphic menu to choose which operating system we want to install. In our case, to create the anonymous proxy based on Tor we will use Raspbian, a version of Debian Linux adapted to Raspberry Pi.
Once we have an operating system in our Raspberry Pi, now we must install Tor. To do this, we open the terminal and first execute an order to update the available packages, sudo apt-get update, and then the order to install Tor: sudo apt-get install tor.

With Tor installed, we edit your configuration file with the command sudo nano / etc / tor / torrc and paste the following text in the first lines of the file, below the FAQ questions.

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

Then we edit the configuration of the access point with the command sudo nano /etc/hostapd/hostapd.conf to change the default password for a more secure one. We will also have to edit the routing tables with the sudo iptables -F and then sudo iptables -t nat -F commands and, to verify that everything is fine, we can test the tables with the sudo iptables -t nat -L command. If everything is correct, we will execute the sudo sh -c "iptables-save> /etc/iptables.ipv4.nat” command to update the NAT file.

If you want to get information about the connections and traffic handled by your anonymous proxy, we must create files to save that information. To do this, we must launch the following orders from the Terminal:

sudo touch /var/log/tor/notices.log
sudo chown debian-tor /var/log/tor/notices.log
sudo chmod 644 /var/log/tor/notices.log

To verify that they were created correctly, we will execute the command ls -l / var / log / tor.

We only have to launch Tor to activate the anonymous proxy Onion Pi. To do this, we launch the sudo service tor start order and then the sudo service tor status order to verify that Tor works correctly.

Finally, in order for Tor to run automatically every time we start Raspberry Pi, we must launch the sudo update-rc.d tor enable command in the Terminal.

From now on, to get the protection and anonymity of Onion Pi you must access its Wi-Fi connection instead of connecting directly to the router. To do this, you must search for the Onion Pi connection and enter the password that we have previously set.

And to verify that the proxy works and that your browsing is anonymous, try any web page that indicates your IP and location. If the proxy goes well, the result should not match your IP or where you are.

If you have questions about how to start an anonymous proxy with Tor and Raspberry Pi, you can take a look at the documentation available at Adafruit.

No comments:

Post a Comment