From b32f852fda318bf84d8af9a14d1df97af95cb6a3 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Fri, 14 Jun 2019 00:03:44 +0200 Subject: [PATCH] on TOR change make sure UPnP is off --- home.admin/00settingsMenuServices.sh | 87 +++++++++++++----------- home.admin/config.scripts/lnd.autonat.sh | 24 +++---- 2 files changed, 61 insertions(+), 50 deletions(-) diff --git a/home.admin/00settingsMenuServices.sh b/home.admin/00settingsMenuServices.sh index c474385c6..510cc0b20 100644 --- a/home.admin/00settingsMenuServices.sh +++ b/home.admin/00settingsMenuServices.sh @@ -157,14 +157,63 @@ else echo "Dynamic Domain unchanged." fi +# UPnP +choice="off"; check=$(echo "${CHOICES}" | grep -c "7") +if [ ${check} -eq 1 ]; then choice="on"; fi +if [ "${networkUPnP}" != "${choice}" ]; then + echo "BTC UPnP Setting changed .." + anychange=1 + if [ "${choice}" = "on" ]; then + echo "Starting BTC UPNP ..." + /home/admin/config.scripts/network.upnp.sh on + networkUPnP="on" + needsReboot=1 + else + echo "Stopping BTC UPNP ..." + /home/admin/config.scripts/network.upnp.sh off + networkUPnP="off" + needsReboot=1 + fi +else + echo "BTC UPnP Setting unchanged." +fi + +# AutoNAT +choice="off"; check=$(echo "${CHOICES}" | grep -c "8") +if [ ${check} -eq 1 ]; then choice="on"; fi +if [ "${autoNatDiscovery}" != "${choice}" ]; then + echo "AUTO NAT Setting changed .." + anychange=1 + if [ "${choice}" = "on" ]; then + echo "Starting autoNAT ..." + /home/admin/config.scripts/lnd.autonat.sh on + autoNatDiscovery="on" + needsReboot=1 + else + echo "Stopping autoNAT ..." + /home/admin/config.scripts/lnd.autonat.sh off + autoNatDiscovery="off" + needsReboot=1 + fi +else + echo "LND AUTONAT Setting unchanged." +fi + # TOR process choice choice="off"; check=$(echo "${CHOICES}" | grep -c "4") if [ ${check} -eq 1 ]; then choice="on"; fi if [ "${runBehindTor}" != "${choice}" ]; then echo "TOR Setting changed .." + + # make sure AutoNAT & UPnP is off + /home/admin/config.scripts/lnd.autonat.sh off + /home/admin/config.scripts/network.upnp.sh off + + # change TOR anychange=1 sudo /home/admin/config.scripts/internet.tor.sh ${choice} needsReboot=1 + else echo "TOR Setting unchanged." fi @@ -217,44 +266,6 @@ else echo "LND Autounlock Setting unchanged." fi -# UPnP -choice="off"; check=$(echo "${CHOICES}" | grep -c "7") -if [ ${check} -eq 1 ]; then choice="on"; fi -if [ "${networkUPnP}" != "${choice}" ]; then - echo "BTC UPnP Setting changed .." - anychange=1 - if [ "${choice}" = "on" ]; then - echo "Starting BTC UPNP ..." - /home/admin/config.scripts/network.upnp.sh on - needsReboot=1 - else - echo "Stopping BTC UPNP ..." - /home/admin/config.scripts/network.upnp.sh off - needsReboot=1 - fi -else - echo "BTC UPnP Setting unchanged." -fi - -# AutoNAT -choice="off"; check=$(echo "${CHOICES}" | grep -c "8") -if [ ${check} -eq 1 ]; then choice="on"; fi -if [ "${autoNatDiscovery}" != "${choice}" ]; then - echo "AUTO NAT Setting changed .." - anychange=1 - if [ "${choice}" = "on" ]; then - echo "Starting autoNAT ..." - /home/admin/config.scripts/lnd.autonat.sh on - needsReboot=1 - else - echo "Stopping autoNAT ..." - /home/admin/config.scripts/lnd.autonat.sh off - needsReboot=1 - fi -else - echo "LND AUTONAT Setting unchanged." -fi - if [ ${anychange} -eq 0 ]; then dialog --pause "Hint: Use Spacebar to check/uncheck services." 8 58 5 exit 0 diff --git a/home.admin/config.scripts/lnd.autonat.sh b/home.admin/config.scripts/lnd.autonat.sh index 640daf62b..16a4c55a0 100644 --- a/home.admin/config.scripts/lnd.autonat.sh +++ b/home.admin/config.scripts/lnd.autonat.sh @@ -37,20 +37,20 @@ fi if [ "$1" = "1" ] || [ "$1" = "on" ]; then echo "switching the LND autonat ON" # disable lnd service - echo "disable lnd" - sudo systemctl disable lnd + #echo "disable lnd" + #sudo systemctl disable lnd # editing lnd config echo "editing /mnt/hdd/lnd/lnd.conf" sudo sed -i "s/^nat=.*/nat=true/g" /mnt/hdd/lnd/lnd.conf # editing lnd service (removing the static publicip) - echo "editing /etc/systemd/system/lnd.service" - sudo sed -i "s/^ExecStart=\/usr\/local\/bin\/lnd --externalip=.*/ExecStart=\/usr\/local\/bin\/lnd/g" /etc/systemd/system/lnd.service + #echo "editing /etc/systemd/system/lnd.service" + #sudo sed -i "s/^ExecStart=\/usr\/local\/bin\/lnd --externalip=.*/ExecStart=\/usr\/local\/bin\/lnd/g" /etc/systemd/system/lnd.service # edit raspi blitz config echo "editing /mnt/hdd/raspiblitz.conf" sudo sed -i "s/^autoNatDiscovery=.*/autoNatDiscovery=on/g" /mnt/hdd/raspiblitz.conf # enable lnd service - echo "enable lnd" - sudo systemctl enable lnd + #echo "enable lnd" + #sudo systemctl enable lnd echo "OK - autonat is now ON" echo "needs reboot to activate new setting" exit 0 @@ -60,20 +60,20 @@ fi if [ "$1" = "0" ] || [ "$1" = "off" ]; then echo "switching the LND autonat OFF" # disable lnd service - echo "disable lnd" - sudo systemctl disable lnd + #echo "disable lnd" + #sudo systemctl disable lnd # editing lnd config echo "editing /mnt/hdd/lnd/lnd.conf" sudo sed -i "s/^nat=.*/nat=false/g" /mnt/hdd/lnd/lnd.conf # editing lnd service (adding the static publicip) - echo "editing /etc/systemd/system/lnd.service" - sudo sed -i "s/^ExecStart=\/usr\/local\/bin\/lnd.*/ExecStart=\/usr\/local\/bin\/lnd --externalip=\${publicIP}:\${lndPort}\/g" /etc/systemd/system/lnd.service + #echo "editing /etc/systemd/system/lnd.service" + #sudo sed -i "s/^ExecStart=\/usr\/local\/bin\/lnd.*/ExecStart=\/usr\/local\/bin\/lnd --externalip=\${publicIP}:\${lndPort}\/g" /etc/systemd/system/lnd.service # edit raspi blitz config echo "editing /mnt/hdd/raspiblitz.conf" sudo sed -i "s/^autoNatDiscovery=.*/autoNatDiscovery=off/g" /mnt/hdd/raspiblitz.conf # enable lnd service - echo "enable lnd" - sudo systemctl enable lnd + #echo "enable lnd" + #sudo systemctl enable lnd echo "OK - autonat is now OFF" echo "needs reboot to activate new setting" exit 0