mirror of
https://github.com/edu4rdshl/tor-router.git
synced 2026-07-17 23:24:48 +00:00
fix ip leak and restart section for case minutes
This commit is contained in:
parent
290d0b1e29
commit
e5b0d16758
1 changed files with 23 additions and 9 deletions
|
|
@ -5,8 +5,8 @@ RULES="/var/tmp/tor-router.save"
|
||||||
# Tor's TransPort
|
# Tor's TransPort
|
||||||
TRANS_PORT="9040"
|
TRANS_PORT="9040"
|
||||||
|
|
||||||
case "$1" in
|
function startTR()
|
||||||
start)
|
{
|
||||||
if test -f "$RULES"; then
|
if test -f "$RULES"; then
|
||||||
echo "$RULES exists. Either delete it, or stop tor-router first."
|
echo "$RULES exists. Either delete it, or stop tor-router first."
|
||||||
exit 1
|
exit 1
|
||||||
|
|
@ -54,12 +54,14 @@ start)
|
||||||
done
|
done
|
||||||
|
|
||||||
iptables -A OUTPUT -m owner --uid-owner "$TOR_UID" -j ACCEPT
|
iptables -A OUTPUT -m owner --uid-owner "$TOR_UID" -j ACCEPT
|
||||||
iptables -A OUTPUT -j ACCEPT
|
iptables -A OUTPUT -j REJECT # ACCEPTから変更
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
;;
|
}
|
||||||
stop)
|
|
||||||
if test -f "$RULES"; then
|
function stopTR()
|
||||||
|
{
|
||||||
|
if test -f "$RULES"; then
|
||||||
echo "Restoring previous rules from $RULES"
|
echo "Restoring previous rules from $RULES"
|
||||||
iptables -t nat -F
|
iptables -t nat -F
|
||||||
iptables-restore <"$RULES"
|
iptables-restore <"$RULES"
|
||||||
|
|
@ -68,11 +70,23 @@ stop)
|
||||||
echo "$RULES does not exist. Not doing anything."
|
echo "$RULES does not exist. Not doing anything."
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function restartTR()
|
||||||
|
{
|
||||||
|
stopTR
|
||||||
|
startTR
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
startTR
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
stopTR
|
||||||
;;
|
;;
|
||||||
restart)
|
restart)
|
||||||
stop
|
restartTR
|
||||||
sleep 2
|
|
||||||
start
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: $0 {start|stop|restart}"
|
echo "Usage: $0 {start|stop|restart}"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue