mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2024-11-19 18:00:22 +01:00
parent
7d79231051
commit
04bba1b5ce
@ -11,8 +11,6 @@ nat=false
|
||||
rpclisten=0.0.0.0:10009
|
||||
# REST open to all connections on Port 8080
|
||||
restlisten=0.0.0.0:8080
|
||||
# Domain, could use https://freedns.afraid.org
|
||||
#tlsextradomain=lightning.yourhost.com
|
||||
|
||||
[Bitcoin]
|
||||
bitcoin.active=1
|
||||
|
@ -12,9 +12,6 @@ rpclisten=0.0.0.0:10009
|
||||
# REST open to all connections on Port 8080
|
||||
restlisten=0.0.0.0:8080
|
||||
|
||||
# Domain, could use https://freedns.afraid.org
|
||||
#tlsextradomain=lightning.yourhost.com
|
||||
|
||||
[Litecoin]
|
||||
litecoin.active=1
|
||||
litecoin.mainnet=1
|
||||
|
@ -312,6 +312,7 @@ whiptail --backtitle "Connecting Mobile Wallet" \
|
||||
if [ $? -eq 1 ]; then
|
||||
# backup - show QR code on screen (not LCD)
|
||||
if [ "${connector}" == "lndconnect" ]; then
|
||||
echo "lndconnect --host=${hostscreen} --port=${port} ${extraparameter}"
|
||||
lndconnect --host=${hostscreen} --port=${port} ${extraparameter}
|
||||
echo "Press ENTER when finished."
|
||||
read key
|
||||
|
@ -89,25 +89,19 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
echo "# dynDomain(${dynDomain})"
|
||||
echo "# dynUpdateUrl(${dynUpdateUrl})"
|
||||
|
||||
# setting value in raspi blitz config
|
||||
sudo sed -i "s/^dynDomain=.*/dynDomain='${dynDomain}'/g" /mnt/hdd/raspiblitz.conf
|
||||
|
||||
# setting dynUpdateUrl is a bit complicated because value can contain chars that break sed replacement
|
||||
# so first remove dynUpdateUrl from config and then add fresh as new line at the end
|
||||
grep -v "dynUpdateUrl" /mnt/hdd/raspiblitz.conf > ./raspiblitz.conf.new
|
||||
echo "dynUpdateUrl='${dynUpdateUrl}'" >> ./raspiblitz.conf.new
|
||||
sudo rm /mnt/hdd/raspiblitz.conf
|
||||
sudo mv ./raspiblitz.conf.new /mnt/hdd/raspiblitz.conf
|
||||
sudo chmod 777 /mnt/hdd/raspiblitz.conf
|
||||
#sudo sed -i "s/^dynUpdateUrl=.*/dynUpdateUrl='${dynUpdateUrl}'/g" /mnt/hdd/raspiblitz.conf
|
||||
|
||||
echo "# changing lnd.conf"
|
||||
# remove line & write fresh
|
||||
sudo sed -i "/dynDomain=*/d" /mnt/hdd/raspiblitz.conf
|
||||
echo "dynDomain='${dynDomain}'" >> /mnt/hdd/raspiblitz.conf
|
||||
|
||||
# lnd.conf: uncomment tlsextradomain (just if it is still uncommented)
|
||||
sudo sed -i "s/^#tlsextradomain=.*/tlsextradomain=/g" /mnt/hdd/lnd/lnd.conf
|
||||
# remove line & write fresh
|
||||
sudo sed -i "/dynUpdateUrl=*/d" /mnt/hdd/raspiblitz.conf
|
||||
echo "dynUpdateUrl='${dynUpdateUrl}'" >> /mnt/hdd/raspiblitz.conf
|
||||
|
||||
# lnd.conf: domain value
|
||||
sudo sed -i "s/^tlsextradomain=.*/tlsextradomain=${dynDomain}/g" /mnt/hdd/lnd/lnd.conf
|
||||
# lnd.conf: domain value &
|
||||
sudo /home/admin/config.scripts/lnd.tlscert.sh domain-add ${dynDomain}
|
||||
|
||||
echo "# DynamicDNS is now ON"
|
||||
fi
|
||||
@ -117,13 +111,11 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
||||
echo "# switching DynamicDNS OFF"
|
||||
|
||||
# setting value in raspi blitz config
|
||||
sudo sed -i "s/^dynDomain=.*/dynDomain=/g" /mnt/hdd/raspiblitz.conf
|
||||
sudo sed -i "s/^dynUpdateUrl=.*/dynUpdateUrl=/g" /mnt/hdd/raspiblitz.conf
|
||||
sudo sed -i "/dynUpdateUrl=*/d" /mnt/hdd/raspiblitz.conf
|
||||
sudo sed -i "/dynDomain=*/d" /mnt/hdd/raspiblitz.conf
|
||||
|
||||
echo "# changing lnd.conf"
|
||||
|
||||
# lnd.conf: comment tlsextradomain out
|
||||
sudo sed -i "s/^tlsextradomain=.*/#tlsextradomain=/g" /mnt/hdd/lnd/lnd.conf
|
||||
# lnd.conf: remove domain tls entries
|
||||
sudo /home/admin/config.scripts/lnd.tlscert.sh domain-remove ALL
|
||||
|
||||
echo "# DynamicDNS is now OFF"
|
||||
fi
|
||||
|
@ -108,7 +108,6 @@ if [ "$1" = "reset" ]; then
|
||||
keepOldMacaroons=1
|
||||
fi
|
||||
|
||||
|
||||
if [ ${resetMacaroons} -eq 1 ]; then
|
||||
echo "## Resetting Macaroons"
|
||||
echo "# all your macaroons get deleted and recreated"
|
||||
|
@ -1,14 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# ToDo(frennkie) why doesn't this start lnd again? - I assume as _background will start it anyway?!
|
||||
# ToDo(frennkie) the way LND generates the x509 certificate is not ideal -
|
||||
# it may be better to simply run openssl and create a cert with our settings...
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "script to set and config TLS Cert for LND"
|
||||
echo "lnd.tlscert.sh refresh"
|
||||
echo "lnd.tlscert.sh ip-add [ip]"
|
||||
echo "lnd.tlscert.sh ip-remove [ip]"
|
||||
echo "lnd.tlscert.sh ip-remove [ip|ALL]"
|
||||
echo "lnd.tlscert.sh domain-add [domain]"
|
||||
echo "lnd.tlscert.sh domain-remove [domain|ALL]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -19,11 +17,12 @@ LNDCONF="/mnt/hdd/lnd/lnd.conf"
|
||||
|
||||
if [ "$1" = "ip-add" ]; then
|
||||
|
||||
echo "# lnd.tlscert.sh $1"
|
||||
|
||||
# 2. parameter: ip
|
||||
ip=$2
|
||||
countDots=$(echo "$ip" | grep -c '.')
|
||||
if [ ${countDots} -eq 0 ]; then
|
||||
echo "error='missing or invalid IP'"
|
||||
if [ ${#ip} -eq 0 ]; then
|
||||
echo "error='missing parameter'"
|
||||
exit
|
||||
fi
|
||||
|
||||
@ -40,11 +39,11 @@ if [ "$1" = "ip-add" ]; then
|
||||
# check if line is added
|
||||
found=$(sudo cat ${LNDCONF} | grep -c "tlsextraip=${ip}")
|
||||
if [ ${found} -eq 0 ]; then
|
||||
echo "error='failed adding IP'"
|
||||
echo "error='failed adding tlsextraip'"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "# OK added IP to lnd.conf - refresh of TLS cert is needed"
|
||||
echo "# OK added tlsextraip to lnd.conf - refresh of TLS cert is needed"
|
||||
exit
|
||||
fi
|
||||
|
||||
@ -52,25 +51,99 @@ fi
|
||||
|
||||
if [ "$1" = "ip-remove" ]; then
|
||||
|
||||
echo "# lnd.tlscert.sh $1"
|
||||
|
||||
# 2. parameter: ip
|
||||
ip=$2
|
||||
countDots=$(echo "$ip" | grep -c '.')
|
||||
if [ ${countDots} -eq 0 ]; then
|
||||
echo "error='missing or invalid IP'"
|
||||
if [ ${#ip} -eq 0 ]; then
|
||||
echo "error='missing parameter'"
|
||||
exit
|
||||
fi
|
||||
|
||||
# remove the line to the LND conf
|
||||
sudo sed -i "/tlsextraip=${ip}/d" ${LNDCONF}
|
||||
if [ "${ip}" == "ALL" ]; then
|
||||
echo "# removing all tlsextraip entries"
|
||||
sudo sed -i "/tlsextraip=*/d" ${LNDCONF}
|
||||
ip=""
|
||||
else
|
||||
echo "# removing tlsextraip=${ip}"
|
||||
sudo sed -i "/tlsextraip=${ip}/d" ${LNDCONF}
|
||||
fi
|
||||
|
||||
# check if line is removed
|
||||
found=$(sudo cat ${LNDCONF} | grep -c "tlsextraip=${ip}")
|
||||
if [ ${found} -gt 0 ]; then
|
||||
echo "error='failed removing IP'"
|
||||
echo "error='failed removing tlsextraip'"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "# OK removed IP from lnd.conf - refresh of TLS cert is needed"
|
||||
echo "# OK removed tlsextraip from lnd.conf - refresh of TLS cert is needed"
|
||||
exit
|
||||
fi
|
||||
|
||||
### ADD DOMAIN
|
||||
|
||||
if [ "$1" = "domain-add" ]; then
|
||||
|
||||
echo "# lnd.tlscert.sh $1"
|
||||
|
||||
# 2. parameter: domain
|
||||
domain=$2
|
||||
if [ ${#domain} -eq 0 ]; then
|
||||
echo "error='missing parameter'"
|
||||
exit
|
||||
fi
|
||||
|
||||
# check if IP is already added
|
||||
found=$(sudo cat ${LNDCONF} | grep -c "tlsextradomain=${domain}")
|
||||
if [ ${found} -gt 0 ]; then
|
||||
echo "# OK the domain was already added lnd.conf"
|
||||
exit
|
||||
fi
|
||||
|
||||
# simply add the line to the LND conf
|
||||
sudo sed -i "10itlsextradomain=${domain}" ${LNDCONF}
|
||||
|
||||
# check if line is added
|
||||
found=$(sudo cat ${LNDCONF} | grep -c "tlsextradomain=${domain}")
|
||||
if [ ${found} -eq 0 ]; then
|
||||
echo "error='failed adding tlsextradomain'"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "# OK added tlsextradomain to lnd.conf - refresh of TLS cert is needed"
|
||||
exit
|
||||
fi
|
||||
|
||||
### REMOVE DOMAIN
|
||||
|
||||
if [ "$1" = "domain-remove" ]; then
|
||||
|
||||
echo "# lnd.tlscert.sh $1"
|
||||
|
||||
# 2. parameter: domain
|
||||
domain=$2
|
||||
if [ ${#domain} -eq 0 ]; then
|
||||
echo "error='missing parameter'"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ "${domain}" == "ALL" ]; then
|
||||
echo "# removing all tlsextradomain entries"
|
||||
sudo sed -i "/tlsextradomain=*/d" ${LNDCONF}
|
||||
ip=""
|
||||
else
|
||||
echo "# removing tlsextradomain=${domain}"
|
||||
sudo sed -i "/tlsextradomain=${domain}/d" ${LNDCONF}
|
||||
fi
|
||||
|
||||
# check if line is removed
|
||||
found=$(sudo cat ${LNDCONF} | grep -c "tlsextradomain=${domain}")
|
||||
if [ ${found} -gt 0 ]; then
|
||||
echo "error='failed removing tlsextradomain'"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "# OK removed tlsextradomain from lnd.conf - refresh of TLS cert is needed"
|
||||
exit
|
||||
fi
|
||||
|
||||
@ -79,10 +152,10 @@ fi
|
||||
if [ "$1" = "refresh" ]; then
|
||||
|
||||
echo "# checking if LND is running"
|
||||
lndInactive=$(sudo systemctl is-active lnd | grep -c "inactive")
|
||||
if [ ${lndInactive} -eq 1 ]; then
|
||||
lndEnabled=$(sudo systemctl status lnd | grep -c 'enabled')
|
||||
if [ ${lndEnabled} -eq 0 ]; then
|
||||
echo "# FAIL: lnd.tlscert.sh refresh"
|
||||
echo "error='LND systemd service not activated'"
|
||||
echo "error='LND systemd service not enabled'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user