Skip to content

Instantly share code, notes, and snippets.

@turcane
Created July 21, 2019 19:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save turcane/916e3cdc9bd73cec5f04f365754d6b84 to your computer and use it in GitHub Desktop.
Save turcane/916e3cdc9bd73cec5f04f365754d6b84 to your computer and use it in GitHub Desktop.
Raspberry Pi Tor Access Point
# Tested on Rasperry 3B+ with Raspbian Buster (2019-07-10)
# Sources:
# 1. https://3os.org/raspberryPi/TOR-Pi/
# 2. https://jankarres.de/2013/12/raspberry-pi-tor-wlan-hotspotaccess-point/
sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get install git vim monit htop vnstat -y
git clone https://github.com/unixabg/RPI-Wireless-Hotspot.git
cd RPI-Wireless-Hotspot
sudo ./install
# Configs are on
# 1. /etc/hostapd/hostapd.conf
# 2. /etc/network/interfaces
# 3. /etc/udhcpd.conf
sudo apt-get install tor
sudo vim /etc/tor/torrc
# -- Add the following just below the first set of comments:
Log notice file /var/log/tor/notices.log
VirtualAddrNetwork 10.192.0.0/10
AutomapHostsSuffixes .onion,.exit
AutomapHostsOnResolve 1
TransPort <wlan0 ip>:9040
DNSPort <wlan0 ip>:53
# --
sudo iptables -F && sudo iptables -t nat -F
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
sudo iptables -t nat -L
sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
sudo touch /var/log/tor/notices.log
sudo chown debian-tor /var/log/tor/notices.log && sudo chmod 644 /var/log/tor/notices.log
sudo service tor start
sudo service tor status
sudo update-rc.d tor enable
sudo systemctl unmask hostapd
sudo systemctl enable hostapd
sudo systemctl start hostapd
sudo apt-get install
sudo nano /etc/monit/monitrc
# -- add those lines to the end of the config:
check process gdm with pidfile /var/run/tor/tor.pid
start program = "/etc/init.d/tor start"
stop program = "/etc/init.d/tor stop"
# --
sudo monit reload
sudo update-rc.d monit enable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment