mirror of
https://github.com/edu4rdshl/tor-router.git
synced 2026-07-17 23:24:48 +00:00
comment addition process done
This commit is contained in:
parent
20513c7665
commit
27eca3ee44
1 changed files with 16 additions and 8 deletions
|
|
@ -35,24 +35,32 @@ function startTR()
|
|||
echo "You need to install the iptables package."
|
||||
exit 1
|
||||
else
|
||||
# init iptables roules
|
||||
iptables -F
|
||||
iptables -t nat -F
|
||||
# set iptables nat
|
||||
iptables -t nat -A OUTPUT -m owner --uid-owner "$TOR_UID" -j RETURN
|
||||
|
||||
# set dns redirect
|
||||
iptables -t nat -A OUTPUT -p udp --dport 53 -j REDIRECT --to-ports 5353
|
||||
|
||||
for NET in $NON_TOR 127.0.0.0/9 127.128.0.0/10; do
|
||||
# executable local addresses
|
||||
for NET in $NON_TOR 127.0.0.0/9 127.128.0.0/10 127.0.0.0/8;; do
|
||||
iptables -t nat -A OUTPUT -d "$NET" -j RETURN
|
||||
done
|
||||
|
||||
iptables -t nat -A OUTPUT -p tcp --syn -j REDIRECT --to-ports $TRANS_PORT
|
||||
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
|
||||
|
||||
for NET in $NON_TOR 127.0.0.0/8; do
|
||||
iptables -A OUTPUT -d "$NET" -j ACCEPT
|
||||
done
|
||||
|
||||
# redirect all other output through TOR
|
||||
iptables -t nat -A OUTPUT -p tcp --syn -j REDIRECT --to-ports $TRANS_PORT
|
||||
iptables -t nat -A OUTPUT -p udp -j REDIRECT --to-ports "$TRANS_PORT"
|
||||
iptables -t nat -A OUTPUT -p icmp -j REDIRECT --to-ports "$TRANS_PORT"
|
||||
|
||||
# accept already established connections
|
||||
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
|
||||
|
||||
# allow only tor output
|
||||
iptables -A OUTPUT -m owner --uid-owner "$TOR_UID" -j ACCEPT
|
||||
iptables -A OUTPUT -j ACCEPT
|
||||
iptables -A OUTPUT -j REJECT
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue