iptables -A OUTPUT -p icmp -j REJECT
iptables -t nat -A OUTPUT ! -o lo -p tcp -m owner --uid-owner $USER -m tcp -j REDIRECT --to-ports 9040
iptables -t nat -A OUTPUT ! -o lo -p udp -m owner --uid-owner $USER -m udp --dport 53 -j REDIRECT --to-ports 53
iptables -t filter -A OUTPUT -p tcp -m owner --uid-owner $USER -m tcp --dport 9040 -j ACCEPT
iptables -t filter -A OUTPUT -p udp -m owner --uid-owner $USER -m udp --dport 53 -j ACCEPT
iptables -t filter -A OUTPUT ! -o lo -m owner --uid-owner $USER -j DROP
Last active
October 25, 2022 18:33
-
-
Save jkullick/d21c6ffa3680ca439619e0da2aa37dae to your computer and use it in GitHub Desktop.
Route all Traffic through Tor for specific User on Linux with IPTables
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment