Browse Source

show node address in main menu

#146
rootzoll 7 years ago
parent
commit
8f7b549db3
  1. 5
      home.admin/00mainMenu.sh
  2. 1
      home.admin/20initDialog.sh
  3. 31
      home.admin/96addTorService.sh
  4. 5
      home.admin/assets/getpublicip.sh
  5. 7
      home.admin/assets/lnd.tor.service

5
home.admin/00mainMenu.sh

@ -60,6 +60,9 @@ else
else
# set node address as backtitle
BACKTITLE=$(lncli getinfo | grep "uris" -A 2 | tr -d '\n' | cut -d '"' -f4)
chain=$(${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo | jq -r '.chain')
switchOption="to MAINNET"
if [ "${chain}" = "main" ]; then
@ -86,7 +89,7 @@ else
fi
torInstalled=$(sudo ls /mnt/hdd/tor/lnd9735/hostname 2>/dev/null | grep 'hostname' -c)
if [ ${torInstalled} -eq 0 ]; then
OPTIONS+=(TOR "Make reachable thru TOR")
OPTIONS+=(TOR "Make reachable thru TOR")
else
OPTIONS+=(NYX "Monitor TOR")
fi

1
home.admin/20initDialog.sh

@ -75,7 +75,6 @@ while [ ${#result} -lt 8 ]
sed -i "s/^rpcpassword=.*/rpcpassword=${result}/g" /home/admin/assets/${network}.conf
sed -i "s/^${network}d.rpcpass=.*/${network}d.rpcpass=${result}/g" /home/admin/assets/lnd.${network}.conf
# success info dialog
dialog --backtitle "RaspiBlitz - SetUP" --msgbox "OK - RPC password changed to '$result'\n\nNow starting the Setup of your RaspiBlitz." 7 52
clear

31
home.admin/96addTorService.sh

@ -7,6 +7,7 @@
# load network
network=`cat .network`
chain="$(${network}-cli getblockchaininfo | jq -r '.chain')"
# location of TOR config
torrc="/etc/tor/torrc"
@ -64,7 +65,7 @@ sudo mkdir /mnt/hdd/tor/sys
sudo mkdir /mnt/hdd/tor/web80
sudo mkdir /mnt/hdd/tor/lnd9735
sudo chmod -R 700 /mnt/hdd/tor
sudo chown -R debian-tor:debian-tor /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
@ -77,8 +78,9 @@ Log notice file /mnt/hdd/tor/notice.log
Log info file /mnt/hdd/tor/info.log
RunAsDaemon 1
User bitcoin
PortForwarding 1
ControlPort 905
ControlPort 9051
SocksPort 9050
CookieAuthFile /mnt/hdd/tor/sys/control_auth_cookie
@ -121,11 +123,11 @@ echo ""
echo "*** Setting Permissions ***"
# so that chain network can create Tor hidden service
echo "setting bitcoind permissions"
sudo usermod -a -G debian-tor bitcoin
#echo "setting bitcoind permissions"
#sudo usermod -a -G debian-tor bitcoin
# so that you can run `arm` as user
echo "setting pi permissions"
sudo usermod -a -G debian-tor pi
#echo "setting pi permissions"
#sudo usermod -a -G debian-tor pi
echo "*** Waiting for TOR to boostrap ***"
torIsBootstrapped=0
@ -171,7 +173,11 @@ if [ "${network}" = "bitcoin" ]; then
do
echo "--- Checking ---"
date +%s
sudo cat /mnt/hdd/${network}/debug.log | grep "tor" | tail -n 10
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=$(${network}-cli getnetworkinfo | grep '"address"' | cut -d '"' -f4)
echo "If this takes too long --> CTRL+c, reboot and check manually"
sleep 5
@ -184,15 +190,14 @@ else
fi
echo ""
echo "*** Setting your Onion Address ***"
onionLND=$(sudo cat /mnt/hdd/tor/lnd9735/hostname)
echo "Your Lightning Tor Onion Address is: ${onionLND}:9735"
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
sudo systemctl disable lnd
echo "Writing Public Onion Address to /run/publicip"
echo "PUBLICIP=${onionLND}" | sudo tee /run/publicip
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

5
home.admin/assets/getpublicip.sh

@ -5,10 +5,11 @@
echo 'getpublicip.sh started, writing public IP address every 10 minutes into /run/publicip'
while [ 0 ];
do
torExists=$(sudo ls /mnt/hdd/tor/lnd9735/hostname 2>/dev/null | grep hostname -c)
torExists=$(sudo ls /mnt/hdd/tor/web80/hostname 2>/dev/null | grep hostname -c)
if [ ${torExists} -eq 1 ]; then
# use tor onion address
printf "PUBLICIP=$(sudo cat /mnt/hdd/tor/lnd9735/hostname)\n" > /run/publicip;
# printf "PUBLICIP=$(sudo cat /mnt/hdd/tor/lnd9735/hostname)\n" > /run/publicip;
# just leave /run/publicip
else
# get public IP
printf "PUBLICIP=$(curl -vv ipinfo.io/ip 2> /run/publicip.log)\n" > /run/publicip;

7
home.admin/assets/lnd.tor.service

@ -12,7 +12,14 @@ After=bitcoind.service
# get var PUBIP from file
EnvironmentFile=/run/publicip
# TOR Hidden Service v2
# had bad memory performance with raspi with lnd 0.4.2
# ExecStart=/usr/local/bin/lnd --tor.active --tor.v2 --listen=127.0.0.1:9735
# --tor.V2PrivateKeyPath=/mnt/hdd/bitcoin/[testnet3/]onion_private_key
# TOR Hidden Service v3
ExecStart=/usr/local/bin/lnd --tor.active --tor.v3 --externalip=${PUBLICIP} --listen=127.0.0.1:9735
PIDFile=/home/bitcoin/.lnd/lnd.pid
User=bitcoin
Group=bitcoin

Loading…
Cancel
Save