Tor Setup on Brainy Pi

by aaditya04gupta in Circuits > Raspberry Pi

217 Views, 3 Favorites, 0 Comments

Tor Setup on Brainy Pi

Final.png

In today's world of the internet, cybercrime is increasing day by day thus privacy and security become very important. To solve this problem people came up with the idea of Tor and Vpn. Tor is one of the best available options presents. Tor offers a number of privacy and anonymity protections over directly connecting to a website. If you use Tor correctly, your real IP address cannot be determined by the websites you visit. You can access websites without your internet service provider being aware of your browsing history. You can bypass many kinds of censorship.




Supplies

Screenshot 2023-01-12 114534.png

Brainy pi

ethernet / wifi

sd card

Update the System Software's

It is very important to update the system before installing any new package or software

Terminal $

sudo apt update
sudo apt full-upgrade

Intalling Tor

You can install tor by using command

sudo apt install tor -y


Configuration

1. Open up the file in the nano text editor by entering the command below.

sudo nano /etc/tor/torrc

2. Add the following configurations just under the FAQ notice. These lines will configure TOR to run on port 9050 and port 53

Log notice file /var/log/tor/notices.log
VirtualAddrNetwork 10.192.0.0/10
AutomapHostsSuffixes .onion,.exit
AutomapHostsOnResolve 1
TransPort 9040
TransListenAddress 192.168.220.1
DNSPort 53
DNSListenAddress 192.168.220.1

Now save and quit out of the file by pressing Ctrl +X then Y and then Enter.

3. TOR now set up, we need to flush the iptables, and we can do this by running the following two commands

sudo iptables -F
sudo iptables -t nat -F

4. With the IPTables now flushed we can now install our new IPTables. This setup will route all the traffic incoming from the wlan0 connection through to our TOR connection that is running through port 53. 

sudo iptables -t nat -A PREROUTING -i wlan0 -p tcp --dport 22 -j REDIRECT --to-ports 22
sudo iptables -t nat -A PREROUTING -i wlan0 -p udp --dport 53 -j REDIRECT --to-ports 53
sudo iptables -t nat -A PREROUTING -i wlan0 -p tcp --syn -j REDIRECT --to-ports 9040

 5. To check that the IPtables have been correctly entered you can use the following command.

sudo iptables -t nat -L

6. To store this into the file we set up in our wireless access point use the command

sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"

Creating Log File

1. To create our log file, we can use following command.

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

This will be handy for tracking problems.

2. We can check to see if the log file has now been created and permissions set correctly by using command

ls -l /var/log/tor

Strating Torr

1. To start the service, we can use the command.

sudo service tor start

2. To check the service use command

sudo service tor status

3. Let’s make the TOR service start on boot, this will ensure that the traffic will always be routed through it. Do this with the following command.

sudo update-rc.d tor enable