comment addition process done

This commit is contained in:
Kajan0v3zk1 2024-01-06 03:04:17 +09:00
parent 20513c7665
commit 27eca3ee44

View file

@ -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
}