mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-09-27 12:06:36 +02:00
reset macarrons
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
# command info
|
# command info
|
||||||
if [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
if [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||||
echo "tool to export macaroons & tls.cert"
|
echo "tool to export macaroons & tls.cert"
|
||||||
echo "lnd.export.sh [hexstring|scp|http]"
|
echo "lnd.export.sh [hexstring|scp|http|reset]"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -15,12 +15,13 @@ if [ "$1" = "" ] || [ $# -eq 0 ]; then
|
|||||||
OPTIONS=()
|
OPTIONS=()
|
||||||
OPTIONS+=(HEX "Hex-String (Copy+Paste)")
|
OPTIONS+=(HEX "Hex-String (Copy+Paste)")
|
||||||
OPTIONS+=(SCP "SSH Download (Commands)")
|
OPTIONS+=(SCP "SSH Download (Commands)")
|
||||||
OPTIONS+=(HTTP "Browserdownload (risky)")
|
OPTIONS+=(HTTP "Browserdownload (bit risky)")
|
||||||
|
OPTIONS+=(RESET "RENEW MACAROONS & TLS")
|
||||||
CHOICE=$(dialog --clear \
|
CHOICE=$(dialog --clear \
|
||||||
--backtitle "RaspiBlitz" \
|
--backtitle "RaspiBlitz" \
|
||||||
--title "Export Macaroons & TLS.cert" \
|
--title "Export Macaroons & TLS.cert" \
|
||||||
--menu "How do you want to export?" \
|
--menu "How do you want to export?" \
|
||||||
10 50 6 \
|
11 50 7 \
|
||||||
"${OPTIONS[@]}" \
|
"${OPTIONS[@]}" \
|
||||||
2>&1 >/dev/tty)
|
2>&1 >/dev/tty)
|
||||||
clear
|
clear
|
||||||
@@ -34,16 +35,27 @@ if [ "$1" = "" ] || [ $# -eq 0 ]; then
|
|||||||
HTTP)
|
HTTP)
|
||||||
exportType='http';
|
exportType='http';
|
||||||
;;
|
;;
|
||||||
|
RESET)
|
||||||
|
exportType='reset';
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# load data from config
|
# load data from config
|
||||||
source /mnt/hdd/raspiblitz.conf 2>/dev/null
|
source /mnt/hdd/raspiblitz.conf 2>/dev/null
|
||||||
|
|
||||||
|
########################
|
||||||
|
# CANCEL
|
||||||
|
########################
|
||||||
|
if [ ${#exportType} -eq 0 ]; then
|
||||||
|
|
||||||
|
echo "CANCEL"
|
||||||
|
exit 0
|
||||||
|
|
||||||
########################
|
########################
|
||||||
# HEXSTRING
|
# HEXSTRING
|
||||||
########################
|
########################
|
||||||
if [ ${exportType} = "hexstring" ]; then
|
elif [ "${exportType}" = "hexstring" ]; then
|
||||||
|
|
||||||
clear
|
clear
|
||||||
echo "###### HEXSTRING EXPORT ######"
|
echo "###### HEXSTRING EXPORT ######"
|
||||||
@@ -61,7 +73,7 @@ if [ ${exportType} = "hexstring" ]; then
|
|||||||
###########################
|
###########################
|
||||||
# SHH / SCP File Download
|
# SHH / SCP File Download
|
||||||
###########################
|
###########################
|
||||||
elif [ ${exportType} = "scp" ]; then
|
elif [ "${exportType}" = "scp" ]; then
|
||||||
|
|
||||||
local_ip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
local_ip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||||
clear
|
clear
|
||||||
@@ -82,7 +94,7 @@ elif [ ${exportType} = "scp" ]; then
|
|||||||
###########################
|
###########################
|
||||||
# HTTP File Download
|
# HTTP File Download
|
||||||
###########################
|
###########################
|
||||||
elif [ ${exportType} = "http" ]; then
|
elif [ "${exportType}" = "http" ]; then
|
||||||
|
|
||||||
local_ip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
local_ip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||||
randomPortNumber=$(shuf -i 20000-39999 -n 1)
|
randomPortNumber=$(shuf -i 20000-39999 -n 1)
|
||||||
@@ -111,6 +123,28 @@ elif [ ${exportType} = "http" ]; then
|
|||||||
sudo rm -r ${randomFolderName}
|
sudo rm -r ${randomFolderName}
|
||||||
echo "OK - temp HTTP server is stopped."
|
echo "OK - temp HTTP server is stopped."
|
||||||
|
|
||||||
|
###########################
|
||||||
|
# RESET Macaroons and TLS
|
||||||
|
###########################
|
||||||
|
elif [ "${exportType}" = "reset" ]; then
|
||||||
|
|
||||||
|
clear
|
||||||
|
echo "###### RESET MACAROONS AND TLS.cert ######"
|
||||||
|
echo ""
|
||||||
|
echo "All your macaroons and the tls.cert gets gets deleted and recreated."
|
||||||
|
echo ""
|
||||||
|
cd
|
||||||
|
echo "- deleting old macaroons"
|
||||||
|
sudo rm /home/bitcoin/.lnd/data/chain/${network}/${chain}net/*.macaroon
|
||||||
|
echo "- resetting TLS cert"
|
||||||
|
sudo /home/admin/config.scripts/lnd.newtlscert.sh
|
||||||
|
echo "- copy new macaroons to admin user"
|
||||||
|
sudo cp /home/bitcoin/.lnd/data/chain/${network}/${chain}net/*.macaroon /home/admin/.lnd/data/chain/${network}/${chain}net/
|
||||||
|
sudo chown admin:admin -R /home/admin/.lnd/data/chain/${network}/${chain}net/*.macaroon
|
||||||
|
echo "- restarting LND"
|
||||||
|
sudo systemctl start lnd 2>/dev/null
|
||||||
|
echo "OK DONE - LND is restarting - you may need to unlock wallet again."
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "FAIL: unknown '${exportType}' -run-> ./lnd.export.sh -h"
|
echo "FAIL: unknown '${exportType}' -run-> ./lnd.export.sh -h"
|
||||||
fi
|
fi
|
@@ -26,4 +26,5 @@ done
|
|||||||
sudo killall /usr/local/bin/lnd
|
sudo killall /usr/local/bin/lnd
|
||||||
echo "copy new cert to admin user"
|
echo "copy new cert to admin user"
|
||||||
sudo cp /mnt/hdd/lnd/tls.cert /home/admin/.lnd
|
sudo cp /mnt/hdd/lnd/tls.cert /home/admin/.lnd
|
||||||
|
sudo chown admin:admin -R /home/admin/.lnd/*.cert
|
||||||
echo "OK TLS certs are fresh"
|
echo "OK TLS certs are fresh"
|
Reference in New Issue
Block a user