Last active
October 6, 2024 20:11
-
-
Save tmap/1f86dafa9e515f8ba281ec3a329ca667 to your computer and use it in GitHub Desktop.
force through tor, allow local ssh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt update | |
sudo apt install tor -y | |
sudo nano /etc/tor/torrc | |
add: | |
VirtualAddrNetworkIPv4 10.192.0.0/10 | |
AutomapHostsOnResolve 1 | |
TransPort 9040 | |
DNSPort 5353 | |
sudo systemctl restart tor | |
sudo iptables -F && \ | |
sudo iptables -t nat -F && \ | |
sudo iptables -F && sudo iptables -t nat -F && sudo iptables -X && \ | |
sudo iptables -I INPUT 1 -p tcp -s 192.168.1.0/24 --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT && \ | |
sudo iptables -I OUTPUT 1 -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT && \ | |
sudo iptables -A OUTPUT -o lo -j ACCEPT && \ | |
sudo iptables -A OUTPUT -d 127.0.0.1/32 -j ACCEPT && \ | |
sudo iptables -A OUTPUT -m owner --uid-owner debian-tor -j ACCEPT && \ | |
sudo iptables -t nat -A OUTPUT -p tcp --syn -j REDIRECT --to-ports 9040 && \ | |
sudo iptables -t nat -A OUTPUT -p udp --dport 53 -j REDIRECT --to-ports 5353 && \ | |
sudo iptables -A OUTPUT -j DROP && \ | |
sudo netfilter-persistent save |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment