use auto nat discover starting in lnd 0.5-beta #249

This commit is contained in:
rootzoll 2018-10-16 13:09:14 +02:00
parent c1dcbe6e4a
commit ba6f40fd2b
11 changed files with 14 additions and 62 deletions

View file

@ -78,15 +78,3 @@ sed -i "s/^${network}d.rpcpass=.*/${network}d.rpcpass=${result}/g" /home/admin/a
# success info dialog # success info dialog
dialog --backtitle "RaspiBlitz - SetUP" --msgbox "OK - RPC password changed to '$result'\n\nNow starting the Setup of your RaspiBlitz." 7 52 dialog --backtitle "RaspiBlitz - SetUP" --msgbox "OK - RPC password changed to '$result'\n\nNow starting the Setup of your RaspiBlitz." 7 52
clear clear
# init get publicip service
getpublicipExists=$(sudo ls /usr/local/bin/getpublicip.sh 2>/dev/null | grep "getpublicip.sh" -c)
if [ ${getpublicipExists} -eq 0 ]; then
echo "*** Installing getPublic ip script and service *** "
sudo cp ./assets/getpublicip.sh /usr/local/bin/getpublicip.sh
sudo chmod +x /usr/local/bin/getpublicip.sh
sudo cp ./assets/getpublicip.service /etc/systemd/system/getpublicip.service
sudo systemctl enable getpublicip
sudo systemctl start getpublicip
echo ""
fi

View file

@ -64,6 +64,8 @@ echo "allow: trasmission"
sudo ufw allow 51413 comment 'transmission' sudo ufw allow 51413 comment 'transmission'
echo "allow: local web admin" echo "allow: local web admin"
sudo ufw allow from 192.168.0.0/24 to any port 80 comment 'allow local LAN web' sudo ufw allow from 192.168.0.0/24 to any port 80 comment 'allow local LAN web'
echo "open firewall for auto nat discover"
sudo ufw allow proto udp from 192.168.0.0/24 port 1900 to any comment 'allow local LAN SSDP for UPnP discovery'
echo "enable lazy firewall" echo "enable lazy firewall"
sudo ufw --force enable sudo ufw --force enable
echo "" echo ""

View file

@ -197,8 +197,8 @@ echo ""
echo "*** Putting LND behind TOR ***" echo "*** Putting LND behind TOR ***"
echo "Disable LND again" echo "Disable LND again"
sudo systemctl disable lnd sudo systemctl disable lnd
echo "Writing Public Onion Address to /run/publicip (just in case for TotHiddenServiceV3)" echo "Writing Public Onion Address to /mnt/hdd/tor/v3Address (just in case for TotHiddenServiceV3)"
echo "PUBLICIP=${onionLND}" | sudo tee /run/publicip echo "V3ADDRESS=${onionLND}" | sudo tee /mnt/hdd/tor/v3Address
echo "Configure and Changing to lnd.tor.service" echo "Configure and Changing to lnd.tor.service"
sed -i "5s/.*/Wants=${network}d.service/" ./assets/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 sed -i "6s/.*/After=${network}d.service/" ./assets/lnd.tor.service

View file

@ -2,8 +2,8 @@
[Unit] [Unit]
Description=Bitcoin daemon Description=Bitcoin daemon
Wants=getpublicip.service Wants=bootstrap.service
After=getpublicip.service After=bootstrap.service
# for use with sendmail alert (coming soon) # for use with sendmail alert (coming soon)
#OnFailure=systemd-sendmail@%n #OnFailure=systemd-sendmail@%n

View file

@ -1,21 +0,0 @@
# RaspiBolt LND Mainnet: systemd unit for getpublicip.sh script
# /etc/systemd/system/getpublicip.service
[Unit]
Description=getpublicip.sh: get public ip address from ipinfo.io
Wants=bootstrap.service
After=bootstrap.service
[Service]
User=root
Group=root
Type=simple
ExecStart=/usr/local/bin/getpublicip.sh
ExecStartPost=/bin/sleep 5
Restart=always
RestartSec=600
TimeoutSec=10
[Install]
WantedBy=multi-user.target

View file

@ -1,16 +0,0 @@
#!/bin/bash
echo 'getpublicip.sh started, writing public IP address every 10 minutes into /run/publicip'
while [ 0 ];
do
# check if TOR is running
torExists=$(sudo ls /mnt/hdd/tor/lnd9735/hostname 2>/dev/null | grep hostname -c)
if [ ${torExists} -eq 0 ]; then
# get and set public IP
printf "PUBLICIP=$(curl -vv ipinfo.io/ip 2> /run/publicip.log)\n" > /run/publicip;
else
# set onion address
printf "PUBLICIP=$(sudo cat /mnt/hdd/tor/lnd9735/hostname)\n" > /run/publicip;
fi
sleep 600
done;

View file

@ -1,7 +1,7 @@
[Unit] [Unit]
Description=Bitcoin daemon Description=Bitcoin daemon
Wants=getpublicip.service Wants=bootstrap.service
After=getpublicip.service After=bootstrap.service
# for use with sendmail alert (coming soon) # for use with sendmail alert (coming soon)
#OnFailure=systemd-sendmail@%n #OnFailure=systemd-sendmail@%n

View file

@ -5,6 +5,7 @@ debuglevel=debug
maxpendingchannels=5 maxpendingchannels=5
alias=raspiblitz alias=raspiblitz
color=#68F442 color=#68F442
nat=true
# RPC open to all connections on Port 10009 # RPC open to all connections on Port 10009
rpclisten=0.0.0.0:10009 rpclisten=0.0.0.0:10009

View file

@ -5,6 +5,7 @@ debuglevel=debug
maxpendingchannels=5 maxpendingchannels=5
alias=raspiblitz alias=raspiblitz
color=#68F442 color=#68F442
nat=true
# RPC open to all connections on Port 10009 # RPC open to all connections on Port 10009
rpclisten=0.0.0.0:10009 rpclisten=0.0.0.0:10009

View file

@ -9,10 +9,7 @@ After=bitcoind.service
#OnFailure=systemd-sendmail@%n #OnFailure=systemd-sendmail@%n
[Service] [Service]
# get var PUBIP from file ExecStart=/usr/local/bin/lnd
EnvironmentFile=/run/publicip
ExecStart=/usr/local/bin/lnd --externalip=${PUBLICIP}
PIDFile=/home/bitcoin/.lnd/lnd.pid PIDFile=/home/bitcoin/.lnd/lnd.pid
User=bitcoin User=bitcoin
Group=bitcoin Group=bitcoin

View file

@ -10,13 +10,13 @@ After=bitcoind.service
[Service] [Service]
# get var PUBIP from file # get var PUBIP from file
EnvironmentFile=/run/publicip EnvironmentFile=/mnt/hdd/tor/v3Address
# TOR Hidden Service v2 # TOR Hidden Service v2
ExecStart=/usr/local/bin/lnd --tor.active --tor.v2 --listen=127.0.0.1:9735 ExecStart=/usr/local/bin/lnd --tor.active --tor.v2 --listen=127.0.0.1:9735
# TOR Hidden Service v3 # TOR Hidden Service v3
# ExecStart=/usr/local/bin/lnd --tor.active --tor.v3 --externalip=${PUBLICIP} --listen=127.0.0.1:9735 # ExecStart=/usr/local/bin/lnd --tor.active --tor.v3 --externalip=${V3ADDRESS} --listen=127.0.0.1:9735
PIDFile=/home/bitcoin/.lnd/lnd.pid PIDFile=/home/bitcoin/.lnd/lnd.pid
User=bitcoin User=bitcoin