Browse Source

on TOR change make sure UPnP is off

v1.3
Christian Rotzoll 6 years ago
parent
commit
b32f852fda
  1. 87
      home.admin/00settingsMenuServices.sh
  2. 24
      home.admin/config.scripts/lnd.autonat.sh

87
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

24
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

Loading…
Cancel
Save