mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-04-01 00:18:10 +02:00
more config scripts
This commit is contained in:
parent
1a555be3d0
commit
7f1a0f04a5
@ -8,6 +8,8 @@ CHOICES=$(dialog --checklist "Activate/Deactivate Services:" 15 40 5 \
|
||||
1 "Channel Autopilot" ${autoPilot} \
|
||||
2 "Testnet" ${chain} \
|
||||
3 "Router AutoNAT" ${autoNatDiscovery} \
|
||||
4 "Run behind TOR" ${runBehindTor} \
|
||||
5 "RTL Webinterface" ${rtlWebinterface} \
|
||||
2>&1 >/dev/tty)
|
||||
#CHOICES=$(dialog --checklist "Activate/Deactivate Services:" 15 40 5 \
|
||||
#1 "Channel Autopilot" ${autoPilot} \
|
||||
@ -19,6 +21,8 @@ CHOICES=$(dialog --checklist "Activate/Deactivate Services:" 15 40 5 \
|
||||
dialogcancel=$?
|
||||
clear
|
||||
|
||||
rideTheLighthing
|
||||
|
||||
# check if user canceled dialog
|
||||
if [ ${dialogcancel} -eq 1 ]; then
|
||||
echo "user canceled"
|
||||
@ -31,10 +35,7 @@ needsReboot=0
|
||||
choice="off"; check=$(echo "${CHOICES}" | grep -c "1")
|
||||
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||
if [ "${autoPilot}" != "${choice}" ]; then
|
||||
echo "Autopilot Setting changed"
|
||||
echo "Stopping Service"
|
||||
sudo systemctl stop lnd
|
||||
echo "Executing change"
|
||||
echo "Autopilot Setting changed .."
|
||||
sudo /home/admin/config.scripts/lnd.autopilot.sh ${choice}
|
||||
needsReboot=1
|
||||
else
|
||||
@ -48,11 +49,7 @@ if [ "${chain}" != "${choice}" ]; then
|
||||
if [ "${network}" = "litecoin" ] && [ "${choice}"="test" ]; then
|
||||
dialog --title 'FAIL' --msgbox 'Litecoin-Testnet not available.' 5 25
|
||||
else
|
||||
echo "Testnet Setting changed"
|
||||
echo "Stopping Service"
|
||||
sudo systemctl stop lnd
|
||||
sudo systemctl stop ${network}d
|
||||
echo "Executing change"
|
||||
echo "Testnet Setting changed .."
|
||||
sudo /home/admin/config.scripts/network.chain.sh ${choice}net
|
||||
needsReboot=1
|
||||
fi
|
||||
@ -64,22 +61,44 @@ fi
|
||||
choice="off"; check=$(echo "${CHOICES}" | grep -c "3")
|
||||
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||
if [ "${autoNatDiscovery}" != "${choice}" ]; then
|
||||
echo "AutoNAT Setting changed"
|
||||
echo "Stopping Services"
|
||||
sudo systemctl stop lnd
|
||||
sudo systemctl stop ${network}d
|
||||
echo "Disable LND"
|
||||
sudo systemctl disable lnd
|
||||
echo "Executing change"
|
||||
echo "AutoNAT Setting changed .."
|
||||
sudo /home/admin/config.scripts/lnd.autonat.sh ${choice}
|
||||
echo "Enable LND"
|
||||
sudo systemctl enable lnd
|
||||
needsReboot=1
|
||||
else
|
||||
echo "Autopilot Setting unchanged."
|
||||
echo "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 .."
|
||||
sudo /home/admin/config.scripts/internet.tor.sh ${choice}
|
||||
needsReboot=1
|
||||
else
|
||||
echo "TOR Setting unchanged."
|
||||
fi
|
||||
|
||||
# RTL process choice
|
||||
choice="off"; check=$(echo "${CHOICES}" | grep -c "5")
|
||||
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||
if [ "${rtlWebinterface}" != "${choice}" ]; then
|
||||
echo "RTL Webinterface Setting changed .."
|
||||
sudo /home/admin/config.scripts/bonus.rtl.sh ${choice}
|
||||
if [ "${coice}" = "on" ]; then
|
||||
l1="RTL web servcie should be installed - AFTER NEXT REBOOT:"
|
||||
l2="Try to open the following URL in your local webrowser"
|
||||
l3="and unlock your wallet from there with PASSWORD C."
|
||||
l4="---> http://${localip}:3000"
|
||||
dialog --title 'OK' --msgbox "${l1}\n${l2}\n${l3}\n${l4}" 9 25
|
||||
fi
|
||||
needsReboot=1
|
||||
else
|
||||
echo "RTL Webinterface Setting unchanged."
|
||||
fi
|
||||
|
||||
if [ ${needsReboot} -eq 1 ]; then
|
||||
sleep 2
|
||||
dialog --title 'OK' --msgbox 'System will reboot to activate changes.' 5 25
|
||||
sudo shutdown -r now
|
||||
fi
|
@ -319,6 +319,18 @@ if [ ${#autoNatDiscovery} -eq 0 ]; then
|
||||
echo "autoNatDiscovery=off" >> $configFile
|
||||
fi
|
||||
|
||||
# TOR
|
||||
# runBehindTor=off|on
|
||||
if [ ${#runBehindTor} -eq 0 ]; then
|
||||
echo "runBehindTor=off" >> $configFile
|
||||
fi
|
||||
|
||||
# RideTheLightning RTL
|
||||
# rtlWebinterface=off|on
|
||||
if [ ${#runBehindTor} -eq 0 ]; then
|
||||
echo "rtlWebinterface=off" >> $configFile
|
||||
fi
|
||||
|
||||
##################################
|
||||
# CHECK CONFIG CONSISTENCY
|
||||
##################################
|
||||
|
99
home.admin/config.scripts/bonus.rtl.sh
Executable file
99
home.admin/config.scripts/bonus.rtl.sh
Executable file
@ -0,0 +1,99 @@
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
# command info
|
||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||
echo "small config script to switch WebGUI RideTheLightning on or off"
|
||||
echo "bonus.rtl.sh [on|off]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# check and load raspiblitz config
|
||||
# to know which network is running
|
||||
source /mnt/hdd/raspiblitz.conf 2>/dev/null
|
||||
if [ ${#network} -eq 0 ]; then
|
||||
echo "FAIL - missing /mnt/hdd/raspiblitz.conf"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# stop services
|
||||
echo "making sure services are not running"
|
||||
sudo systemctl stop RTL 2>/dev/null
|
||||
|
||||
# switch on
|
||||
if [ $1 -eq 1 ] || [ "$1" = "on" ]; then
|
||||
echo "*** INSTALL RTL ***"
|
||||
|
||||
# setting value in raspi blitz config
|
||||
sudo sed -i "s/^rtlWebinterface=.*/rtlWebinterface=on/g" /mnt/hdd/raspiblitz.conf
|
||||
|
||||
isInstalled=$(sudo ls /etc/systemd/system/RTL.service 2>/dev/null | grep -c 'RTL.service')
|
||||
if [ ${isInstalled} -eq 0 ]; then
|
||||
|
||||
# disable RPC listen
|
||||
# to prevent tls cer auth error
|
||||
echo "*** Modify lnd.conf ***"
|
||||
sudo sed -i "s/^rpclisten=0.0.0.0:10009/#rpclisten=0.0.0.0:10009/g" /mnt/hdd/lnd/lnd.conf
|
||||
sudo systemctl restart lnd
|
||||
echo ""
|
||||
|
||||
# install latest nodejs
|
||||
echo "*** Install NodeJS ***"
|
||||
curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
|
||||
sudo apt-get install -y nodejs
|
||||
echo ""
|
||||
|
||||
# close source code
|
||||
echo "*** Get the RTL Source Code ***"
|
||||
git clone https://github.com/ShahanaFarooqui/RTL.git
|
||||
cd RTL
|
||||
npm install
|
||||
cd ..
|
||||
echo ""
|
||||
|
||||
# open firewall
|
||||
echo "*** Updating Firewall ***"
|
||||
sudo ufw allow 3000
|
||||
sudo ufw --force enable
|
||||
echo ""
|
||||
|
||||
# install service
|
||||
echo "*** Install RTL systemd for ${network} on ${chain} ***"
|
||||
sudo cp /home/admin/assets/RTL.service /etc/systemd/system/RTL.service
|
||||
sudo sed -i "s|chain/bitcoin/mainnet|chain/${network}/${chain}net|" /etc/systemd/system/RTL.service
|
||||
sudo systemctl enable RTL
|
||||
echo "OK - RTL is now ACTIVE"
|
||||
else
|
||||
echo "RTL already installed."
|
||||
fi
|
||||
|
||||
echo "needs reboot to activate new setting"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# switch off
|
||||
if [ $1 -eq 0 ] || [ "$1" = "off" ]; then
|
||||
echo "*** REMOVING RTL ***"
|
||||
|
||||
# setting value in raspi blitz config
|
||||
sudo sed -i "s/^rtlWebinterface=.*/rtlWebinterface=off/g" /mnt/hdd/raspiblitz.conf
|
||||
|
||||
isInstalled=$(sudo ls /etc/systemd/system/RTL.service 2>/dev/null | grep -c 'RTL.service')
|
||||
if [ ${isInstalled} -eq 1 ]; then
|
||||
echo "*** REMOVING RTL ***"
|
||||
sudo systemctl stop RTL
|
||||
sudo systemctl disable RTL
|
||||
sudo rm /etc/systemd/system/RTL.service
|
||||
sudo rm -r /home/admin/RTL
|
||||
echo "OK RTL removed."
|
||||
else
|
||||
echo "RTL is not installed."
|
||||
fi
|
||||
|
||||
echo "needs reboot to activate new setting"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "FAIL - Unknown Paramter $1"
|
||||
echo "may needs reboot to run normal again"
|
||||
exit 1
|
284
home.admin/config.scripts/internet.tor.sh
Executable file
284
home.admin/config.scripts/internet.tor.sh
Executable file
@ -0,0 +1,284 @@
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
# Background:
|
||||
# https://medium.com/@lopp/how-to-run-bitcoin-as-a-tor-hidden-service-on-ubuntu-cff52d543756
|
||||
# https://bitcoin.stackexchange.com/questions/70069/how-can-i-setup-bitcoin-to-be-anonymous-with-tor
|
||||
# https://github.com/lightningnetwork/lnd/blob/master/docs/configuring_tor.md
|
||||
|
||||
# command info
|
||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||
echo "small config script to switch TOR on or off"
|
||||
echo "internet.tor.sh [on|off]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# check and load raspiblitz config
|
||||
# to know which network is running
|
||||
source /mnt/hdd/raspiblitz.conf 2>/dev/null
|
||||
if [ ${#network} -eq 0 ]; then
|
||||
echo "FAIL - missing /mnt/hdd/raspiblitz.conf"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# location of TOR config
|
||||
torrc="/etc/tor/torrc"
|
||||
|
||||
# stop services
|
||||
echo "making sure services are not running"
|
||||
sudo systemctl stop lnd 2>/dev/null
|
||||
sudo systemctl stop ${network}d 2>/dev/null
|
||||
sudo systemctl stop tor@default 2>/dev/null
|
||||
|
||||
# switch on
|
||||
if [ $1 -eq 1 ] || [ "$1" = "on" ]; then
|
||||
echo "switching the TOR ON"
|
||||
|
||||
# setting value in raspi blitz config
|
||||
sudo sed -i "s/^runBehindTor=.*/runBehindTor=on/g" /mnt/hdd/raspiblitz.conf
|
||||
|
||||
# check if TOR was already installed and is funtional
|
||||
echo ""
|
||||
echo "*** Check if TOR service is functional ***"
|
||||
torRunning=$(curl --connect-timeout 10 --socks5-hostname 127.0.0.1:9050 https://check.torproject.org | grep "Congratulations. This browser is configured to use Tor." -c)
|
||||
if [ ${torRunning} -gt 0 ]; then
|
||||
clear
|
||||
echo "You are all good - TOR is already running."
|
||||
echo ""
|
||||
exit 0
|
||||
else
|
||||
echo "TOR not running ... proceed with switching to TOR."
|
||||
echo ""
|
||||
fi
|
||||
|
||||
echo "*** Adding Tor Sources to sources.list ***"
|
||||
echo "deb http://deb.torproject.org/torproject.org stretch main" | sudo tee -a /etc/apt/sources.list
|
||||
echo "deb-src http://deb.torproject.org/torproject.org stretch main" | sudo tee -a /etc/apt/sources.list
|
||||
echo "OK"
|
||||
echo ""
|
||||
|
||||
echo "*** Installing dirmngr ***"
|
||||
sudo apt install dirmngr
|
||||
echo ""
|
||||
|
||||
## lopp: gpg --keyserver keys.gnupg.net --recv 886DDD89
|
||||
echo "*** Fetching GPG key ***"
|
||||
gpg --keyserver keys.gnupg.net --recv A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89
|
||||
gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -
|
||||
echo ""
|
||||
|
||||
echo "*** Updating System ***"
|
||||
sudo apt-get update
|
||||
echo ""
|
||||
|
||||
echo "*** Install Tor ***"
|
||||
sudo apt install tor tor-arm -y
|
||||
|
||||
echo ""
|
||||
echo "*** Tor Config ***"
|
||||
sudo rm -r -f /mnt/hdd/tor 2>/dev/null
|
||||
sudo mkdir /mnt/hdd/tor
|
||||
sudo mkdir /mnt/hdd/tor/sys
|
||||
sudo mkdir /mnt/hdd/tor/web80
|
||||
sudo mkdir /mnt/hdd/tor/lnd9735
|
||||
sudo mkdir /mnt/hdd/tor/lndrpc9735
|
||||
sudo chmod -R 700 /mnt/hdd/tor
|
||||
sudo chown -R bitcoin:bitcoin /mnt/hdd/tor
|
||||
cat > ./torrc <<EOF
|
||||
### See 'man tor', or https://www.torproject.org/docs/tor-manual.html
|
||||
|
||||
DataDirectory /mnt/hdd/tor/sys
|
||||
PidFile /mnt/hdd/tor/sys/tor.pid
|
||||
|
||||
SafeLogging 0
|
||||
Log notice stdout
|
||||
Log notice file /mnt/hdd/tor/notice.log
|
||||
Log info file /mnt/hdd/tor/info.log
|
||||
|
||||
RunAsDaemon 1
|
||||
User bitcoin
|
||||
PortForwarding 1
|
||||
ControlPort 9051
|
||||
SocksPort 9050
|
||||
|
||||
CookieAuthFile /mnt/hdd/tor/sys/control_auth_cookie
|
||||
CookieAuthentication 1
|
||||
CookieAuthFileGroupReadable 1
|
||||
|
||||
# Hidden Service v2 for WEB ADMIN INTERFACE
|
||||
HiddenServiceDir /mnt/hdd/tor/web80/
|
||||
HiddenServicePort 80 127.0.0.1:80
|
||||
|
||||
# Hidden Service v2 for LND RPC
|
||||
HiddenServiceDir /mnt/hdd/tor/lndrpc10009/
|
||||
HiddenServicePort 80 127.0.0.1:10009
|
||||
|
||||
# Hidden Service v3 for LND incomming connections (just in case)
|
||||
# https://trac.torproject.org/projects/tor/wiki/doc/NextGenOnions#Howtosetupyourownprop224service
|
||||
HiddenServiceDir /mnt/hdd/tor/lnd9735
|
||||
HiddenServiceVersion 3
|
||||
HiddenServicePort 9735 127.0.0.1:9735
|
||||
|
||||
# NOTE: bitcoind get tor service automatically - see /mnt/hdd/bitcoin for onion key
|
||||
EOF
|
||||
sudo rm $torrc
|
||||
sudo mv ./torrc $torrc
|
||||
sudo chmod 644 $torrc
|
||||
sudo chown -R bitcoin:bitcoin /var/run/tor/
|
||||
echo ""
|
||||
|
||||
# NYX - Tor monitor tool
|
||||
# https://nyx.torproject.org/#home
|
||||
echo "*** Installing NYX - TOR monitoring Tool ***"
|
||||
nyxInstalled=$(sudo pip list 2>/dev/null | grep 'nyx' -c)
|
||||
if [ ${nyxInstalled} -eq 0 ]; then
|
||||
sudo pip install nyx
|
||||
else
|
||||
echo "NYX already installed"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo "*** Activating TOR system service ***"
|
||||
echo "ReadWriteDirectories=-/mnt/hdd/tor" | sudo tee -a /lib/systemd/system/tor@default.service
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl restart tor@default
|
||||
echo ""
|
||||
|
||||
echo "*** Waiting for TOR to boostrap ***"
|
||||
torIsBootstrapped=0
|
||||
while [ ${torIsBootstrapped} -eq 0 ]
|
||||
do
|
||||
echo "--- Checking 1 ---"
|
||||
date +%s
|
||||
sudo cat /mnt/hdd/tor/notice.log 2>/dev/null | grep "Bootstrapped" | tail -n 10
|
||||
torIsBootstrapped=$(sudo cat /mnt/hdd/tor/notice.log 2>/dev/null | grep "Bootstrapped 100" -c)
|
||||
echo "torIsBootstrapped(${torIsBootstrapped})"
|
||||
echo "If this takes too long --> CTRL+c, reboot and check manually"
|
||||
sleep 5
|
||||
done
|
||||
echo "OK - Tor Bootstrap is ready"
|
||||
echo ""
|
||||
|
||||
echo "*** Changing ${network} Config ***"
|
||||
networkIsTor=$(sudo cat /home/bitcoin/.${network}/${network}.conf | grep 'onlynet=onion' -c)
|
||||
if [ ${networkIsTor} -eq 0 ]; then
|
||||
|
||||
echo "Only Connect thru TOR"
|
||||
echo "onlynet=onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
|
||||
|
||||
if [ "${network}" = "bitcoin" ]; then
|
||||
echo "Adding some bitcoin onion nodes to connect to"
|
||||
echo "addnode=fno4aakpl6sg6y47.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
|
||||
echo "addnode=toguvy5upyuctudx.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
|
||||
echo "addnode=ndndword5lpb7eex.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
|
||||
echo "addnode=6m2iqgnqjxh7ulyk.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
|
||||
echo "addnode=5tuxetn7tar3q5kp.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
|
||||
fi
|
||||
|
||||
sudo cp /home/bitcoin/.${network}/${network}.conf /home/admin/.${network}/${network}.conf
|
||||
sudo chown admin:admin /home/admin/.${network}/${network}.conf
|
||||
|
||||
else
|
||||
echo "Chain network already configured for TOR"
|
||||
fi
|
||||
|
||||
echo "*** ${network} re-init - Waiting for Onion Address ***"
|
||||
# restarting bitcoind to start with tor and generare onion.address
|
||||
echo "restarting ${network}d ..."
|
||||
sudo systemctl restart ${network}d
|
||||
sleep 8
|
||||
onionAddress=""
|
||||
while [ ${#onionAddress} -eq 0 ]
|
||||
do
|
||||
echo "--- Checking 2 ---"
|
||||
date +%s
|
||||
testNetAdd=""
|
||||
if [ "${chain}" = "test" ];then
|
||||
testNetAdd="/testnet3"
|
||||
fi
|
||||
sudo cat /mnt/hdd/${network}${testNetAdd}/debug.log 2>/dev/null | grep "tor" | tail -n 10
|
||||
onionAddress=$(sudo -u bitcoin ${network}-cli getnetworkinfo | grep '"address"' | cut -d '"' -f4)
|
||||
echo "Can take up to 20min - if this takes longer --> CTRL+c, reboot and check manually"
|
||||
sleep 5
|
||||
done
|
||||
onionPort=$(sudo -u bitcoin ${network}-cli getnetworkinfo | grep '"port"' | tr -dc '0-9')
|
||||
echo "Your Chain Network Onion Address is: ${onionAddress}:${onionPort}"
|
||||
echo ""
|
||||
|
||||
echo "*** Setting your Onion Address ***"
|
||||
onionLND=$(sudo cat /mnt/hdd/tor/lnd9735/hostname)
|
||||
echo "Your Lightning Tor Onion Address is: ${onionLND}:9735"
|
||||
echo ""
|
||||
|
||||
# ACTIVATE LND OVER TOR
|
||||
echo "*** Putting LND behind TOR ***"
|
||||
echo "Make sutre LND is disabled"
|
||||
sudo systemctl disable lnd 2>/dev/null
|
||||
echo "Writing Public Onion Address to /mnt/hdd/tor/v3Address (just in case for TotHiddenServiceV3)"
|
||||
echo "V3ADDRESS=${onionLND}" | sudo tee /mnt/hdd/tor/v3Address
|
||||
echo "Configure and Changing to lnd.tor.service"
|
||||
sed -i "5s/.*/Wants=${network}d.service/" ./assets/lnd.tor.service
|
||||
sed -i "6s/.*/After=${network}d.service/" ./assets/lnd.tor.service
|
||||
sudo cp /home/admin/assets/lnd.tor.service /etc/systemd/system/lnd.service
|
||||
sudo chmod +x /etc/systemd/system/lnd.service
|
||||
echo "System LND again"
|
||||
sudo systemctl enable lnd
|
||||
echo "OK"
|
||||
echo ""
|
||||
|
||||
echo "OK - TOR is now ON"
|
||||
echo "needs reboot to activate new setting"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# switch off
|
||||
if [ $1 -eq 0 ] || [ "$1" = "off" ]; then
|
||||
echo "switching TOR OFF"
|
||||
|
||||
# setting value in raspi blitz config
|
||||
sudo sed -i "s/^runBehindTor=.*/runBehindTor=off/g" /mnt/hdd/raspiblitz.conf
|
||||
|
||||
# disable TOR service
|
||||
echo "*** Disable TOR service ***"
|
||||
sudo systemctl disable tor@default
|
||||
echo ""
|
||||
|
||||
echo "*** Changing ${network} Config ***"
|
||||
sudo cat /home/bitcoin/.${network}/${network}.conf | grep -Ev 'onlynet=onion|.onion' | sudo tee /home/bitcoin/.${network}/${network}.conf
|
||||
sudo cp /home/bitcoin/.${network}/${network}.conf /home/admin/.${network}/${network}.conf
|
||||
sudo chown admin:admin /home/admin/.${network}/${network}.conf
|
||||
echo ""
|
||||
|
||||
echo "*** Removing TOR from LND ***"
|
||||
sudo systemctl disable lnd
|
||||
sed -i "5s/.*/Wants=${network}d.service/" ./assets/lnd.service
|
||||
sed -i "6s/.*/After=${network}d.service/" ./assets/lnd.service
|
||||
sudo cp /home/admin/assets/lnd.service /etc/systemd/system/lnd.service
|
||||
sudo chmod +x /etc/systemd/system/lnd.service
|
||||
sudo systemctl enable lnd
|
||||
echo "OK"
|
||||
echo ""
|
||||
|
||||
echo "*** Remove Tor ***"
|
||||
sudo apt remove tor tor-arm -y
|
||||
echo ""
|
||||
|
||||
echo "*** Remove dirmngr ***"
|
||||
sudo apt remove dirmngr -y
|
||||
echo ""
|
||||
|
||||
echo "*** Remove NYX ***"
|
||||
sudo pip uninstall nyx -y
|
||||
echo ""
|
||||
|
||||
echo "*** Remove TOR Files/Config ***"
|
||||
sudo rm -r -f /mnt/hdd/tor
|
||||
echo ""
|
||||
|
||||
echo "needs reboot to activate new setting"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "FAIL - Unknown Paramter $1"
|
||||
echo "may needs reboot to run normal again"
|
||||
exit 1
|
@ -4,7 +4,7 @@
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "small config script to switch the LND autoNatDiscovery on or off"
|
||||
echo "lnd.autonat.sh [1|0]"
|
||||
echo "lnd.autonat.sh [on|off]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -22,15 +22,23 @@ if [ ${valueExists} -eq 0 ]; then
|
||||
sudo sed -i '$ a nat=false' /mnt/hdd/lnd/lnd.conf
|
||||
fi
|
||||
|
||||
# stop services
|
||||
echo "making sure services are not running"
|
||||
sudo systemctl stop lnd 2>/dev/null
|
||||
|
||||
# switch on
|
||||
if [ $1 -eq 1 ] || [ "$1" = "on" ]; then
|
||||
echo "switching the LND autonat ON"
|
||||
# disable lnd service
|
||||
sudo systemctl disable lnd
|
||||
# editing lnd config
|
||||
sudo sed -i "s/^nat=.*/nat=true/g" /mnt/hdd/lnd/lnd.conf
|
||||
# editing lnd service (removing the static publicip)
|
||||
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
|
||||
sudo sed -i "s/^autoNatDiscovery=.*/autoNatDiscovery=on/g" /mnt/hdd/raspiblitz.conf
|
||||
# enable lnd service
|
||||
sudo systemctl enable lnd
|
||||
echo "OK - autonat is now ON"
|
||||
echo "needs reboot to activate new setting"
|
||||
exit 0
|
||||
@ -39,16 +47,21 @@ fi
|
||||
# switch off
|
||||
if [ $1 -eq 0 ] || [ "$1" = "off" ]; then
|
||||
echo "switching the LND autonat OFF"
|
||||
# disable lnd service
|
||||
sudo systemctl disable lnd
|
||||
# editing lnd config
|
||||
sudo sed -i "s/^nat=.*/nat=false/g" /mnt/hdd/lnd/lnd.conf
|
||||
# editing lnd service (adding the static publicip)
|
||||
sudo sed -i "s/^lnd --externalip=.*/ExecStart=/usr/local/bin/lnd --externalip=${PUBLICIP}/g" /etc/systemd/system/lnd.service
|
||||
# edit raspi blitz config
|
||||
sudo sed -i "s/^autoNatDiscovery=.*/autoNatDiscovery=off/g" /mnt/hdd/raspiblitz.conf
|
||||
# enable lnd service
|
||||
sudo systemctl enable lnd
|
||||
echo "OK - autonat is now OFF"
|
||||
echo "needs reboot to activate new setting"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "FAIL - Unknown Paramter $1"
|
||||
echo "may needs reboot to run normal again"
|
||||
exit 1
|
@ -2,7 +2,7 @@
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "small config script to switch the LND auto pilot on or off"
|
||||
echo "lnd.autopilot.sh [1|0]"
|
||||
echo "lnd.autopilot.sh [on|off]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -13,6 +13,10 @@ if [ ${lndConfExists} -eq 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# stop services
|
||||
echo "making sure services are not running"
|
||||
sudo systemctl stop lnd 2>/dev/null
|
||||
|
||||
# check if "autopilot.active" exists
|
||||
valueExists=$(sudo cat /mnt/hdd/lnd/lnd.conf | grep -c 'autopilot.active=')
|
||||
if [ ${valueExists} -eq 0 ]; then
|
||||
@ -44,4 +48,5 @@ if [ $1 -eq 0 ] || [ "$1" = "off" ]; then
|
||||
fi
|
||||
|
||||
echo "FAIL - Unknown Paramter $1"
|
||||
echo "may needs reboot to run normal again"
|
||||
exit 1
|
@ -28,6 +28,11 @@ if [ "${network}" = "litecoin" ] && [ "$1" = "testnet" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# stop services
|
||||
echo "making sure services are not running"
|
||||
sudo systemctl stop lnd 2>/dev/null
|
||||
sudo systemctl stop ${network}d 2>/dev/null
|
||||
|
||||
# editing network config files (hdd & admin user)
|
||||
echo "edit ${network} config .."
|
||||
if [ "$1" = "testnet" ]; then
|
||||
|
Loading…
x
Reference in New Issue
Block a user