mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-09-20 04:37:19 +02:00
committed by
rootzoll
parent
da5e604e6c
commit
0b075632d1
@@ -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|btcpay]"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -13,9 +13,10 @@ exportType=$1
|
|||||||
# interactive choose type of export if not set
|
# interactive choose type of export if not set
|
||||||
if [ "$1" = "" ] || [ $# -eq 0 ]; then
|
if [ "$1" = "" ] || [ $# -eq 0 ]; then
|
||||||
OPTIONS=()
|
OPTIONS=()
|
||||||
OPTIONS+=(HEX "Hex-String (Copy+Paste)")
|
|
||||||
OPTIONS+=(SCP "SSH Download (Commands)")
|
OPTIONS+=(SCP "SSH Download (Commands)")
|
||||||
OPTIONS+=(HTTP "Browserdownload (bit risky)")
|
OPTIONS+=(HTTP "Browserdownload (bit risky)")
|
||||||
|
OPTIONS+=(HEX "Hex-String (Copy+Paste)")
|
||||||
|
OPTIONS+=(STR "BTCPay Connection String")
|
||||||
CHOICE=$(dialog --clear \
|
CHOICE=$(dialog --clear \
|
||||||
--backtitle "RaspiBlitz" \
|
--backtitle "RaspiBlitz" \
|
||||||
--title "Export Macaroons & TLS.cert" \
|
--title "Export Macaroons & TLS.cert" \
|
||||||
@@ -28,6 +29,9 @@ if [ "$1" = "" ] || [ $# -eq 0 ]; then
|
|||||||
HEX)
|
HEX)
|
||||||
exportType='hexstring';
|
exportType='hexstring';
|
||||||
;;
|
;;
|
||||||
|
STR)
|
||||||
|
exportType='btcpay';
|
||||||
|
;;
|
||||||
SCP)
|
SCP)
|
||||||
exportType='scp';
|
exportType='scp';
|
||||||
;;
|
;;
|
||||||
@@ -35,6 +39,7 @@ if [ "$1" = "" ] || [ $# -eq 0 ]; then
|
|||||||
exportType='http';
|
exportType='http';
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# load data from config
|
# load data from config
|
||||||
@@ -70,6 +75,49 @@ elif [ "${exportType}" = "hexstring" ]; then
|
|||||||
sudo xxd -ps -u -c 1000 /mnt/hdd/lnd/tls.cert
|
sudo xxd -ps -u -c 1000 /mnt/hdd/lnd/tls.cert
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
########################
|
||||||
|
# BTCPAY Connection String
|
||||||
|
########################
|
||||||
|
elif [ "${exportType}" = "btcpay" ]; then
|
||||||
|
|
||||||
|
# take public IP as default
|
||||||
|
# TODO: IP2TOR --> check if there is a forwarding for LND REST oe ask user to set one up
|
||||||
|
#ip="${publicIP}"
|
||||||
|
ip="127.0.0.1"
|
||||||
|
port="8080"
|
||||||
|
|
||||||
|
# will overwrite ip & port if IP2TOR tunnel is available
|
||||||
|
source <(sudo /home/admin/config.scripts/blitz.subscriptions.ip2tor.py subscription-by-service LND-REST-API)
|
||||||
|
|
||||||
|
# check if there is a IP2TOR for LND REST
|
||||||
|
|
||||||
|
# get macaroon
|
||||||
|
# TODO: best would be not to use admin macaroon here in the future
|
||||||
|
macaroon=$(sudo xxd -ps -u -c 1000 /mnt/hdd/lnd/data/chain/${network}/${chain}net/admin.macaroon)
|
||||||
|
|
||||||
|
# get certificate thumb
|
||||||
|
certthumb=$(sudo openssl x509 -noout -fingerprint -sha256 -inform pem -in /mnt/hdd/lnd/tls.cert | cut -d "=" -f 2)
|
||||||
|
|
||||||
|
# construct connection string
|
||||||
|
connectionString="type=lnd-rest;server=https://${ip}:${port}/;macaroon=${macaroon};certthumbprint=${certthumb}"
|
||||||
|
|
||||||
|
clear
|
||||||
|
echo "###### BTCPAY CONNECTION STRING ######"
|
||||||
|
echo ""
|
||||||
|
echo "${connectionString}"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# add info about outside reachability (type would have a value if IP2TOR tunnel was found)
|
||||||
|
if [ ${#type} -gt 0 ]; then
|
||||||
|
echo "NOTE: You have a IP2TOR connection for LND REST API .. so you can use this connection string also with a external BTCPay server."
|
||||||
|
else
|
||||||
|
echo "IMPORTANT: You can only use this connection string for a BTCPay server running on this RaspiBlitz."
|
||||||
|
echo "If you want to connect from a external BTCPay server activate a IP2TOR tunnel for LND-REST first:"
|
||||||
|
echo "MAIN MENU > SUBSCRIBE > IP2TOR > LND REST API"
|
||||||
|
echo "Then come back and get a new connection string."
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
|
||||||
###########################
|
###########################
|
||||||
# SHH / SCP File Download
|
# SHH / SCP File Download
|
||||||
###########################
|
###########################
|
||||||
|
Reference in New Issue
Block a user