Jamesdean11 Jamesdean11 - 1 month ago 17
Linux Question

Reach router admin page inside TOR (raspberry pi)

I have a Pi zero programmed as a wireless accespoint (https://learn.adafruit.com/setting-up-a-raspberry-pi-as-a-wifi-access-point). Wlan0 delegates IPs to my computers via hostapd and wlan1 is connected to my wireless. Everything is routed over tor. I have an admin page (https://github.com/billz/raspap-webgui) on adress 10.3.141.1. Im trying to reach this but i can't, i guess its because my traffic goes trough TOR.

I want to be able to connect to WLAN0 (SSID=TOR_TEST) and be able to access the admin page directly.

Current Iptables:

iptables -t nat -A PREROUTING -i wlan0 -p tcp --dport 22 -j REDIRECT --to-ports 22
iptables -t nat -A PREROUTING -i wlan0 -p udp --dport 53 -j REDIRECT --to-ports 53
iptables -t nat -A PREROUTING -i wlan0 -p tcp --syn -j REDIRECT --to-ports 9040
iptables -t nat -A POSTROUTING -o wlan1 -j MASQUERADE
iptables -A FORWARD -i wlan1 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i wlan0 -o wlan1 -j ACCEPT


If i exclude this row

iptables -t nat -A PREROUTING -i wlan0 -p tcp --syn -j REDIRECT --to-ports 9040


it stops routing trough TOR and i can access the admin page, so i guess it's just a simple exception of some kind i have to put in iptables? Help please!

Answer

Before

iptables -t nat -A PREROUTING -i wlan0 -p tcp --syn -j REDIRECT  --to-ports 9040

add:

iptables -t nat -A PREROUTING -i wlan0 -d 10.3.141.1 -p tcp --syn -j ACCEPT