fix ip leak and restart section for case minutes

This commit is contained in:
Kajan0v3zk1 2023-12-28 00:20:27 +09:00
parent 290d0b1e29
commit e5b0d16758

View file

@ -5,8 +5,8 @@ RULES="/var/tmp/tor-router.save"
# Tor's TransPort
TRANS_PORT="9040"
case "$1" in
start)
function startTR()
{
if test -f "$RULES"; then
echo "$RULES exists. Either delete it, or stop tor-router first."
exit 1
@ -54,11 +54,13 @@ start)
done
iptables -A OUTPUT -m owner --uid-owner "$TOR_UID" -j ACCEPT
iptables -A OUTPUT -j ACCEPT
iptables -A OUTPUT -j REJECT # ACCEPTから変更
fi
fi
;;
stop)
}
function stopTR()
{
if test -f "$RULES"; then
echo "Restoring previous rules from $RULES"
iptables -t nat -F
@ -68,11 +70,23 @@ stop)
echo "$RULES does not exist. Not doing anything."
exit
fi
}
function restartTR()
{
stopTR
startTR
}
case "$1" in
start)
startTR
;;
stop)
stopTR
;;
restart)
stop
sleep 2
start
restartTR
;;
*)
echo "Usage: $0 {start|stop|restart}"