1341 acme over tor by curl default proxy (#2110)

This commit is contained in:
/rootzoll 2021-03-26 03:17:13 +01:00 committed by GitHub
parent a1cf9b97ce
commit b761e830d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 0 deletions

View File

@ -21,6 +21,18 @@ ACME_CERT_HOME="${ACME_CONFIG_HOME}/certs"
ACME_IS_INSTALLED=0
# if Tor is on test that CURL is by default running over Tor
if [ "${runBehindTor}" == "on" ]; then
echo "# checking if Tor proxy for CURL is working ..."
checkTor=$(curl -s https://check.torproject.org | grep -c "Congratulations")
if [ ${checkTor} -eq 0 ]; then
echo "err='curl tor proxy not working'"
exit 1
else
echo "# OK Tor proxy for CURL"
fi
fi
###################
# FUNCTIONS
###################

View File

@ -173,6 +173,16 @@ fi
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "# switching Tor ON"
# *** CURL TOR PROXY ***
echo "socks5-hostname localhost:9050" > .curlrc.tmp
sudo cp ./.curlrc.tmp /root/.curlrc
sudo chown root:root /home/admin/.curlrc
sudo cp ./.curlrc.tmp /home/pi/.curlrc
sudo chown pi:pi /home/pi/.curlrc
sudo cp ./.curlrc.tmp /home/admin/.curlrc
sudo chown admin:admin /home/admin/.curlrc
rm .curlrc.tmp
# make sure the network was set (by sourcing raspiblitz.conf)
if [ ${#network} -eq 0 ]; then
echo "!! FAIL - unknown network due to missing /mnt/hdd/raspiblitz.conf"
@ -384,6 +394,11 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
# setting value in raspi blitz config
sudo sed -i "s/^runBehindTor=.*/runBehindTor=off/g" /mnt/hdd/raspiblitz.conf
# *** CURL TOR PROXY ***
sudo rm /root/.curlrc
sudo rm /home/pi/.curlrc
sudo rm /home/admin/.curlrc
# disable TOR service
echo "# *** Disable Tor service ***"
sudo systemctl disable tor@default