#2907 removing lnd.autonat.sh

This commit is contained in:
rootzoll 2022-05-17 19:54:51 +02:00
parent 10bb659acd
commit d3700887ae
3 changed files with 0 additions and 96 deletions

View File

@ -4,13 +4,11 @@
echo "get raspiblitz config"
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
source <(/home/admin/config.scripts/lnd.autonat.sh info)
echo "services default values"
if [ ${#autoPilot} -eq 0 ]; then autoPilot="off"; fi
if [ ${#autoUnlock} -eq 0 ]; then autoUnlock="off"; fi
if [ ${#runBehindTor} -eq 0 ]; then runBehindTor="off"; fi
if [ ${#autoNatDiscovery} -eq 0 ]; then autoNatDiscovery="off"; fi
if [ ${#networkUPnP} -eq 0 ]; then networkUPnP="off"; fi
if [ ${#touchscreen} -eq 0 ]; then touchscreen=0; fi
if [ ${#lcdrotate} -eq 0 ]; then lcdrotate=0; fi
@ -134,7 +132,6 @@ if [ "${lndNode}" == "on" ]; then
OPTIONS+=(u '-LND Auto-Unlock' ${autoUnlock})
OPTIONS+=(x '-LND StaticChannelBackup on Nextcloud' ${NextcloudBackup})
OPTIONS+=(e '-LND StaticChannelBackup USB Drive' ${LocalBackup})
OPTIONS+=(l '-LND UPnP (AutoNAT)' ${autoNatDiscovery})
fi
# C-Lightning & options/PlugIns
@ -211,27 +208,6 @@ else
echo "BTC UPnP Setting unchanged."
fi
# LND AutoNAT
choice="off"; check=$(echo "${CHOICES}" | grep -c "l")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${autoNatDiscovery}" != "${choice}" ] && [ "${lndNode}" == "on" ]; 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 "t")
if [ ${check} -eq 1 ]; then choice="on"; fi
@ -248,8 +224,6 @@ RaspiBlitz will now install/activate Tor & after reboot run behind it.
Please keep in mind that thru your LND node id & your previous IP history with your internet provider your lightning node could still be linked to your personal id even when running behind Tor. To unlink you from that IP history its recommended that after the switch/reboot to Tor you also use the REPAIR > RESET-LND option to create a fresh LND wallet. That might involve closing all channels & move your funds out of RaspiBlitz before that RESET-LND.
" 16 76
# make sure AutoNAT & UPnP is off
/home/admin/config.scripts/lnd.autonat.sh off
/home/admin/config.scripts/network.upnp.sh off
fi

View File

@ -360,15 +360,6 @@ else
echo "Provisioning NETWORK UPnP - keep default" >> ${logFile}
fi
# LND AUTO NAT DISCOVERY (deprecated: but keep in until version 2.0)
if [ "${autoNatDiscovery}" = "on" ]; then
echo "Provisioning LND AUTO NAT DISCOVERY - run config script" >> ${logFile}
/home/admin/_cache.sh set message "Setup AutoNAT"
/home/admin/config.scripts/lnd.autonat.sh on >> ${logFile} 2>&1
else
echo "Provisioning AUTO NAT DISCOVERY - keep default" >> ${logFile}
fi
# DYNAMIC DOMAIN
if [ "${#dynDomain}" -gt 0 ]; then
echo "Provisioning DYNAMIC DOMAIN - run config script" >> ${logFile}

View File

@ -1,61 +0,0 @@
#!/bin/bash
# based on: https://github.com/raspibolt/raspibolt/issues/249
if [ $# -eq 0 ]; then
echo "small config script to switch the LND autoNatDiscovery on or off"
echo "lnd.autonat.sh [on|off|info]"
exit 1
fi
# check lnd.conf exits
lndConfExists=$(sudo ls /mnt/hdd/lnd/lnd.conf | grep -c 'lnd.conf')
if [ ${lndConfExists} -eq 0 ]; then
echo "# FAIL - /mnt/hdd/lnd/lnd.conf not found"
exit 1
fi
# info
if [ "$1" = "info" ]; then
natIsOn=$(sudo cat /mnt/hdd/lnd/lnd.conf | grep -c 'nat=true')
if [ "${natIsOn}" == "1" ]; then
echo "autoNatDiscovery=on"
else
echo "autoNatDiscovery=off"
fi
exit 0
fi
# check if "nat" exists in lnd config
valueExists=$(sudo cat /mnt/hdd/lnd/lnd.conf | grep -c 'nat=')
if [ ${valueExists} -eq 0 ]; then
echo "# Adding autonat config defaults to /mnt/hdd/lnd/lnd.conf"
applicationOptionsLineNumber=$(grep -n "\[Application Options\]" /mnt/hdd/lnd/lnd.conf | cut -d ":" -f1)
applicationOptionsLineNumber="$(($applicationOptionsLineNumber+1))"
sudo sed -i "${applicationOptionsLineNumber}inat=false" /mnt/hdd/lnd/lnd.conf
fi
# delete nat is still in raspiblitz.conf (its OK when just in lnd.conf since v1.7.2)
/home/admin/config.scripts/blitz.conf.sh delete autoNatDiscovery
# switch on
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "# switching the LND autonat ON"
sudo sed -i "s/^nat=.*/nat=true/g" /mnt/hdd/lnd/lnd.conf
echo "# OK - autonat is now ON"
echo "# needs reboot to activate new setting"
exit 0
fi
# switch off
if [ "$1" = "0" ] || [ "$1" = "off" ]; then
echo "# switching the LND autonat OFF"
sudo sed -i "s/^nat=.*/nat=false/g" /mnt/hdd/lnd/lnd.conf
echo "# OK - autonat is now OFF"
echo "# needs reboot to activate new setting"
exit 0
fi
echo "FAIL - Unknown Parameter $1"
echo "may needs reboot to run normal again"
exit 1