mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-23 14:40:45 +01:00
Merge branch 'v1.6' of https://github.com/rootzoll/raspiblitz into v1.6
This commit is contained in:
commit
ec3a86299f
18 changed files with 217 additions and 490 deletions
2
FAQ.md
2
FAQ.md
|
@ -16,7 +16,7 @@
|
|||
- New: Balance of Satoshis v5.39.4 (with update option) [details](https://github.com/alexbosworth/balanceofsatoshis)
|
||||
- New: Faraday [details](https://github.com/lightninglabs/faraday)
|
||||
- New: Let's Encrypt client [details](FAQ.md#how-to-use-the-lets-encrypt-client)
|
||||
- New: ThunderHub v0.8.0 (with update option) [details](https://www.thunderhub.io)
|
||||
- New: ThunderHub v0.8.4 (with update option) [details](https://www.thunderhub.io)
|
||||
- New: JoininBox (terminal based GUI for JoinMarket) [details](https://github.com/openoms/joininbox)
|
||||
- New: ZeroTier [details](https://zerotier.com/manual/)
|
||||
- Fix: DropBox StaticChannelBackup
|
||||
|
|
|
@ -199,7 +199,7 @@ if [ ${isMounted} -eq 1 ]; then
|
|||
menuitem=$(dialog --clear --beep --backtitle "RaspiBlitz" --title " Getting the Blockchain " \
|
||||
--menu "You need a copy of the Bitcoin Blockchain - choose method:" 13 75 5 \
|
||||
S "SYNC --> Selfvalidate all Blocks (DEFAULT ±2days)" \
|
||||
C "COPY --> Copy from laptop/node over LAN (±4hours)" 2>&1 >/dev/tty)
|
||||
C "COPY --> Copy from laptop/node over LAN (±6hours)" 2>&1 >/dev/tty)
|
||||
|
||||
# Litecoin
|
||||
elif [ ${network} = "litecoin" ]; then
|
||||
|
|
|
@ -354,7 +354,7 @@ to protect the seed words. Most users did not set this.
|
|||
" 11 65
|
||||
if [ $? -eq 1 ]; then
|
||||
sudo shred -u /home/admin/.pass.tmp 2>/dev/null
|
||||
sudo /home/admin/config.scripts/blitz.setpassword.sh x "Enter extra Password D" /home/admin/.pass.tmp
|
||||
sudo /home/admin/config.scripts/blitz.setpassword.sh x "Enter extra Password D" /home/admin/.pass.tmp empty-allowed
|
||||
passwordD=`sudo cat /home/admin/.pass.tmp`
|
||||
sudo shred -u /home/admin/.pass.tmp 2>/dev/null
|
||||
fi
|
||||
|
|
|
@ -42,9 +42,25 @@ if [ ${bitcoinActive} -eq 0 ] || [ ${#bitcoinErrorFull} -gt 0 ] || [ "${1}" == "
|
|||
height=6
|
||||
width=43
|
||||
title="Blockchain Info"
|
||||
if [ ${uptime} -gt 600 ] || [ "${1}" == "blockchain-error" ]; then
|
||||
infoStr=" The ${network}d service is not running.\n Login for more details:"
|
||||
if [ "$USER" == "admin" ]; then
|
||||
|
||||
if [ ${#bitcoinErrorShort} -eq 0 ]; then
|
||||
bitcoinErrorShort="Initial Startup - Please Wait"
|
||||
fi
|
||||
|
||||
if [ "$USER" != "admin" ]; then
|
||||
|
||||
if [ ${uptime} -gt 600 ] || ${#bitcoinErrorFull} -gt 0 ] || [ "${1}" == "blockchain-error" ]; then
|
||||
infoStr=" The ${network}d service is NOT RUNNING!\n\n Login for more details & options:"
|
||||
else
|
||||
infoStr=" The ${network}d service is starting:\n ${bitcoinErrorShort}\n Login with SSH for more details:"
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
# output when user login in as admin and bitcoind is not running
|
||||
|
||||
if [ ${uptime} -gt 600 ] || ${#bitcoinErrorFull} -gt 0 ] || [ "${bitcoinErrorShort}" == "Error found in Logs" ] || [ "${1}" == "blockchain-error" ]; then
|
||||
|
||||
clear
|
||||
echo ""
|
||||
echo "*****************************************"
|
||||
|
@ -62,20 +78,38 @@ if [ ${bitcoinActive} -eq 0 ] || [ ${#bitcoinErrorFull} -gt 0 ] || [ "${1}" == "
|
|||
echo ${bitcoinErrorFull}
|
||||
echo
|
||||
fi
|
||||
echo "-> Use following command to debug: /home/admin/XXdebugLogs.sh"
|
||||
echo "-> To force Main Menu run: /home/admin/00mainMenu.sh"
|
||||
echo "-> To try restart: restart"
|
||||
|
||||
# check if maybe problems with txindex
|
||||
source <(/home/admin/config.scripts/network.txindex.sh status)
|
||||
if [ "${txindex}" == "1" ]; then
|
||||
if [ "${indexFinished}" == "0" ]; then
|
||||
# bitcoind is not starting while still building index - recommend turning off index and restart
|
||||
whiptail --title "Problems with Bitcoin Index" --yes-button "TurnOff TxIndex" --no-button "Do Nothing" --yesno "It looks like ${network}d has problems building the txindex. Turning Off the txindex and restart is recommended." 10 60
|
||||
if [ $? -eq 0 ]; then
|
||||
# delete txindex, turn off and deactivate apps needed index
|
||||
sudo /home/admin/config.scripts/network.txindex.sh delete
|
||||
whiptail --msgbox "OK txindex was turned off.\n\nTo be able to build a valid txindex in the future you might need to reset/redownload the blockchain." 10 56 "" --title " TXINDEX OFF "
|
||||
/home/admin/XXshutdown.sh reboot
|
||||
fi
|
||||
else
|
||||
# bitcoind is not starting but index was build in the past - recommend repair with turning off index
|
||||
echo "-> Use command 'repair' and then choose 'DELETE-INDEX' to try rebuilding transaction index."
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "-> Use command 'repair' and then choose 'RESET-CHAIN' to try downloading new blockchain."
|
||||
echo "-> Use command 'debug' for more log output you can use for getting support."
|
||||
echo "-> Use command 'menu' to open main menu."
|
||||
echo "-> Have you tried to turn it off and on again? Use command 'restart'"
|
||||
echo ""
|
||||
echo "Use CTRL+c to EXIT to Terminal"
|
||||
sleep 10
|
||||
exit 1
|
||||
|
||||
else
|
||||
infoStr=" The ${network}d service is starting:\n ${bitcoinErrorShort}\n Please wait up to 10min ..."
|
||||
fi
|
||||
else
|
||||
height=6
|
||||
if [ ${#bitcoinErrorShort} -eq 0 ]; then
|
||||
bitcoinErrorShort="Initial Startup - Please Wait"
|
||||
fi
|
||||
infoStr=" The ${network}d service is starting:\n ${bitcoinErrorShort}\n Login with SSH for more details:"
|
||||
if [ "$USER" == "admin" ]; then
|
||||
infoStr=" The ${network}d service is starting:\n ${bitcoinErrorShort}\n Please wait up to 5min ..."
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# LND errors second
|
||||
|
@ -121,9 +155,10 @@ elif [ ${lndActive} -eq 0 ] || [ ${#lndErrorFull} -gt 0 ] || [ "${1}" == "lightn
|
|||
echo ${lndErrorFull}
|
||||
fi
|
||||
echo
|
||||
echo "-> Use following command to debug: /home/admin/XXdebugLogs.sh"
|
||||
echo "-> To force Main Menu run: /home/admin/00mainMenu.sh"
|
||||
echo "-> To try restart: restart"
|
||||
echo "-> Use command 'repair' and then choose 'BACKUP-LND' to make a just in case backup."
|
||||
echo "-> Use command 'debug' for more log output you can use for getting support."
|
||||
echo "-> Use command 'menu' to open main menu."
|
||||
echo "-> Have you tried to turn it off and on again? Use command 'restart'"
|
||||
echo ""
|
||||
exit 1
|
||||
else
|
||||
|
|
|
@ -42,16 +42,20 @@ elif [ "${extraParameter}" = "-blockchain" ]; then
|
|||
echo ""
|
||||
echo "# DELETING ..."
|
||||
|
||||
# delete bitcoin blockchain (but keep config)
|
||||
# delete bitcoin blockchain (but keep config & wallet)
|
||||
sudo mv /mnt/hdd/bitcoin/bitcoin.conf /mnt/hdd/bitcoin.conf 2>/dev/null
|
||||
sudo mv /mnt/hdd/bitcoin/wallet.dat /mnt/hdd/wallet.dat 2>/dev/null
|
||||
sudo rm -f -r /mnt/hdd/bitcoin/*
|
||||
sudo mv /mnt/hdd/bitcoin.conf /mnt/hdd/bitcoin/bitcoin.conf 2>/dev/null
|
||||
sudo mv /mnt/hdd/wallet.dat /mnt/hdd/bitcoin/wallet.dat 2>/dev/null
|
||||
sudo chown -R bitcoin:bitcoin /mnt/hdd/bitcoin
|
||||
|
||||
# delete litecoin blockchain (but keep config)
|
||||
# delete litecoin blockchain (but keep config & wallet)
|
||||
sudo mv /mnt/hdd/litecoin/litecoin.conf /mnt/hdd/litecoin.conf 2>/dev/null
|
||||
sudo mv /mnt/hdd/litecoin/wallet.dat /mnt/hdd/wallet.dat 2>/dev/null
|
||||
sudo rm -f -r /mnt/hdd/litecoin/*
|
||||
sudo mv /mnt/hdd/litecoin.conf /mnt/hdd/litecoin/litecoin.conf 2>/dev/null
|
||||
sudo mv /mnt/hdd/wallet.dat /mnt/hdd/litecoin/wallet.dat 2>/dev/null
|
||||
sudo chown -R bitcoin:bitcoin /mnt/hdd/litecoin
|
||||
|
||||
echo "OK Blockchain data deleted - you may want now run: /home/admin/98repairBlockchain.sh"
|
||||
|
|
|
@ -93,6 +93,7 @@ def mail(recipient=None, message=None, subject=None, cert=None, encrypt=False,
|
|||
print("send mail")
|
||||
print("msg: {}".format(message))
|
||||
print("to: {}".format(recipient))
|
||||
print("from: {} <{}>".format(from_name, from_address))
|
||||
print("subject: {}".format(subject))
|
||||
print("cert: {}".format(cert))
|
||||
print("encrypt: {}".format(encrypt))
|
||||
|
@ -103,10 +104,10 @@ def mail(recipient=None, message=None, subject=None, cert=None, encrypt=False,
|
|||
|
||||
msg_content = [
|
||||
"To: {}".format(recipient),
|
||||
'From: "{} <{}>'.format(from_name, from_address),
|
||||
'From: {} <{}>'.format(from_name, from_address),
|
||||
"Subject: {}".format(subject),
|
||||
"",
|
||||
"{}".format(message)
|
||||
"{}".format(message.encode('utf8'))
|
||||
]
|
||||
|
||||
with open(cert, 'rb') as pem:
|
||||
|
@ -118,10 +119,10 @@ def mail(recipient=None, message=None, subject=None, cert=None, encrypt=False,
|
|||
msg = EmailMessage()
|
||||
|
||||
msg['Subject'] = "{}".format(subject)
|
||||
msg['From'] = '"{} <{}>'.format(from_name, from_address),
|
||||
msg['From'] = '{} <{}>'.format(from_name, from_address),
|
||||
msg['To'] = recipient
|
||||
|
||||
msg.set_payload(message)
|
||||
msg.set_payload(message.encode('utf8'))
|
||||
msg_to_send = msg.as_bytes()
|
||||
|
||||
# send message via e-Mail
|
||||
|
|
|
@ -165,27 +165,38 @@ do
|
|||
recheckBlitzTUI=$(($counter % 30))
|
||||
if [ "${touchscreen}" == "1" ] && [ ${recheckBlitzTUI} -eq 1 ]; then
|
||||
echo "BlitzTUI Monitoring Check"
|
||||
if [ -d "/var/cache/raspiblitz" ]; then
|
||||
|
||||
# prevent restart if COPY OVER LAN is running
|
||||
# see: https://github.com/rootzoll/raspiblitz/issues/1179#issuecomment-646079467
|
||||
source ${infoFile}
|
||||
if [ "${state}" == "copysource" ]; then
|
||||
echo "- skip BlitzTUI check while COPY over LAN is running"
|
||||
else
|
||||
|
||||
if [ -d "/var/cache/raspiblitz" ]; then
|
||||
latestHeartBeatLine=$(sudo tail -n 300 /var/cache/raspiblitz/pi/blitz-tui.log | grep beat | tail -n 1)
|
||||
else
|
||||
else
|
||||
latestHeartBeatLine=$(sudo tail -n 300 /home/pi/blitz-tui.log | grep beat | tail -n 1)
|
||||
fi
|
||||
if [ ${#blitzTUIHeartBeatLine} -gt 0 ]; then
|
||||
#echo "blitzTUIHeartBeatLine(${blitzTUIHeartBeatLine})"
|
||||
#echo "latestHeartBeatLine(${latestHeartBeatLine})"
|
||||
if [ "${blitzTUIHeartBeatLine}" == "${latestHeartBeatLine}" ]; then
|
||||
echo "FAIL - still no new heart beat .. restarting BlitzTUI"
|
||||
blitzTUIRestarts=$(($blitzTUIRestarts +1))
|
||||
if [ $(sudo cat /home/admin/raspiblitz.info | grep -c 'blitzTUIRestarts=') -eq 0 ]; then
|
||||
echo "blitzTUIRestarts=0" >> /home/admin/raspiblitz.info
|
||||
fi
|
||||
sudo sed -i "s/^blitzTUIRestarts=.*/blitzTUIRestarts=${blitzTUIRestarts}/g" /home/admin/raspiblitz.info
|
||||
sudo init 3 ; sleep 2 ; sudo init 5
|
||||
fi
|
||||
else
|
||||
echo "blitzTUIHeartBeatLine is empty - skipping check"
|
||||
if [ ${#blitzTUIHeartBeatLine} -gt 0 ]; then
|
||||
#echo "blitzTUIHeartBeatLine(${blitzTUIHeartBeatLine})"
|
||||
#echo "latestHeartBeatLine(${latestHeartBeatLine})"
|
||||
if [ "${blitzTUIHeartBeatLine}" == "${latestHeartBeatLine}" ]; then
|
||||
echo "FAIL - still no new heart beat .. restarting BlitzTUI"
|
||||
blitzTUIRestarts=$(($blitzTUIRestarts +1))
|
||||
if [ $(sudo cat /home/admin/raspiblitz.info | grep -c 'blitzTUIRestarts=') -eq 0 ]; then
|
||||
echo "blitzTUIRestarts=0" >> /home/admin/raspiblitz.info
|
||||
fi
|
||||
sudo sed -i "s/^blitzTUIRestarts=.*/blitzTUIRestarts=${blitzTUIRestarts}/g" /home/admin/raspiblitz.info
|
||||
sudo init 3 ; sleep 2 ; sudo init 5
|
||||
fi
|
||||
else
|
||||
echo "blitzTUIHeartBeatLine is empty - skipping check"
|
||||
fi
|
||||
blitzTUIHeartBeatLine="${latestHeartBeatLine}"
|
||||
|
||||
fi
|
||||
blitzTUIHeartBeatLine="${latestHeartBeatLine}"
|
||||
|
||||
fi
|
||||
|
||||
###############################
|
||||
|
|
|
@ -41,6 +41,13 @@ function debug() {
|
|||
./XXdebugLogs.sh
|
||||
}
|
||||
|
||||
# command: patch
|
||||
# syncs script with latest set github and branch
|
||||
function patch() {
|
||||
cd /home/admin
|
||||
./XXsyncScripts.sh -run
|
||||
}
|
||||
|
||||
# command: restart
|
||||
function restart() {
|
||||
cd /home/admin
|
||||
|
|
|
@ -33,7 +33,11 @@ if ! grep -Eq "^notifyMailTo=.*" /mnt/hdd/raspiblitz.conf; then
|
|||
fi
|
||||
|
||||
if ! grep -Eq "^notifyMailServer=.*" /mnt/hdd/raspiblitz.conf; then
|
||||
echo "notifyMailServer=mail@example.com" | sudo tee -a /mnt/hdd/raspiblitz.conf >/dev/null
|
||||
echo "notifyMailServer=mail.example.com" | sudo tee -a /mnt/hdd/raspiblitz.conf >/dev/null
|
||||
fi
|
||||
|
||||
if ! grep -Eq "^notifyMailHostname=.*" /mnt/hdd/raspiblitz.conf; then
|
||||
echo "notifyMailHostname=$(hostname)" | sudo tee -a /mnt/hdd/raspiblitz.conf >/dev/null
|
||||
fi
|
||||
|
||||
if ! grep -Eq "^notifyMailUser=.*" /mnt/hdd/raspiblitz.conf; then
|
||||
|
@ -81,16 +85,17 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
|||
#
|
||||
# The person who gets all mail for userids < 1000
|
||||
# Make this empty to disable rewriting.
|
||||
root=${notifyMailTo}
|
||||
Root=${notifyMailTo}
|
||||
|
||||
# hostname of this system
|
||||
hostname=${hostname}
|
||||
Hostname=${notifyMailHostname}
|
||||
|
||||
# relay/smarthost server settings
|
||||
mailhub=${notifyMailServer}
|
||||
Mailhub=${notifyMailServer}
|
||||
AuthUser=${notifyMailUser}
|
||||
AuthPass=${notifyMailPass}
|
||||
UseSTARTTLS=YES
|
||||
FromLineOverride=YES
|
||||
EOF
|
||||
|
||||
# edit raspi blitz config
|
||||
|
@ -134,14 +139,14 @@ if [ "$1" = "send" ]; then
|
|||
/home/admin/python3-env-lnd/bin/python3 /home/admin/XXsendNotification.py ext ${notifyExtCmd} "$2"
|
||||
elif [ "${notifyMethod}" = "mail" ]; then
|
||||
if [ "${notifyMailEncrypt}" = "on" ]; then
|
||||
/home/admin/python3-env-lnd/bin/python3 /home/admin/XXsendNotification.py mail --cert ${notifyMailToCert} --encrypt ${notifyMailTo} "$2"
|
||||
/home/admin/python3-env-lnd/bin/python3 /home/admin/XXsendNotification.py mail "${@:3}" --cert ${notifyMailToCert} --encrypt ${notifyMailTo} "$2"
|
||||
else
|
||||
/home/admin/python3-env-lnd/bin/python3 /home/admin/XXsendNotification.py mail ${notifyMailTo} "$2"
|
||||
/home/admin/python3-env-lnd/bin/python3 /home/admin/XXsendNotification.py mail "${@:3}" ${notifyMailTo} "$2"
|
||||
fi
|
||||
elif [ "${notifyMethod}" = "slack" ]; then
|
||||
/home/admin/python3-env-lnd/bin/python3 /home/admin/XXsendNotification.py slack -h "$2"
|
||||
else
|
||||
echo "unknown notification method - check /mnt/hdd/raspiblitz.con"
|
||||
echo "unknown notification method - check /mnt/hdd/raspiblitz.conf"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -5,7 +5,7 @@ if [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
|||
echo "small config script to set a passwords A,B,C & D"
|
||||
echo "blitz.setpassword.sh [?a|b|c|d] [?newpassword] "
|
||||
echo "or just as a password enter dialog (result as file)"
|
||||
echo "blitz.setpassword.sh [x] [text] [result-file]"
|
||||
echo "blitz.setpassword.sh [x] [text] [result-file] [?empty-allowed]"
|
||||
echo "exits on 0 = needs reboot"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -317,35 +317,42 @@ elif [ "${abcd}" = "x" ]; then
|
|||
password1=$(whiptail --passwordbox "\n${text}:\n(min 8chars, 1word, chars+number, no specials)" 10 52 "" --backtitle "RaspiBlitz" 3>&1 1>&2 2>&3)
|
||||
|
||||
# ask user for new password A (second time)
|
||||
password2=$(whiptail --passwordbox "\nRe-Enter the Password:\n(to test if typed in correctly)" 10 52 "" --backtitle "RaspiBlitz" 3>&1 1>&2 2>&3)
|
||||
password2=""
|
||||
if [ ${#password1} -gt 0 ]; then
|
||||
password2=$(whiptail --passwordbox "\nRe-Enter the Password:\n(to test if typed in correctly)" 10 52 "" --backtitle "RaspiBlitz" 3>&1 1>&2 2>&3)
|
||||
fi
|
||||
|
||||
# check if passwords match
|
||||
if [ "${password1}" != "${password2}" ]; then
|
||||
dialog --backtitle "RaspiBlitz" --msgbox "FAIL -> Passwords dont Match\nPlease try again ..." 6 52
|
||||
sudo /home/admin/config.scripts/blitz.setpassword.sh x "$2" "$3"
|
||||
sudo /home/admin/config.scripts/blitz.setpassword.sh x "$2" "$3" "$4"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# password zero
|
||||
if [ ${#password1} -eq 0 ]; then
|
||||
dialog --backtitle "RaspiBlitz" --msgbox "FAIL -> Password cannot be empty\nPlease try again ..." 6 52
|
||||
sudo /home/admin/config.scripts/blitz.setpassword.sh x "$2" "$3"
|
||||
exit 1
|
||||
fi
|
||||
if [ "$4" != "empty-allowed" ]; then
|
||||
|
||||
# check that password does not contain bad characters
|
||||
clearedResult=$(echo "${password1}" | tr -dc '[:alnum:]-.' | tr -d ' ')
|
||||
if [ ${#clearedResult} != ${#password1} ] || [ ${#clearedResult} -eq 0 ]; then
|
||||
dialog --backtitle "RaspiBlitz" --msgbox "FAIL -> Contains bad characters (spaces, special chars)\nPlease try again ..." 6 52
|
||||
sudo /home/admin/config.scripts/blitz.setpassword.sh x "$2" "$3"
|
||||
exit 1
|
||||
fi
|
||||
# password zero
|
||||
if [ ${#password1} -eq 0 ]; then
|
||||
dialog --backtitle "RaspiBlitz" --msgbox "FAIL -> Password cannot be empty\nPlease try again ..." 6 52
|
||||
sudo /home/admin/config.scripts/blitz.setpassword.sh x "$2" "$3" "$4"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# check that password does not contain bad characters
|
||||
clearedResult=$(echo "${password1}" | tr -dc '[:alnum:]-.' | tr -d ' ')
|
||||
if [ ${#clearedResult} != ${#password1} ] || [ ${#clearedResult} -eq 0 ]; then
|
||||
dialog --backtitle "RaspiBlitz" --msgbox "FAIL -> Contains bad characters (spaces, special chars)\nPlease try again ..." 6 62
|
||||
sudo /home/admin/config.scripts/blitz.setpassword.sh x "$2" "$3" "$4"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# password longer than 8
|
||||
if [ ${#password1} -lt 8 ]; then
|
||||
dialog --backtitle "RaspiBlitz" --msgbox "FAIL -> Password length under 8\nPlease try again ..." 6 52
|
||||
sudo /home/admin/config.scripts/blitz.setpassword.sh x "$2" "$3" "$4"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# password longer than 8
|
||||
if [ ${#password1} -lt 8 ]; then
|
||||
dialog --backtitle "RaspiBlitz" --msgbox "FAIL -> Password length under 8\nPlease try again ..." 6 52
|
||||
sudo /home/admin/config.scripts/blitz.setpassword.sh x "$2" "$3"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# store result is file
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
# command info
|
||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||
echo "small config script to switch BTC-RPC-explorer on or off"
|
||||
echo "bonus.btc-rpc-explorer.sh [status|on|off]"
|
||||
echo "# small config script to switch BTC-RPC-explorer on or off"
|
||||
echo "# bonus.btc-rpc-explorer.sh [status|on|off]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -21,10 +21,10 @@ if [ "$1" = "menu" ]; then
|
|||
source <(sudo /home/admin/config.scripts/bonus.btc-rpc-explorer.sh status)
|
||||
|
||||
# check if index is ready
|
||||
if [ ${isIndexed} -eq 0 ]; then
|
||||
if [ "${isIndexed}" == "0" ]; then
|
||||
dialog --title " Blockchain Index Not Ready " --msgbox "
|
||||
The Blockchain Index is still getting build.
|
||||
Please wait and try again later.
|
||||
${indexInfo}
|
||||
This can take multiple hours.
|
||||
" 9 48
|
||||
exit 0
|
||||
|
@ -33,26 +33,31 @@ This can take multiple hours.
|
|||
# get network info
|
||||
localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||
toraddress=$(sudo cat /mnt/hdd/tor/btc-rpc-explorer/hostname 2>/dev/null)
|
||||
fingerprint=$(openssl x509 -in /mnt/hdd/app-data/nginx/tls.cert -fingerprint -noout | cut -d"=" -f2)
|
||||
|
||||
if [ "${runBehindTor}" = "on" ] && [ ${#toraddress} -gt 0 ]; then
|
||||
|
||||
# TOR
|
||||
/home/admin/config.scripts/blitz.lcd.sh qr "${toraddress}"
|
||||
whiptail --title " BTC-RPC-Explorer " --msgbox "Open the following URL in your local web browser:
|
||||
https://${localip}:3021
|
||||
https://${localip}:3021\n
|
||||
SHA1 Thumb/Fingerprint:
|
||||
${fingerprint}\n
|
||||
Login is 'admin' with your Password B\n
|
||||
Hidden Service address for TOR Browser (QR see LCD):
|
||||
${toraddress}
|
||||
" 12 67
|
||||
" 16 67
|
||||
/home/admin/config.scripts/blitz.lcd.sh hide
|
||||
else
|
||||
|
||||
# IP + Domain
|
||||
whiptail --title " BTC-RPC-Explorer " --msgbox "Open the following URL in your local web browser:
|
||||
https://${localip}:3021
|
||||
https://${localip}:3021\n
|
||||
SHA1 Thumb/Fingerprint:
|
||||
${fingerprint}\n
|
||||
Login is 'admin' with your Password B\n
|
||||
Activate TOR to access the web block explorer from outside your local network.
|
||||
" 12 54
|
||||
" 16 54
|
||||
fi
|
||||
|
||||
echo "please wait ..."
|
||||
|
@ -89,12 +94,12 @@ if [ "$1" = "status" ]; then
|
|||
fi
|
||||
|
||||
# stop service
|
||||
echo "making sure services are not running"
|
||||
echo "# making sure services are not running"
|
||||
sudo systemctl stop btc-rpc-explorer 2>/dev/null
|
||||
|
||||
# switch on
|
||||
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
echo "*** INSTALL BTC-RPC-EXPLORER ***"
|
||||
echo "# *** INSTALL BTC-RPC-EXPLORER ***"
|
||||
|
||||
isInstalled=$(sudo ls /etc/systemd/system/btc-rpc-explorer.service 2>/dev/null | grep -c 'btc-rpc-explorer.service')
|
||||
if [ ${isInstalled} -eq 0 ]; then
|
||||
|
@ -116,7 +121,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
|||
sudo -u btcrpcexplorer npm install
|
||||
|
||||
# prepare .env file
|
||||
echo "getting RPC credentials from the ${network}.conf"
|
||||
echo "# getting RPC credentials from the ${network}.conf"
|
||||
|
||||
RPC_USER=$(sudo cat /mnt/hdd/${network}/${network}.conf | grep rpcuser | cut -c 9-)
|
||||
PASSWORD_B=$(sudo cat /mnt/hdd/${network}/${network}.conf | grep rpcpassword | cut -c 13-)
|
||||
|
@ -155,7 +160,7 @@ EOF
|
|||
sudo chown btcrpcexplorer:btcrpcexplorer /home/btcrpcexplorer/.config/btc-rpc-explorer.env
|
||||
|
||||
# open firewall
|
||||
echo "*** Updating Firewall ***"
|
||||
echo "# *** Updating Firewall ***"
|
||||
sudo ufw allow 3020 comment 'btc-rpc-explorer HTTP'
|
||||
sudo ufw allow 3021 comment 'btc-rpc-explorer HTTPS'
|
||||
echo ""
|
||||
|
@ -205,17 +210,17 @@ EOF
|
|||
|
||||
sudo mv /home/admin/btc-rpc-explorer.service /etc/systemd/system/btc-rpc-explorer.service
|
||||
sudo systemctl enable btc-rpc-explorer
|
||||
echo "OK - the BTC-RPC-explorer service is now enabled"
|
||||
echo "# OK - the BTC-RPC-explorer service is now enabled"
|
||||
|
||||
else
|
||||
echo "BTC-RPC-explorer already installed."
|
||||
echo "# BTC-RPC-explorer already installed."
|
||||
fi
|
||||
|
||||
# setting value in raspi blitz config
|
||||
sudo sed -i "s/^BTCRPCexplorer=.*/BTCRPCexplorer=on/g" /mnt/hdd/raspiblitz.conf
|
||||
|
||||
echo "needs to finish creating txindex to be functional"
|
||||
echo "monitor with: sudo tail -n 20 -f /mnt/hdd/bitcoin/debug.log"
|
||||
echo "# needs to finish creating txindex to be functional"
|
||||
echo "# monitor with: sudo tail -n 20 -f /mnt/hdd/bitcoin/debug.log"
|
||||
|
||||
## Enable BTCEXP_ADDRESS_API if BTC-RPC-Explorer is active
|
||||
# see /home/admin/config.scripts/bonus.electrsexplorer.sh
|
||||
|
@ -224,8 +229,7 @@ EOF
|
|||
# Hidden Service for BTC-RPC-explorer if Tor is active
|
||||
source /mnt/hdd/raspiblitz.conf
|
||||
if [ "${runBehindTor}" = "on" ]; then
|
||||
# correct old Hidden Service with port
|
||||
sudo sed -i "s/^HiddenServicePort 80 127.0.0.1:3002/HiddenServicePort 80 127.0.0.1:3022/g" /etc/tor/torrc
|
||||
echo "# Creating Tor Hidden Service"
|
||||
/home/admin/config.scripts/internet.hiddenservice.sh btc-rpc-explorer 80 3022 443 3023
|
||||
fi
|
||||
exit 0
|
||||
|
@ -239,7 +243,7 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
|||
|
||||
isInstalled=$(sudo ls /etc/systemd/system/btc-rpc-explorer.service 2>/dev/null | grep -c 'btc-rpc-explorer.service')
|
||||
if [ ${isInstalled} -eq 1 ]; then
|
||||
echo "*** REMOVING BTC-RPC-explorer ***"
|
||||
echo "# *** REMOVING BTC-RPC-explorer ***"
|
||||
sudo systemctl disable btc-rpc-explorer
|
||||
sudo rm /etc/systemd/system/btc-rpc-explorer.service
|
||||
# delete user and home directory
|
||||
|
@ -255,10 +259,10 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
|||
sudo nginx -t
|
||||
sudo systemctl reload nginx
|
||||
|
||||
echo "OK BTC-RPC-explorer removed."
|
||||
echo "# OK BTC-RPC-explorer removed."
|
||||
|
||||
else
|
||||
echo "BTC-RPC-explorer is not installed."
|
||||
echo "# BTC-RPC-explorer is not installed."
|
||||
fi
|
||||
|
||||
# close ports on firewall
|
||||
|
@ -267,5 +271,5 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
echo "FAIL - Unknown Parameter $1"
|
||||
echo "error='unknown parameter'
|
||||
exit 1
|
||||
|
|
|
@ -1,373 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
source /mnt/hdd/raspiblitz.conf
|
||||
|
||||
# script to set up nginx and the SSL certificate for BTCPay Server
|
||||
# calls the config.scripts/internet.hiddenservice.sh for the Tor connection
|
||||
|
||||
HEIGHT=20
|
||||
WIDTH=73
|
||||
CHOICE_HEIGHT=2
|
||||
BACKTITLE="RaspiBlitz"
|
||||
TITLE="BTCPay Server Install"
|
||||
MENU="Choose 'TOR' if you want to set up BTCPayServer
|
||||
as a Tor Hidden service and use a self signed SSL certificate.\n\n
|
||||
Choose 'DOMAIN' if you want to use a Domain Name or dynamicDNS
|
||||
pointing to your public IP. You will need to forward ports from your
|
||||
router to your RaspiBlitz and an email address to be used for
|
||||
communication about the SSL certificate (very experimental).\n\n
|
||||
For details or troubleshoot check for 'BTCPay'
|
||||
in README of https://github.com/rootzoll/raspiblitz"
|
||||
OPTIONS=(TOR "Tor access and a self-signed certificate"\
|
||||
DOMAIN "(Dynamic) Domain Name (experimental)")
|
||||
|
||||
CHOICE=$(dialog --clear \
|
||||
--backtitle "$BACKTITLE" \
|
||||
--title "$TITLE" \
|
||||
--menu "$MENU" \
|
||||
$HEIGHT $WIDTH $CHOICE_HEIGHT \
|
||||
"${OPTIONS[@]}" \
|
||||
2>&1 >/dev/tty)
|
||||
|
||||
dialogcancel=$?
|
||||
echo "done dialog"
|
||||
clear
|
||||
|
||||
# check if user canceled dialog
|
||||
echo "dialogcancel(${dialogcancel})"
|
||||
if [ ${dialogcancel} -eq 1 ]; then
|
||||
echo "user cancelled"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
clear
|
||||
case $CHOICE in
|
||||
|
||||
DOMAIN)
|
||||
echo "setting up with own domain"
|
||||
ownDomain=1
|
||||
;;
|
||||
TOR)
|
||||
echo "setting up for Tor only"
|
||||
if [ "${runBehindTor}" != "on" ]; then
|
||||
whiptail --title " TOR needs be installed first " --msgbox "\
|
||||
Please activate TOR service first to use this option.
|
||||
Use 'Run behind TOR' in the SERVICES submenu.
|
||||
Once TOR is running, choose this option again.
|
||||
" 9 58
|
||||
exit 1
|
||||
fi
|
||||
ownDomain=0
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ ${#ownDomain} -eq 0 ]; then
|
||||
echo "user cancelled"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# add default value to raspi config if needed
|
||||
if ! grep -Eq "^BTCPayDomain=" /mnt/hdd/raspiblitz.conf; then
|
||||
echo "BTCPayDomain=off" >> /mnt/hdd/raspiblitz.conf
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "***"
|
||||
echo "Setting up Nginx and Certbot"
|
||||
echo "***"
|
||||
echo ""
|
||||
|
||||
if [ $ownDomain -eq 1 ]; then
|
||||
localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||
echo ""
|
||||
echo "***"
|
||||
echo "Confirm that the ports 80, 443 and 9735 are forwarded to your RaspiBlitz"
|
||||
echo ""
|
||||
echo "Press [ENTER] to continue or use [CTRL + C] to exit"
|
||||
echo ""
|
||||
echo "Example settings for your router:"
|
||||
echo "forward the port 443 to port 443 on ${localip}"
|
||||
echo "forward the port 9735 to port 9735 on ${localip}"
|
||||
echo "forward the port 80 to port 80 on ${localip}"
|
||||
read key
|
||||
|
||||
echo ""
|
||||
echo "***"
|
||||
echo "Type your domain or dynamicDNS pointing to your public IP and press [ENTER] or use [CTRL + C] to exit"
|
||||
echo ""
|
||||
echo "Example:"
|
||||
echo "btcpay.example.com"
|
||||
read YOUR_DOMAIN
|
||||
|
||||
echo ""
|
||||
echo "***"
|
||||
echo "Type an email address that will be used to message about the expiration of the SSL certificate and press [ENTER] or use [CTRL + C] to exit"
|
||||
echo ""
|
||||
echo "Example:"
|
||||
echo "name@email.com"
|
||||
read YOUR_EMAIL
|
||||
|
||||
echo ""
|
||||
echo "***"
|
||||
echo "Creating the btcpay user"
|
||||
echo "***"
|
||||
echo ""
|
||||
|
||||
# install nginx and certbot
|
||||
sudo apt-get install nginx-full certbot -y
|
||||
|
||||
sudo ufw allow 80 comment 'HTTP web server'
|
||||
sudo ufw allow 443 comment 'btcpayserver SSL'
|
||||
|
||||
# get SSL cert
|
||||
sudo systemctl stop certbot 2>/dev/null
|
||||
sudo certbot certonly -a standalone -m $YOUR_EMAIL --agree-tos -d $YOUR_DOMAIN -n --pre-hook "service nginx stop" --post-hook "service nginx start"
|
||||
|
||||
# set nginx
|
||||
sudo rm -f /etc/nginx/sites-enabled/default
|
||||
sudo rm -f /etc/nginx/sites-enabled/btcpayserver
|
||||
sudo rm -f /etc/nginx/sites-available/btcpayserver
|
||||
|
||||
echo "
|
||||
# If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the
|
||||
# scheme used to connect to this server
|
||||
map \$http_x_forwarded_proto \$proxy_x_forwarded_proto {
|
||||
default \$http_x_forwarded_proto;
|
||||
'' \$scheme;
|
||||
}
|
||||
# If we receive X-Forwarded-Port, pass it through; otherwise, pass along the
|
||||
# server port the client connected to
|
||||
map \$http_x_forwarded_port \$proxy_x_forwarded_port {
|
||||
default \$http_x_forwarded_port;
|
||||
'' \$server_port;
|
||||
}
|
||||
# If we receive Upgrade, set Connection to \"upgrade\"; otherwise, delete any
|
||||
# Connection header that may have been passed to this server
|
||||
map \$http_upgrade \$proxy_connection {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
# Apply fix for very long server names
|
||||
#server_names_hash_bucket_size 128;
|
||||
# Prevent Nginx Information Disclosure
|
||||
server_tokens off;
|
||||
# Default dhparam
|
||||
# Set appropriate X-Forwarded-Ssl header
|
||||
map \$scheme \$proxy_x_forwarded_ssl {
|
||||
default off;
|
||||
https on;
|
||||
}
|
||||
|
||||
gzip_types text/plain text/css application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
log_format vhost '\$host \$remote_addr - \$remote_user [\$time_local] '
|
||||
'\"\$request\" \$status \$body_bytes_sent '
|
||||
'\"\$http_referer\" \"\$http_user_agent\"';
|
||||
access_log off;
|
||||
# HTTP 1.1 support
|
||||
proxy_http_version 1.1;
|
||||
proxy_buffering off;
|
||||
proxy_set_header Host \$http_host;
|
||||
proxy_set_header Upgrade \$http_upgrade;
|
||||
proxy_set_header Connection \$proxy_connection;
|
||||
proxy_set_header X-Real-IP \$remote_addr;
|
||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto \$proxy_x_forwarded_proto;
|
||||
proxy_set_header X-Forwarded-Ssl \$proxy_x_forwarded_ssl;
|
||||
proxy_set_header X-Forwarded-Port \$proxy_x_forwarded_port;
|
||||
# Mitigate httpoxy attack (see README for details)
|
||||
proxy_set_header Proxy \"\";
|
||||
|
||||
|
||||
server {
|
||||
listen 80 default_server;
|
||||
server_name _;
|
||||
return 301 https://\$host\$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name $YOUR_DOMAIN;
|
||||
ssl on;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/$YOUR_DOMAIN/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/$YOUR_DOMAIN/privkey.pem;
|
||||
ssl_session_timeout 1d;
|
||||
ssl_session_cache shared:SSL:50m;
|
||||
ssl_session_tickets off;
|
||||
ssl_protocols TLSv1.1 TLSv1.2;
|
||||
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK';
|
||||
ssl_prefer_server_ciphers on;
|
||||
ssl_stapling on;
|
||||
ssl_stapling_verify on;
|
||||
ssl_trusted_certificate /etc/letsencrypt/live/$YOUR_DOMAIN/chain.pem;
|
||||
|
||||
location / {
|
||||
proxy_set_header Host \$host;
|
||||
proxy_set_header X-Real-IP \$remote_addr;
|
||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto \$scheme;
|
||||
proxy_pass http://localhost:23000;
|
||||
}
|
||||
}
|
||||
" | sudo tee -a /etc/nginx/sites-available/btcpayserver
|
||||
|
||||
sudo ln -s /etc/nginx/sites-available/btcpayserver /etc/nginx/sites-enabled/ 2>/dev/null
|
||||
|
||||
sudo systemctl restart nginx
|
||||
|
||||
echo ""
|
||||
echo "***"
|
||||
echo "Setting up certbot-auto renewal service"
|
||||
echo "***"
|
||||
echo ""
|
||||
|
||||
sudo rm -f /etc/systemd/system/certbot.timer
|
||||
echo "
|
||||
[Unit]
|
||||
Description=Certbot-auto renewal service
|
||||
|
||||
[Timer]
|
||||
OnBootSec=20min
|
||||
OnCalendar=*-*-* 4:00:00
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
" | sudo tee -a /etc/systemd/system/certbot.timer
|
||||
|
||||
sudo rm -f /etc/systemd/system/certbot.service
|
||||
echo "
|
||||
[Unit]
|
||||
Description=Certbot-auto renewal service
|
||||
After=bitcoind.service
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/home/admin/
|
||||
ExecStart=sudo certbot renew --pre-hook \"service nginx stop\" --post-hook \"service nginx start\"
|
||||
|
||||
User=admin
|
||||
Group=admin
|
||||
Type=simple
|
||||
KillMode=process
|
||||
TimeoutSec=60
|
||||
Restart=always
|
||||
RestartSec=60
|
||||
" | sudo tee -a /etc/systemd/system/certbot.service
|
||||
|
||||
sudo systemctl enable certbot.timer
|
||||
|
||||
elif [ $ownDomain -eq 0 ]; then
|
||||
YOUR_DOMAIN=localhost
|
||||
|
||||
# disable certbot
|
||||
sudo systemctl stop certbot.timer 2>/dev/null
|
||||
sudo systemctl disable certbot.timer 2>/dev/null
|
||||
sudo systemctl stop certbot 2>/dev/null
|
||||
sudo systemctl disable certbot 2>/dev/null
|
||||
|
||||
# create a self-signed ssl certificate
|
||||
/home/admin/config.scripts/internet.selfsignedcert.sh
|
||||
|
||||
# allow the HTTPS connection through the firewall
|
||||
sudo ufw allow 443 comment 'Nginx'
|
||||
|
||||
# set nginx
|
||||
sudo rm -f /etc/nginx/sites-enabled/default
|
||||
sudo rm -f /etc/nginx/sites-enabled/btcpayserver
|
||||
sudo rm -f /etc/nginx/sites-available/btcpayserver
|
||||
|
||||
echo "
|
||||
# If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the
|
||||
# scheme used to connect to this server
|
||||
map \$http_x_forwarded_proto \$proxy_x_forwarded_proto {
|
||||
default \$http_x_forwarded_proto;
|
||||
'' \$scheme;
|
||||
}
|
||||
# If we receive X-Forwarded-Port, pass it through; otherwise, pass along the
|
||||
# server port the client connected to
|
||||
map \$http_x_forwarded_port \$proxy_x_forwarded_port {
|
||||
default \$http_x_forwarded_port;
|
||||
'' \$server_port;
|
||||
}
|
||||
# If we receive Upgrade, set Connection to \"upgrade\"; otherwise, delete any
|
||||
# Connection header that may have been passed to this server
|
||||
map \$http_upgrade \$proxy_connection {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
# Apply fix for very long server names
|
||||
#server_names_hash_bucket_size 128;
|
||||
# Prevent Nginx Information Disclosure
|
||||
server_tokens off;
|
||||
# Default dhparam
|
||||
# Set appropriate X-Forwarded-Ssl header
|
||||
map \$scheme \$proxy_x_forwarded_ssl {
|
||||
default off;
|
||||
https on;
|
||||
}
|
||||
|
||||
gzip_types text/plain text/css application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
log_format vhost '\$host \$remote_addr - \$remote_user [\$time_local] '
|
||||
'\"\$request\" \$status \$body_bytes_sent '
|
||||
'\"\$http_referer\" \"\$http_user_agent\"';
|
||||
access_log off;
|
||||
# HTTP 1.1 support
|
||||
proxy_http_version 1.1;
|
||||
proxy_buffering off;
|
||||
proxy_set_header Host \$http_host;
|
||||
proxy_set_header Upgrade \$http_upgrade;
|
||||
proxy_set_header Connection \$proxy_connection;
|
||||
proxy_set_header X-Real-IP \$remote_addr;
|
||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto \$proxy_x_forwarded_proto;
|
||||
proxy_set_header X-Forwarded-Ssl \$proxy_x_forwarded_ssl;
|
||||
proxy_set_header X-Forwarded-Port \$proxy_x_forwarded_port;
|
||||
# Mitigate httpoxy attack (see README for details)
|
||||
proxy_set_header Proxy \"\";
|
||||
|
||||
|
||||
server {
|
||||
listen 23001 default_server;
|
||||
server_name _;
|
||||
return 301 https://\$host\$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name $YOUR_DOMAIN;
|
||||
ssl on;
|
||||
|
||||
ssl_certificate /etc/ssl/certs/localhost.crt;
|
||||
ssl_certificate_key /etc/ssl/private/localhost.key;
|
||||
ssl_session_timeout 1d;
|
||||
ssl_session_cache shared:SSL:50m;
|
||||
ssl_session_tickets off;
|
||||
ssl_protocols TLSv1.1 TLSv1.2;
|
||||
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK';
|
||||
ssl_prefer_server_ciphers on;
|
||||
ssl_stapling off;
|
||||
ssl_stapling_verify on;
|
||||
|
||||
location / {
|
||||
proxy_set_header Host \$host;
|
||||
proxy_set_header X-Real-IP \$remote_addr;
|
||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto \$scheme;
|
||||
proxy_pass http://localhost:23000;
|
||||
}
|
||||
}
|
||||
" | sudo tee -a /etc/nginx/sites-available/btcpayserver
|
||||
|
||||
sudo ln -s /etc/nginx/sites-available/btcpayserver /etc/nginx/sites-enabled/ 2>/dev/null
|
||||
|
||||
sudo systemctl restart nginx
|
||||
fi
|
||||
|
||||
# setting value in raspi blitz config
|
||||
sudo sed -i "s/^BTCPayDomain=.*/BTCPayDomain=$YOUR_DOMAIN/g" /mnt/hdd/raspiblitz.conf
|
||||
|
||||
if [ $ownDomain -eq 0 ]; then
|
||||
# Hidden Service for BTCPay if Tor active
|
||||
/home/admin/config.scripts/internet.hiddenservice.sh btcpay 80 23000
|
||||
fi
|
||||
|
||||
echo "OK done - check the new option 'BTCPAY' on main menu for more info."
|
|
@ -22,7 +22,8 @@ if [ "$1" = "menu" ]; then
|
|||
|
||||
# get network info
|
||||
localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||
toraddress=https://$(sudo cat /mnt/hdd/tor/cryptoadvance-specter/hostname 2>/dev/null)
|
||||
toraddress=$(sudo cat /mnt/hdd/tor/cryptoadvance-specter/hostname 2>/dev/null)
|
||||
fingerprint=$(openssl x509 -in /home/bitcoin/.specter/cert.pem -fingerprint -noout | cut -d"=" -f2)
|
||||
|
||||
if [ "${runBehindTor}" = "on" ] && [ ${#toraddress} -gt 0 ]; then
|
||||
|
||||
|
@ -31,23 +32,28 @@ if [ "$1" = "menu" ]; then
|
|||
whiptail --title " Cryptoadvance Specter " --msgbox "Open the following URL in your local web browser:
|
||||
https://${localip}:25441
|
||||
|
||||
You have to accept the self-signed-certificate.
|
||||
SHA1 Thumb/Fingerprint:
|
||||
${fingerprint}
|
||||
|
||||
Login with the Pin being Password B. If you have connected to a different Bitcoin RPC Endpoint, the Pin is the configured RPCPassword.
|
||||
|
||||
Hidden Service address for TOR Browser (QR see LCD):
|
||||
${toraddress}\n
|
||||
" 15 74
|
||||
https://${toraddress}\n
|
||||
" 17 74
|
||||
/home/admin/config.scripts/blitz.lcd.sh hide
|
||||
else
|
||||
|
||||
# IP + Domain
|
||||
whiptail --title " Cryptoadvance Specter " --msgbox "Open the following URL in your local web browser:
|
||||
https://${localip}:25441
|
||||
You have to accept the self-signed-certificate.
|
||||
|
||||
SHA1 Thumb/Fingerprint:
|
||||
${fingerprint}
|
||||
|
||||
Login with the Pin being Password B. If you have connected to a different Bitcoin RPC Endpoint, the Pin is the configured RPCPassword.\n
|
||||
Activate TOR to access the web block explorer from outside your local network.
|
||||
Unfortunately the camera is currently not usable via Tor, though.
|
||||
" 12 54
|
||||
" 15 54
|
||||
fi
|
||||
|
||||
echo "# please wait ..."
|
||||
|
@ -111,7 +117,7 @@ EOF
|
|||
|
||||
# Mandatory as the camera doesn't work without https
|
||||
echo "# --> Creating self-signed certificate"
|
||||
openssl req -x509 -newkey rsa:4096 -nodes -out /tmp/cert.pem -keyout /tmp/key.pem -days 365 -subj "/C=US/ST=Nooneknows/L=Springfield/O=Dis/CN=www.fakeurl.com"
|
||||
openssl req -x509 -newkey rsa:4096 -nodes -out /tmp/cert.pem -keyout /tmp/key.pem -days 365 -subj "/C=US/ST=Nooneknows/L=Springfield/O=Dis/CN=www.fakeurl.com"
|
||||
sudo mv /tmp/cert.pem /home/bitcoin/.specter
|
||||
sudo chown -R bitcoin:bitcoin /home/bitcoin/.specter/cert.pem
|
||||
sudo mv /tmp/key.pem /home/bitcoin/.specter
|
||||
|
|
|
@ -85,6 +85,11 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
|||
chown -R joinmarket:joinmarket /mnt/hdd/app-data/.joinmarket
|
||||
ln -s /mnt/hdd/app-data/.joinmarket /home/joinmarket/ 2>/dev/null
|
||||
chown -R joinmarket:joinmarket /home/joinmarket/.joinmarket
|
||||
# specify wallet.dat in old config for multiwallet for multiwallet support
|
||||
if [ -f "/home/joinmarket/.joinmarket/joinmarket.cfg" ] ; then
|
||||
sudo -u joinmarket sed -i "s/^rpc_wallet_file =.*/rpc_wallet_file = wallet.dat/g" /home/joinmarket/.joinmarket/joinmarket.cfg
|
||||
echo "Specified to use wallet.dat in the recovered joinmarket.cfg"
|
||||
fi
|
||||
|
||||
# install joinmarket
|
||||
cd /home/joinmarket
|
||||
|
@ -169,6 +174,8 @@ if [ ! -f "/home/joinmarket/.joinmarket/joinmarket.cfg" ] ; then
|
|||
PASSWORD_B=\$(sudo cat /mnt/hdd/bitcoin/bitcoin.conf | grep rpcpassword | cut -c 13-)
|
||||
sed -i "s/^rpc_password =.*/rpc_password = \$PASSWORD_B/g" /home/joinmarket/.joinmarket/joinmarket.cfg
|
||||
echo "Filled the bitcoin RPC password (PASSWORD_B)"
|
||||
sed -i "s/^rpc_wallet_file =.*/rpc_wallet_file = wallet.dat/g" /home/joinmarket/.joinmarket/joinmarket.cfg
|
||||
echo "Using the bitcoind wallet: wallet.dat"
|
||||
#communicate with IRC servers via Tor
|
||||
sed -i "s/^host = irc.darkscience.net/#host = irc.darkscience.net/g" /home/joinmarket/.joinmarket/joinmarket.cfg
|
||||
sed -i "s/^#host = darksci3bfoka7tw.onion/host = darksci3bfoka7tw.onion/g" /home/joinmarket/.joinmarket/joinmarket.cfg
|
||||
|
|
|
@ -28,22 +28,22 @@ if [ "$1" = "menu" ]; then
|
|||
# Info with TOR
|
||||
/home/admin/config.scripts/blitz.lcd.sh qr "${toraddress}"
|
||||
whiptail --title " Ride The Lightning (RTL) " --msgbox "Open the following URL in your local web browser:
|
||||
https://${localip}:3001
|
||||
https://${localip}:3001\n
|
||||
SHA1 Thumb/Fingerprint:
|
||||
${fingerprint}\n
|
||||
Use your Password B to login.\n
|
||||
Hidden Service address for TOR Browser (QRcode on LCD):\n${toraddress}
|
||||
" 15 67
|
||||
" 16 67
|
||||
/home/admin/config.scripts/blitz.lcd.sh hide
|
||||
else
|
||||
# Info without TOR
|
||||
whiptail --title " Ride The Lightning (RTL) " --msgbox "Open the following URL in your local web browser:
|
||||
https://${localip}:3001
|
||||
https://${localip}:3001\n
|
||||
SHA1 Thumb/Fingerprint:
|
||||
${fingerprint}\n
|
||||
Use your Password B to login.\n
|
||||
Activate TOR to access the web interface from outside your local network.
|
||||
" 14 57
|
||||
" 15 57
|
||||
fi
|
||||
echo "please wait ..."
|
||||
exit 0
|
||||
|
@ -214,7 +214,7 @@ EOF
|
|||
|
||||
# Hidden Service for RTL if Tor is active
|
||||
if [ "${runBehindTor}" = "on" ]; then
|
||||
# correct old Hidden Service with port
|
||||
echo "# Creating Tor Hidden Service"
|
||||
sudo sed -i "s/^HiddenServicePort 80 127.0.0.1:3000/HiddenServicePort 80 127.0.0.1:3002/g" /etc/tor/torrc
|
||||
/home/admin/config.scripts/internet.hiddenservice.sh RTL 80 3002 443 3003
|
||||
fi
|
||||
|
|
|
@ -28,22 +28,22 @@ if [ "$1" = "menu" ]; then
|
|||
# Info with TOR
|
||||
/home/admin/config.scripts/blitz.lcd.sh qr "${toraddress}"
|
||||
whiptail --title " ThunderHub " --msgbox "Open the following URL in your local web browser:
|
||||
https://${localip}:3011
|
||||
https://${localip}:3011\n
|
||||
SHA1 Thumb/Fingerprint:
|
||||
${fingerprint}\n
|
||||
Use your Password B to login.\n
|
||||
Hidden Service address for TOR Browser (see LCD for QR):\n${toraddress}
|
||||
" 15 67
|
||||
" 16 67
|
||||
/home/admin/config.scripts/blitz.lcd.sh hide
|
||||
else
|
||||
# Info without TOR
|
||||
whiptail --title " ThunderHub " --msgbox "Open the following URL in your local web browser:
|
||||
https://${localip}:3011
|
||||
https://${localip}:3011\n
|
||||
SHA1 Thumb/Fingerprint:
|
||||
${fingerprint}\n
|
||||
Use your Password B to login.\n
|
||||
Activate TOR to access the web interface from outside your local network.
|
||||
" 14 57
|
||||
" 15 57
|
||||
fi
|
||||
echo "please wait ..."
|
||||
exit 0
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# command info
|
||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||
echo "config script to switch txindex on or off"
|
||||
echo "network.txindex.sh [status|on|off]"
|
||||
echo "network.txindex.sh [status|on|off|delete]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -23,7 +23,6 @@ if [ "${chain}" = "test" ]; then
|
|||
pathAdd="/testnet3"
|
||||
fi
|
||||
|
||||
|
||||
###################
|
||||
# STATUS
|
||||
###################
|
||||
|
@ -48,7 +47,7 @@ if [ "$1" = "status" ]; then
|
|||
indexInfo="OK"
|
||||
else
|
||||
echo "isIndexed=0"
|
||||
if [ ${#indexedToBlock} -gt 0 ]; then
|
||||
if [ ${#indexedToBlock} -gt 0 ] && [ ${#blockchainHeight} -gt 0 ]; then
|
||||
progressPercent=$(printf %.2f $(echo "${indexedToBlock}/${blockchainHeight}*100" | bc -l))
|
||||
indexInfo="Indexing is at ${progressPercent}% (please wait)"
|
||||
else
|
||||
|
@ -65,6 +64,8 @@ fi
|
|||
# switch on
|
||||
###################
|
||||
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
|
||||
# check txindex (parsed and sourced from bitcoin network config above)
|
||||
if [ ${txindex} == 0 ]; then
|
||||
sudo sed -i "s/^txindex=.*/txindex=1/g" /mnt/hdd/${network}/${network}.conf
|
||||
echo "switching txindex=1 and restarting ${network}d"
|
||||
|
|
|
@ -34,15 +34,27 @@ fi
|
|||
# switch on
|
||||
###################
|
||||
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
|
||||
if ! grep -Eq "^wallet=wallet.dat" /mnt/hdd/${network}/${network}.conf; then
|
||||
echo "Enable the multiwallet feature in ${network} core and specify wallet.dat"
|
||||
echo "wallet=wallet.dat" | sudo tee -a /mnt/hdd/${network}/${network}.conf >/dev/null
|
||||
restartService=1
|
||||
else
|
||||
echo "Multiwallet is active and wallet.dat is used."
|
||||
restartService=0
|
||||
fi
|
||||
if [ ${disablewallet} == 1 ]; then
|
||||
sudo sed -i "s/^disablewallet=.*/disablewallet=0/g" /mnt/hdd/${network}/${network}.conf
|
||||
echo "switching the ${network} core wallet on and restarting ${network}d"
|
||||
sudo systemctl restart ${network}d
|
||||
exit 0
|
||||
echo "Switching the ${network} core wallet on"
|
||||
restartService=1
|
||||
else
|
||||
echo "The ${network} core wallet is already on"
|
||||
exit 0
|
||||
fi
|
||||
if [ ${restartService} == 1 ]; then
|
||||
echo "Restarting ${network}d"
|
||||
sudo systemctl restart ${network}d
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue