mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-25 07:07:46 +01:00
hiddenservice: improve messages
This commit is contained in:
parent
e678364da6
commit
ce4aa3cd7e
1 changed files with 23 additions and 15 deletions
|
@ -26,7 +26,7 @@ fi
|
||||||
|
|
||||||
fromPort="$3"
|
fromPort="$3"
|
||||||
if [ ${#fromPort} -eq 0 ]; then
|
if [ ${#fromPort} -eq 0 ]; then
|
||||||
echo "ERROR:the port to forward from is missing"
|
echo "ERROR: the port to forward from is missing"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ toPort2="$4"
|
||||||
fromPort2="$5"
|
fromPort2="$5"
|
||||||
if [ ${#toPort2} -gt 0 ]; then
|
if [ ${#toPort2} -gt 0 ]; then
|
||||||
if [ ${#fromPort2} -eq 0 ]; then
|
if [ ${#fromPort2} -eq 0 ]; then
|
||||||
echo "ERROR:the second port to forward from is missing"
|
echo "ERROR: the second port to forward from is missing"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -49,7 +49,7 @@ if [ "${runBehindTor}" = "on" ]; then
|
||||||
#check if the port is already forwarded
|
#check if the port is already forwarded
|
||||||
alreadyThere=$(sudo cat /etc/tor/torrc 2>/dev/null | grep -c 127.0.0.1:$fromPort)
|
alreadyThere=$(sudo cat /etc/tor/torrc 2>/dev/null | grep -c 127.0.0.1:$fromPort)
|
||||||
if [ ${alreadyThere} -gt 0 ]; then
|
if [ ${alreadyThere} -gt 0 ]; then
|
||||||
echo "The $fromPort is already forwarded. Check /etc/tor/torrc for the details"
|
echo "The port $fromPort is already forwarded. Check /etc/tor/torrc for the details."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "
|
echo "
|
||||||
|
@ -58,21 +58,22 @@ HiddenServiceDir /mnt/hdd/tor/$service
|
||||||
HiddenServiceVersion 3
|
HiddenServiceVersion 3
|
||||||
HiddenServicePort $toPort 127.0.0.1:$fromPort" | sudo tee -a /etc/tor/torrc
|
HiddenServicePort $toPort 127.0.0.1:$fromPort" | sudo tee -a /etc/tor/torrc
|
||||||
|
|
||||||
# check and insert second port pair
|
# check and insert second port pair
|
||||||
if [ ${#toPort2} -gt 0 ]; then
|
if [ ${#toPort2} -gt 0 ]; then
|
||||||
alreadyThere=$(sudo cat /etc/tor/torrc 2>/dev/null | grep -c 127.0.0.1:$fromPort2)
|
alreadyThere=$(sudo cat /etc/tor/torrc 2>/dev/null | grep -c 127.0.0.1:$fromPort2)
|
||||||
if [ ${alreadyThere} -gt 0 ]; then
|
if [ ${alreadyThere} -gt 0 ]; then
|
||||||
echo "The $fromPort2 is already forwarded. Check /etc/tor/torrc for the details"
|
echo "The port $fromPort2 is already forwarded. Check the /etc/tor/torrc for the details."
|
||||||
else
|
else
|
||||||
echo "HiddenServicePort $toPort2 127.0.0.1:$fromPort2" | sudo tee -a /etc/tor/torrc
|
echo "HiddenServicePort $toPort2 127.0.0.1:$fromPort2" | sudo tee -a /etc/tor/torrc
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# restart tor
|
# restart tor
|
||||||
|
echo ""
|
||||||
echo "Restarting Tor to activate the Hidden Service..."
|
echo "Restarting Tor to activate the Hidden Service..."
|
||||||
sudo systemctl restart tor
|
sudo systemctl restart tor
|
||||||
sleep 10
|
sleep 10
|
||||||
else
|
else
|
||||||
echo "The Hidden Service is already installed"
|
echo "The Hidden Service for $service is already installed."
|
||||||
fi
|
fi
|
||||||
# show the Hidden Service address
|
# show the Hidden Service address
|
||||||
TOR_ADDRESS=$(sudo cat /mnt/hdd/tor/$service/hostname)
|
TOR_ADDRESS=$(sudo cat /mnt/hdd/tor/$service/hostname)
|
||||||
|
@ -85,11 +86,18 @@ fi
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
echo ""
|
||||||
echo "The Tor Hidden Service address for $service is:"
|
echo "The Tor Hidden Service address for $service is:"
|
||||||
echo "$TOR_ADDRESS"
|
echo "$TOR_ADDRESS"
|
||||||
echo "use with the port: $toPort"
|
echo "use with the port: $toPort"
|
||||||
if [ ${#toPort2} -gt 0 ] && [ ${alreadyThere} -eq 0 ]; then
|
echo ""
|
||||||
|
alreadyThere=$(sudo cat /etc/tor/torrc 2>/dev/null | grep -c 127.0.0.1:$fromPort2)
|
||||||
|
if [ ${#toPort2} -gt 0 ]; then
|
||||||
|
if [ ${alreadyThere} -eq 0 ]; then
|
||||||
echo "or the port: $toPort2"
|
echo "or the port: $toPort2"
|
||||||
|
else
|
||||||
|
echo "The port $fromPort2 is forwarded for another Hidden Service. Check the /etc/tor/torrc for the details."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Tor is not active"
|
echo "Tor is not active"
|
||||||
|
|
Loading…
Add table
Reference in a new issue