diff --git a/FAQ.md b/FAQ.md index c8407aa07..7cc40b903 100644 --- a/FAQ.md +++ b/FAQ.md @@ -5,8 +5,8 @@ Beside many small improvements and changes, these are most important changes: - Update: LND version 0.9.2-beta (optional update to 0.10.0-beta) -- Update: bitcoin-core version 19.1-beta -- Update: Loop 0.5.1 +- Update: bitcoin-core version 0.19.1-beta +- Update: Loop 0.5.1 or 0.6.0 (based in LND version) - Update: RTL 0.7.0 (Loop In and Out integration) - Update: BTCPayServer v1.0.4.2 - Update: LNbits v0.1 [details](https://twitter.com/lnbits/status/1253700293440741377?s=20) @@ -17,7 +17,7 @@ Beside many small improvements and changes, these are most important changes: - New: Specter Desktop (connect DIY Specter-Wallet or ColdCard) [details](https://github.com/cryptoadvance/specter-desktop/blob/master/README.md) - New: JoinMarket [details](https://github.com/JoinMarket-Org/joinmarket-clientserver) - New: Activate 'Keysend' on LND by Service Menu [details](https://github.com/rootzoll/raspiblitz/issues/1000) -- New: SendMany App (wallet & chat over keysend) +- New: SendMany App (wallet & chat over keysend) [details](https://github.com/fusion44/sendmany/blob/master/README.md) - New: Reset SSH cert if SSH login not working [details](FAQ.md#how-can-i-repair-my-ssh-login) - New: Make it easier to Copy The Blockchain over Network from running Blitz - New: Forwarding Fee Report on Main Menu diff --git a/README.md b/README.md index d4600c6c0..25ee7de34 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ *Build your own Lightning Node on a RaspberryPi with a nice Display.* -`Version 1.5 with lnd 0.9.2-beta and bitcoin 0.19.1 or litecoin 0.17.1.` +`Version 1.5 with lnd 0.9.2-beta (0.10.0-beta optional) and bitcoin 0.19.1 or litecoin 0.17.1.` ![RaspiBlitz](pictures/raspiblitz.jpg) @@ -37,6 +37,7 @@ You can connect the following Wallet-Apps to your RaspiBlitz: * **Zeus** (Android & iOS-TestFlight) [details](https://zeusln.app) * **Shango** (Android & iOS-TestFlight) [details](https://github.com/neogeno/shango-lightning-wallet) * **Fully Noded** (iOS) [details](https://apps.apple.com/us/app/fully-noded/id1436425586) +* **SendMany** (Android) [details](https://github.com/fusion44/sendmany/blob/master/README.md) Also much more features like Touchscreen, Autopilot, DynDNS, SSH-Tunneling, UPS Support, ... @@ -48,15 +49,7 @@ If you start at home ordering the parts from Amazon (see shopping list below) th ## Hardware Needed -The RaspiBlitz is build from the following minimal parts: - -* RaspBerryPi 3B/4B -* 500GB USB HDD or SSD -* LCD-Display HAT -* 16GB Micro SD-Card -* Power supply >=3A (stable output is important) - -**All parts together are at around 150-200 USD - based on shops and location.** +All parts together are at around 150-250 USD - based on shops and location. ### Buy a ready-2-go RaspiBlitz (Germany, EU and International) @@ -64,56 +57,44 @@ If you like to support the RaspiBlitz project you can order a ready-2-go RaspiBl ### Amazon Shopping List (buy parts & build it yourself) -*Please try to use the exact hardware models that are recommended in the shopping lists, because we have multiple reports were for example other SSD or SSD cases/controllers lead to problems. The idea of the shopping lists is to provide you the best tested hardware components that work together - improvement recommendations are always welcome.* +The cheapest way is to buy and assemble the single parts yourself. There are two packages. -The cheapest way is to buy and assemble the single parts yourself. The new shopping list comes in three different packages: Minimal, Standard & Maximal: +*Please try to use the exact hardware models that are recommended in the shopping lists, because we have multiple reports were for example other SSD or SSD cases/controllers lead to problems. The idea of the shopping lists is to provide you the best tested hardware components that work together - improvement recommendations are always welcome.* #### Package: Standard (around 250 USD) *The "Standard Package" is most tested and recommended if you can effort it. It aims to give you the best economic value to run all the RaspiBlitz features at a good performance and even allows you to self-validate your blockchain in under 3 days.* -* RaspBerry Pi 4 2GB [amazon](https://geni.us/raspiblitz-4-2gb) +* RaspBerry Pi 4 2GB (or 4GB) [amazon](https://geni.us/raspiblitz-4-2gb) * RaspBerry Power Supply [amazon](https://geni.us/raspiblitz-ps) -* 500GB SSD: [amazon](https://geni.us/raspiblitz-500gb-ssd) +* 1TB SSD: [amazon](https://geni.us/raspiblitz-1000gb-san) * SSD-Case: [amazon](https://geni.us/raspiblitz-ssd-case) * Micro SD-Card 32GB: [amazon](https://geni.us/raspiblitz-sc-card) * LCD-Display: [amazon](https://geni.us/raspiblitz-touchscreen) * RaspberryPi Heatsink Case: [amazon](https://geni.us/heatsink-raspi4) +*You can even pay your RaspiBlitz Amazon Shopping with Bitcoin & Lightning through [Bitrefill](https://blog.bitrefill.com/its-here-buy-amazon-vouchers-with-bitcoin-on-bitrefill-bb2a4449724a).* + #### Package: Minimal (around 180 USD) *The minimal package aims for the cheapest price and allows you to use old hardware. It will always be possible to run all the basic features of a Bitcoin- & Lightning-Fullnode, but the system might be too slow to validate the blockchain history by itself and run some resource intensive extended services.* -Basic Parts for all minimal variants: +Basic Parts: * 1TB Hard Drive: [amazon](https://geni.us/raspiblitz-hdd) * Micro SD-Card 16GB: [amazon](https://geni.us/raspiblitz-sd-card16gb) * LCD-Display: [amazon](https://geni.us/raspiblitz-touchscreen) -If you have already a used RaspberryPi 3 B+ you can reuse with the following parts: +When RaspberryPi 3 --> add following parts: * RaspBerry Pi 3: [amazon](https://geni.us/raspiblitz-rpi3) * Heatsink-Case RP3: [amazon](https://geni.us/raspiblitz-heatsink) -* Power >=3A: [amazon](https://geni.us/raspiblitz-3A-power) +* Powersupply >=3A: [amazon](https://geni.us/raspiblitz-3A-power) -Or if you order new go with the RaspberryPi 4 2GB and the following parts: +When RaspberryPi 4 2GB --> add following parts: * RaspBerry Pi 4 2GB [amazon](https://geni.us/raspiblitz-4-2gb) * RaspBerry Power Supply [amazon](https://geni.us/raspiblitz-ps) * RaspberryPi Heatsink Case: [amazon](https://geni.us/heatsink-raspi4) -#### Package: Maximal - -*The maximal package is still in the works ... if you want to prepare for it, take the standard package as a base and choose the RaspberryPi4 with 4GB and a high quality 1TB SSD instead of 500GB.* - -* 1TB SSD: [amazon](https://geni.us/raspiblitz-1000gb-san) -* RaspBerry Pi 4 4GB: [amazon](https://geni.us/raspiblitz-4-4gb) -* RaspBerry Power Supply [amazon](https://geni.us/raspiblitz-ps) -* SSD-Case: [amazon](https://geni.us/raspiblitz-ssd-case) -* Micro SD-Card 32GB: [amazon](https://geni.us/raspiblitz-sc-card) -* LCD-Display: [amazon](https://geni.us/raspiblitz-touchscreen) -* RaspberryPi Heatsink Case: [amazon](https://geni.us/heatsink-raspi4) - -*You can even pay your RaspiBlitz Amazon Shopping with Bitcoin & Lightning through [Bitrefill](https://blog.bitrefill.com/its-here-buy-amazon-vouchers-with-bitcoin-on-bitrefill-bb2a4449724a).* - -* [What other case options do I have?](FAQ.md#what-other-case-options-do-i-have) +[What other case options do I have?](FAQ.md#what-other-case-options-do-i-have) ## Assemble your RaspiBlitz diff --git a/home.admin/00settingsMenuServices.sh b/home.admin/00settingsMenuServices.sh index 9253e3cdd..240e39e4b 100644 --- a/home.admin/00settingsMenuServices.sh +++ b/home.admin/00settingsMenuServices.sh @@ -110,7 +110,7 @@ r 'LCD Rotate' ${lcdrotateMenu} \ e 'Electrum Rust Server' ${ElectRS} \ p 'BTCPayServer' ${BTCPayServer} \ m 'lndmanage' ${lndmanage} \ -i 'LNbits' ${LNbits} \ +i 'LNbits' ${LNBits} \ d 'StaticChannelBackup on DropBox' ${DropboxBackup} \ j 'JoinMarket' ${joinmarket} \ 2>&1 >/dev/tty) @@ -471,6 +471,33 @@ if [ "${ElectRS}" != "${choice}" ]; then echo "ElectRS Setting changed .." anychange=1 extraparameter="" + if [ "${choice}" = "on" ]; then + # check on HDD size + source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status) + if [ ${hddGigaBytes} -lt 800 ]; then + whiptail --title " HDD/SSD TOO SMALL " --msgbox "\ +Since v1.5 we recommend at least a 1TB HDD/SSD if you want to run ElectRS.\n +This is due to the eletcrum index that will grow over time and needs space.\n +To migrate to a bigger HDD/SSD check RaspiBlitz README on 'migration'.\n +" 14 50 + else + /home/admin/config.scripts/bonus.electrs.sh on ${extraparameter} + errorOnInstall=$? + if [ ${errorOnInstall} -eq 0 ]; then + sudo systemctl start electrs + whiptail --title " Installed ElectRS Server " --msgbox "\ +The index database needs to be created before Electrum Server can be used.\n +This can take hours/days depending on your RaspiBlitz. Monitor the progress on the LCD.\n +When finished use the new 'ELECTRS' entry in Main Menu for more info.\n +" 14 50 + else + l1="!!! FAIL on ElectRS install !!!" + l2="Try manual install on terminal after reboot with:" + l3="/home/admin/config.scripts/bonus.electrs.sh on" + dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65 + fi + fi + fi if [ "${choice}" = "off" ]; then whiptail --title "Delete Electrum Index?" \ --yes-button "Keep Index" \ @@ -479,24 +506,9 @@ if [ "${ElectRS}" != "${choice}" ]; then if [ $? -eq 1 ]; then extraparameter="deleteindex" fi - fi - /home/admin/config.scripts/bonus.electrs.sh ${choice} ${extraparameter} - errorOnInstall=$? - if [ "${choice}" = "on" ]; then - if [ ${errorOnInstall} -eq 0 ]; then - sudo systemctl start electrs - whiptail --title " Installed ElectRS Server " --msgbox "\ -The index database needs to be created before Electrum Server can be used.\n -This can take hours/days depending on your RaspiBlitz. Monitor the progress on the LCD.\n -When finished use the new 'ELECTRS' entry in Main Menu for more info.\n -" 14 50 - else - l1="!!! FAIL on ElectRS install !!!" - l2="Try manual install on terminal after reboot with:" - l3="/home/admin/config.scripts/bonus.electrs.sh on" - dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65 - fi - fi + /home/admin/config.scripts/bonus.electrs.sh off ${extraparameter} + fi + else echo "ElectRS Setting unchanged." fi diff --git a/home.admin/20setupDialog.sh b/home.admin/20setupDialog.sh index fafa20d39..a2fc73862 100755 --- a/home.admin/20setupDialog.sh +++ b/home.admin/20setupDialog.sh @@ -22,7 +22,7 @@ while [ ${#result} -eq 0 ] l2="one word, keep characters basic & not too long" dialog --backtitle "RaspiBlitz - Setup (${network}/${chain})" --inputbox "$l1$l2" 11 52 2>$_temp result=$( cat $_temp | tr -dc '[:alnum:]-.' | tr -d ' ' ) - shred $_temp + shred -u $_temp echo "processing ..." sleep 3 done diff --git a/home.admin/70initLND.sh b/home.admin/70initLND.sh index 826ff384b..2459dc2ff 100755 --- a/home.admin/70initLND.sh +++ b/home.admin/70initLND.sh @@ -183,10 +183,10 @@ if [ ${walletExists} -eq 0 ]; then ############################ # let user enter password c - sudo shred /home/admin/.pass.tmp 2>/dev/null + sudo shred -u /home/admin/.pass.tmp 2>/dev/null sudo /home/admin/config.scripts/blitz.setpassword.sh x "Set your Password C for the LND Wallet Unlock" /home/admin/.pass.tmp passwordC=`sudo cat /home/admin/.pass.tmp` - sudo shred /home/admin/.pass.tmp 2>/dev/null + sudo shred -u /home/admin/.pass.tmp 2>/dev/null # make sure passwordC is set if [ ${#passwordC} -eq 0 ]; then @@ -200,7 +200,7 @@ if [ ${walletExists} -eq 0 ]; then source /home/admin/python3-env-lnd/bin/activate python3 /home/admin/config.scripts/lnd.initwallet.py new ${passwordC} > /home/admin/.seed.tmp source /home/admin/.seed.tmp - sudo shred /home/admin/.pass.tmp 2>/dev/null + sudo shred -u /home/admin/.pass.tmp 2>/dev/null # in case of error - retry if [ ${#err} -gt 0 ]; then @@ -320,10 +320,10 @@ or having a complete LND rescue-backup from your old node. clear # let user enter password c - sudo shred /home/admin/.pass.tmp 2>/dev/null + sudo shred -u /home/admin/.pass.tmp 2>/dev/null sudo /home/admin/config.scripts/blitz.setpassword.sh x "Set your Password C for the LND Wallet Unlock" /home/admin/.pass.tmp passwordC=`sudo cat /home/admin/.pass.tmp` - sudo shred /home/admin/.pass.tmp 2>/dev/null + sudo shred -u /home/admin/.pass.tmp 2>/dev/null # get seed word list if [ "${CHOICE}" == "SEED+SCB" ] || [ "${CHOICE}" == "ONLYSEED" ]; then @@ -334,7 +334,7 @@ or having a complete LND rescue-backup from your old node. # dialog to enter dialog --backtitle "RaspiBlitz - LND Recover" --inputbox "Please enter/paste the SEED WORD LIST:\n(just the words, seperated by spaces, in correct order as numbered)" 9 78 2>/home/admin/.seed.tmp wordstring=$( cat /home/admin/.seed.tmp | sed 's/[^a-zA-Z0-9 ]//g' ) - shred /home/admin/.seed.tmp + shred -u /home/admin/.seed.tmp echo "processing ... ${wordstring}" # check correct number of words @@ -374,10 +374,10 @@ During wallet creation LND offers to set an extra password to protect the seed words. Most users did not set this. " 11 65 if [ $? -eq 1 ]; then - sudo shred /home/admin/.pass.tmp 2>/dev/null + 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 passwordD=`sudo cat /home/admin/.pass.tmp` - sudo shred /home/admin/.pass.tmp 2>/dev/null + sudo shred -u /home/admin/.pass.tmp 2>/dev/null fi fi diff --git a/home.admin/98repairMenu.sh b/home.admin/98repairMenu.sh index 47226157d..d53c4b43e 100755 --- a/home.admin/98repairMenu.sh +++ b/home.admin/98repairMenu.sh @@ -72,10 +72,12 @@ OPTIONS=(HARDWARE "Run Hardwaretest" \ RESET-CHAIN "Delete Blockchain & Re-Download" \ RESET-LND "Delete LND & start new node/wallet" \ RESET-HDD "Delete HDD Data but keep Blockchain" \ - RESET-ALL "Delete HDD completly to start fresh" + RESET-ALL "Delete HDD completly to start fresh" \ + DELETE-ELEC "Delete Electrum Index" \ + DELETE-INDEX "Delete Bitcoin Transaction-Index" ) -CHOICE=$(whiptail --clear --title "Repair Options" --menu "" 15 62 8 "${OPTIONS[@]}" 2>&1 >/dev/tty) +CHOICE=$(whiptail --clear --title "Repair Options" --menu "" 18 62 11 "${OPTIONS[@]}" 2>&1 >/dev/tty) clear case $CHOICE in @@ -120,7 +122,7 @@ case $CHOICE in l3="one word, keep characters basic & not too long" dialog --backtitle "RaspiBlitz - Setup (${network}/${chain})" --inputbox "$l1$l2$l3" 13 52 2>$_temp result=$( cat $_temp | tr -dc '[:alnum:]-.' | tr -d ' ' ) - shred $_temp + shred -u $_temp echo "processing ..." sleep 3 done @@ -153,6 +155,14 @@ case $CHOICE in sudo shutdown now exit 1; ;; + DELETE-ELEC) + /home/admin/config.scripts/bonus.electrs.sh off deleteindex + exit 1; + ;; + DELETE-INDEX) + /home/admin/config.scripts/network.txindex.sh delete + exit 1; + ;; COPY-SOURCE) copyHost ;; diff --git a/home.admin/99updateMenu.sh b/home.admin/99updateMenu.sh index bf72885e7..8da810222 100644 --- a/home.admin/99updateMenu.sh +++ b/home.admin/99updateMenu.sh @@ -9,8 +9,8 @@ clear # Basic Options OPTIONS=(RELEASE "RaspiBlitz Release Update/Recovery" \ - PATCH "Patch RaspiBlitz v${codeVersion}" \ - LND "Update LND Release Options" + LND "Interim LND Update Options" \ + PATCH "Patch RaspiBlitz v${codeVersion}" ) CHOICE=$(whiptail --clear --title "Update Options" --menu "" 10 55 3 "${OPTIONS[@]}" 2>&1 >/dev/tty) @@ -208,11 +208,20 @@ Do you really want to update LND now? echo "# cancel update" exit 1 fi + # if loop is installed remove + if [ "${loop}" == "on" ]; then + sudo -u admin /home/admin/config.scripts/bonus.loop.sh on + fi error="" + warn="" source <(sudo -u admin /home/admin/config.scripts/lnd.update.sh verified) if [ ${#error} -gt 0 ]; then whiptail --title "ERROR" --msgbox "${error}" 8 30 else + # if loop was installed before reinstall + if [ "${loop}" == "on" ]; then + sudo -u admin /home/admin/config.scripts/bonus.loop.sh on + fi /home/admin/XXshutdown.sh reboot sleep 8 fi diff --git a/home.admin/BBcashoutWallet.sh b/home.admin/BBcashoutWallet.sh index e8fdc27c3..ae318e44b 100755 --- a/home.admin/BBcashoutWallet.sh +++ b/home.admin/BBcashoutWallet.sh @@ -56,7 +56,7 @@ else exit 1 fi address=$(cat $_temp | xargs) -shred $_temp +shred -u $_temp if [ ${#address} -eq 0 ]; then echo "FAIL - not a valid address (${address})" echo "Press ENTER to return to main menu." diff --git a/home.admin/BBconnectPeer.sh b/home.admin/BBconnectPeer.sh index 8f1c36595..f666d3963 100755 --- a/home.admin/BBconnectPeer.sh +++ b/home.admin/BBconnectPeer.sh @@ -29,7 +29,7 @@ dialog --title "Open a Connection to a Peer" \ --backtitle "Lightning ( ${network} | ${chain} )" \ --inputbox "$l1\n$l2\n$l3" 10 60 2>$_temp _input=$(cat $_temp | xargs ) -shred $_temp +shred -u $_temp if [ ${#_input} -eq 0 ]; then clear echo diff --git a/home.admin/BBcreateInvoice.sh b/home.admin/BBcreateInvoice.sh index ca8a4545d..c47077863 100755 --- a/home.admin/BBcreateInvoice.sh +++ b/home.admin/BBcreateInvoice.sh @@ -26,7 +26,7 @@ l2="1 ${network} = 100 000 000 SAT" dialog --title "Pay thru Lightning Network" \ --inputbox "$l1\n$l2" 9 50 2>$_temp amount=$(cat $_temp | xargs | tr -dc '0-9') -shred $_temp +shred -u $_temp if [ ${#amount} -eq 0 ]; then clear echo diff --git a/home.admin/BBopenChannel.sh b/home.admin/BBopenChannel.sh index aae340e6a..5997139e2 100755 --- a/home.admin/BBopenChannel.sh +++ b/home.admin/BBopenChannel.sh @@ -96,7 +96,7 @@ l3="max available : ${confirmedBalance}" dialog --title "Funding of Channel" \ --inputbox "$l1\n$l2\n$l3" 10 60 2>$_temp amount=$(cat $_temp | xargs | tr -dc '0-9') -shred $_temp +shred -u $_temp if [ ${#amount} -eq 0 ]; then echo echo "no valid amount entered - returning to menu ..." diff --git a/home.admin/BBpayInvoice.sh b/home.admin/BBpayInvoice.sh index b47ac2657..f7890a809 100755 --- a/home.admin/BBpayInvoice.sh +++ b/home.admin/BBpayInvoice.sh @@ -49,7 +49,7 @@ l3="To try it out go to: ${testSite}" dialog --title "Pay thru Lightning Network" \ --inputbox "$l1\n$l2\n$l3" 10 70 2>$_temp invoice=$(cat $_temp | xargs) -shred $_temp +shred -u $_temp if [ ${#invoice} -eq 0 ]; then clear echo diff --git a/home.admin/XXlnfwdreport.sh b/home.admin/XXlnfwdreport.sh index cd15f1123..68b394532 100755 --- a/home.admin/XXlnfwdreport.sh +++ b/home.admin/XXlnfwdreport.sh @@ -19,7 +19,7 @@ dialog --title "Create a forwarding event report" \ --backtitle "Lightning ( ${network} | ${chain} )" \ --inputbox "$l1\n$l2" 10 60 7 2>$_temp _input=$(cat $_temp | xargs ) -shred $_temp +shred -u $_temp if [ ${#_input} -eq 0 ]; then exit 1 fi diff --git a/home.admin/config.scripts/blitz.lcd.sh b/home.admin/config.scripts/blitz.lcd.sh index 639fbfcd5..096412fd4 100644 --- a/home.admin/config.scripts/blitz.lcd.sh +++ b/home.admin/config.scripts/blitz.lcd.sh @@ -156,8 +156,7 @@ fi if [ "${command}" == "hide" ]; then sudo killall -3 fbi - shred /home/admin/qr.png 2> /dev/null - rm -f /home/admin/qr.png 2> /dev/null + shred -u /home/admin/qr.png 2> /dev/null exit 0 fi diff --git a/home.admin/config.scripts/blitz.setpassword.sh b/home.admin/config.scripts/blitz.setpassword.sh index 4fd537c89..0095badad 100644 --- a/home.admin/config.scripts/blitz.setpassword.sh +++ b/home.admin/config.scripts/blitz.setpassword.sh @@ -78,22 +78,13 @@ if [ "${abcd}" = "a" ]; then # if no password given by parameter - ask by dialog if [ ${#newPassword} -eq 0 ]; then + clear # ask user for new password A (first time) - dialog --backtitle "RaspiBlitz - Setup"\ - --insecure --passwordbox "Set new Master/Admin Password A:\n(min 8chars, 1word, chars+number, no specials)" 10 52 2>$_temp - - # get user input - password1=$( cat $_temp ) - shred $_temp + password1=$(whiptail --passwordbox "\nSet new Admin/SSH Password A:\n(min 8chars, 1word, chars+number, no specials)" 10 52 "" --title "Password A" --backtitle "RaspiBlitz - Setup" 3>&1 1>&2 2>&3) # ask user for new password A (second time) - dialog --backtitle "RaspiBlitz - Setup"\ - --insecure --passwordbox "Re-Enter Password A:\n(This is new password to login per SSH)" 10 52 2>$_temp - - # get user input - password2=$( cat $_temp ) - shred $_temp + password2=$(whiptail --passwordbox "\nRe-Enter Password A:\n(This is new password to login per SSH)" 10 52 "" --title "Password A" --backtitle "RaspiBlitz - Setup" 3>&1 1>&2 2>&3) # check if passwords match if [ "${password1}" != "${password2}" ]; then @@ -146,21 +137,13 @@ elif [ "${abcd}" = "b" ]; then # if no password given by parameter - ask by dialog if [ ${#newPassword} -eq 0 ]; then - # ask user for new password A (first time) - dialog --backtitle "RaspiBlitz - Setup"\ - --insecure --passwordbox "Please enter your RPC Password B:\n(min 8chars, 1word, chars+number, no specials)" 10 52 2>$_temp + clear - # get user input - password1=$( cat $_temp ) - shred $_temp + # ask user for new password A (first time) + password1=$(whiptail --passwordbox "\nPlease enter your RPC Password B:\n(min 8chars, 1word, chars+number, no specials)" 10 52 "" --title "Password A" --backtitle "RaspiBlitz - Setup" 3>&1 1>&2 2>&3) # ask user for new password A (second time) - dialog --backtitle "RaspiBlitz - Setup"\ - --insecure --passwordbox "Re-Enter Password B:\n" 10 52 2>$_temp - - # get user input - password2=$( cat $_temp ) - shred $_temp + password2=$(whiptail --passwordbox "\nRe-Enter Password B:\n" 10 52 "" --title "Password A" --backtitle "RaspiBlitz - Setup" 3>&1 1>&2 2>&3) # check if passwords match if [ "${password1}" != "${password2}" ]; then @@ -312,34 +295,24 @@ elif [ "${abcd}" = "x" ]; then # second parameter is the flexible text text=$2 resultFile=$3 - shred $3 2>/dev/null + shred -u $3 2>/dev/null # ask user for new password (first time) - dialog --backtitle "RaspiBlitz"\ - --insecure --passwordbox "${text}:\n(min 8chars, 1word, chars+number, no specials)" 10 52 2>$_temp - - # get user input - password1=$( cat $_temp ) - shred $_temp + 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) - dialog --backtitle "RaspiBlitz - Setup"\ - --insecure --passwordbox "Re-Enter the Password:\n(to test if typed in correctly)" 10 52 2>$_temp - - # get user input - password2=$( cat $_temp ) - shred $_temp + password2=$(whiptail --passwordbox "\nRe-Enter the Password:\n(to test if typed in correctly)" 10 52 "" --backtitle "RaspiBlitz" 3>&1 1>&2 2>&3) # check if passwords match if [ "${password1}" != "${password2}" ]; then - dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Passwords dont Match\nPlease try again ..." 6 52 + dialog --backtitle "RaspiBlitz" --msgbox "FAIL -> Passwords dont Match\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 - Setup" --msgbox "FAIL -> Password cannot be empty\nPlease try again ..." 6 52 + 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 @@ -347,14 +320,14 @@ elif [ "${abcd}" = "x" ]; 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 - Setup" --msgbox "FAIL -> Contains bad characters (spaces, special chars)\nPlease try again ..." 6 52 + 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 longer than 8 if [ ${#password1} -lt 8 ]; then - dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Password length under 8\nPlease try again ..." 6 52 + 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 diff --git a/home.admin/config.scripts/bonus.electrs.sh b/home.admin/config.scripts/bonus.electrs.sh index 3b43180e0..2ee9f7ea4 100644 --- a/home.admin/config.scripts/bonus.electrs.sh +++ b/home.admin/config.scripts/bonus.electrs.sh @@ -143,7 +143,7 @@ Check 'sudo nginx -t' for a detailed error message. # Options (available without TOR) OPTIONS=( \ CONNECT "How to Connect" \ - INDEX "Delete/Rebuild Index" \ + INDEX "Delete&Rebuild Index" \ STATUS "ElectRS Status Info" ) @@ -455,6 +455,12 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then # setting value in raspiblitz config sudo sed -i "s/^ElectRS=.*/ElectRS=off/g" /mnt/hdd/raspiblitz.conf + # if second parameter is "deleteindex" + if [ "$2" == "deleteindex" ]; then + echo "# deleting electrum index" + sudo rm -rf /mnt/hdd/app-storage/electrs/ + fi + isInstalled=$(sudo ls /etc/systemd/system/electrs.service 2>/dev/null | grep -c 'electrs.service') if [ ${isInstalled} -eq 1 ]; then @@ -470,10 +476,6 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then sudo rm -rf /home/electrs/.rustup sudo rm -rf /home/electrs/.profile - if [ "$2" == "deleteindex" ]; then - sudo rm -rf /mnt/hdd/app-storage/electrs/ - fi - echo "# OK ElectRS removed." ## Disable BTCEXP_ADDRESS_API if BTC-RPC-Explorer is active diff --git a/home.admin/config.scripts/bonus.lnbits.sh b/home.admin/config.scripts/bonus.lnbits.sh index 26f7a744f..9938584a7 100644 --- a/home.admin/config.scripts/bonus.lnbits.sh +++ b/home.admin/config.scripts/bonus.lnbits.sh @@ -1,6 +1,6 @@ #!/bin/bash -# https://github.com/arcbtc/lnbits +# https://github.com/lnbits/lnbits # command info if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then @@ -89,14 +89,15 @@ if [ "$1" = "write-macaroons" ]; then sudo ln -s "/mnt/hdd/app-data/lnd/" "/home/lnbits/.lnd" # and create symlink fi - # set tls.cert path (use | as separator to avoid escaping file path slashes) - sudo -u lnbits sed -i "s|^LND_CERT=.*|LND_CERT=/home/lnbits/.lnd/tls.cert|g" /home/lnbits/lnbits/.env - - # set macaroon path info in .env - sudo -u lnbits sed -i "s|^LND_ADMIN_MACAROON=.*|LND_ADMIN_MACAROON=/home/lnbits/.lnd/data/chain/${network}/${chain}net/admin.macaroon|g" /home/lnbits/lnbits/.env - sudo -u lnbits sed -i "s|^LND_INVOICE_MACAROON=.*|LND_INVOICE_MACAROON=/home/lnbits/.lnd/data/chain/${network}/${chain}net/invoice.macaroon|g" /home/lnbits/lnbits/.env - sudo -u lnbits sed -i "s|^LND_READ_MACAROON=.*|LND_READ_MACAROON=/home/lnbits/.lnd/data/chain/${network}/${chain}net/read.macaroon|g" /home/lnbits/lnbits/.env - echo "# OK - macaroon path info written to /home/lnbits/lnbits/.env" + # copy cert and macaroons cert for lnbits environment + sudo -u lnbits sed -i "s/^LND_REST_CERT=.*/LND_REST_CERT=\/home\/lnbits\/.lnd\/tls.cert/g" /home/lnbits/lnbits/.env + macaroonAdminHex=$(sudo xxd -ps -u -c 1000 /home/lnbits/.lnd/data/chain/${network}/${chain}net/admin.macaroon) + macaroonInvoiceHex=$(sudo xxd -ps -u -c 1000 /home/lnbits/.lnd/data/chain/${network}/${chain}net/invoice.macaroon) + macaroonReadHex=$(sudo xxd -ps -u -c 1000 /home/lnbits/.lnd/data/chain/${network}/${chain}net/readonly.macaroon) + sudo sed -i "s/^LND_REST_ADMIN_MACAROON=.*/LND_REST_ADMIN_MACAROON=${macaroonAdminHex}/g" /home/lnbits/lnbits/.env + sudo sed -i "s/^LND_REST_INVOICE_MACAROON=.*/LND_REST_INVOICE_MACAROON=${macaroonInvoiceHex}/g" /home/lnbits/lnbits/.env + sudo sed -i "s/^LND_REST_READ_MACAROON=.*/LND_REST_READ_MACAROON=${macaroonReadHex}/g" /home/lnbits/lnbits/.env + echo "# OK - macaroons written to /home/lnbits/lnbits/.env" exit 0 fi @@ -132,20 +133,19 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then sudo -u lnbits touch /home/lnbits/lnbits/.env sudo bash -c "echo 'FLASK_APP=lnbits' >> /home/lnbits/lnbits/.env" sudo bash -c "echo 'FLASK_ENV=production' >> /home/lnbits/lnbits/.env" - sudo bash -c "echo 'LNBITS_BACKEND_WALLET_CLASS=LndWallet' >> /home/lnbits/lnbits/.env" - sudo bash -c "echo 'LND_GRPC_ENDPOINT=127.0.0.1' >> /home/lnbits/lnbits/.env" - sudo bash -c "echo 'LND_GRPC_PORT=10009' >> /home/lnbits/lnbits/.env" sudo bash -c "echo 'LNBITS_FORCE_HTTPS=0' >> /home/lnbits/lnbits/.env" - sudo bash -c "echo 'LND_CERT=' >> /home/lnbits/lnbits/.env" - sudo bash -c "echo 'LND_ADMIN_MACAROON=' >> /home/lnbits/lnbits/.env" - sudo bash -c "echo 'LND_INVOICE_MACAROON=' >> /home/lnbits/lnbits/.env" - sudo bash -c "echo 'LND_READ_MACAROON=' >> /home/lnbits/lnbits/.env" + sudo bash -c "echo 'LNBITS_BACKEND_WALLET_CLASS=LndRestWallet' >> /home/lnbits/lnbits/.env" + sudo bash -c "echo 'LND_REST_ENDPOINT=https://127.0.0.1:8080' >> /home/lnbits/lnbits/.env" + sudo bash -c "echo 'LND_REST_CERT=' >> /home/lnbits/lnbits/.env" + sudo bash -c "echo 'LND_REST_ADMIN_MACAROON=' >> /home/lnbits/lnbits/.env" + sudo bash -c "echo 'LND_REST_INVOICE_MACAROON=' >> /home/lnbits/lnbits/.env" + sudo bash -c "echo 'LND_REST_READ_MACAROON=' >> /home/lnbits/lnbits/.env" /home/admin/config.scripts/bonus.lnbits.sh write-macaroons # set database path to HDD data so that its survives updates and migrations sudo mkdir /mnt/hdd/app-data/LNBits 2>/dev/null sudo chown lnbits:lnbits -R /mnt/hdd/app-data/LNBits - sudo bash -c "echo 'LNBITS_DATA_FOLDER=/mnt/hdd/app-data/LNBits' >> sudo /home/lnbits/lnbits/.env" + sudo bash -c "echo 'LNBITS_DATA_FOLDER=/mnt/hdd/app-data/LNBits' >> /home/lnbits/lnbits/.env" # to the install echo "# installing application dependencies" diff --git a/home.admin/config.scripts/bonus.lndconnect.sh b/home.admin/config.scripts/bonus.lndconnect.sh index 9495ba0df..5b3104e2f 100644 --- a/home.admin/config.scripts/bonus.lndconnect.sh +++ b/home.admin/config.scripts/bonus.lndconnect.sh @@ -227,8 +227,7 @@ fi # clean up /home/admin/config.scripts/blitz.lcd.sh hide -shred ${imagePath} 2> /dev/null -rm -f ${imagePath} 2> /dev/null +shred -u ${imagePath} 2> /dev/null echo "------------------------------" echo "If the connection was not working:" diff --git a/home.admin/config.scripts/bonus.loop.sh b/home.admin/config.scripts/bonus.loop.sh index 6b1c8d252..efae83fc6 100644 --- a/home.admin/config.scripts/bonus.loop.sh +++ b/home.admin/config.scripts/bonus.loop.sh @@ -42,7 +42,12 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then sudo -u bitcoin git clone https://github.com/lightninglabs/loop.git cd /home/bitcoin/loop # https://github.com/lightninglabs/loop/releases - sudo -u bitcoin git reset --hard v0.5.1-beta + source <(sudo -u admin /home/admin/config.scripts/lnd.update.sh info) + if [ ${lndInstalledVersionMain} -lt 10 ]; then + sudo -u bitcoin git reset --hard v0.5.1-beta + else + sudo -u bitcoin git reset --hard v0.6.0-beta + fi cd /home/bitcoin/loop/cmd go install ./... diff --git a/home.admin/config.scripts/dropbox.upload.sh b/home.admin/config.scripts/dropbox.upload.sh index 39158a499..63e15a488 100644 --- a/home.admin/config.scripts/dropbox.upload.sh +++ b/home.admin/config.scripts/dropbox.upload.sh @@ -31,7 +31,7 @@ Follow the steps described at the following link to get the DropBox-Authtoken from your account: https://github.com/rootzoll/raspiblitz/#b-dropbox-backup-target" 11 70 2>/home/admin/.tmp authtoken=$(cat /home/admin/.tmp) - shred /home/admin/.tmp + shred -u /home/admin/.tmp fi # quick check on authtoken @@ -104,8 +104,7 @@ elif [ "${MODE}" == "upload" ]; then --header "Content-Type: application/octet-stream" \ --data-binary @$SOURCEFILE > /home/admin/.dropbox.tmp safeResponse=$(sed 's/[^a-zA-Z0-9 ]//g' /home/admin/.dropbox.tmp) - sudo shred /home/admin/.dropbox.tmp - sudo rm /home/admin/.dropbox.tmp 2>/dev/null + sudo shred -u /home/admin/.dropbox.tmp success=$(echo "${safeResponse}" | grep -c 'servermodified') sizeZero=$(echo "${safeResponse}" | grep -c 'size 0') diff --git a/home.admin/config.scripts/internet.dyndomain.sh b/home.admin/config.scripts/internet.dyndomain.sh index b03463002..69d73bd11 100755 --- a/home.admin/config.scripts/internet.dyndomain.sh +++ b/home.admin/config.scripts/internet.dyndomain.sh @@ -50,7 +50,7 @@ The RaspiBlitz will call this URL regularly. 4 service freedns.afraid.org use 'DirectURL' " 10 52 2>./.tmp dynUpdateUrl=$( cat ./.tmp ) - shred ./.tmp + shred -u ./.tmp fi diff --git a/home.admin/config.scripts/lnd.autounlock.sh b/home.admin/config.scripts/lnd.autounlock.sh index 326a3dfa0..66ffd68cf 100755 --- a/home.admin/config.scripts/lnd.autounlock.sh +++ b/home.admin/config.scripts/lnd.autounlock.sh @@ -57,7 +57,7 @@ Password C will be stored on the device. sudo /home/admin/config.scripts/lnd.autounlock.sh on exit 1 fi - shred ./.tmp + shred -u ./.tmp fi # config file diff --git a/home.admin/config.scripts/lnd.rescue.sh b/home.admin/config.scripts/lnd.rescue.sh index 52bef4df6..42122d71e 100755 --- a/home.admin/config.scripts/lnd.rescue.sh +++ b/home.admin/config.scripts/lnd.rescue.sh @@ -122,6 +122,7 @@ elif [ ${mode} = "restore" ]; then filename=$(sudo ls /home/admin/lnd-rescue-*.tar.gz) echo "OK -> found file to restore: ${filename}" + # checksum test md5checksum=$(md5sum ${filename} | head -n1 | cut -d " " -f1) isCorrect=$(echo ${filename} | grep -c ${md5checksum}) if [ ${isCorrect} -eq 1 ]; then @@ -132,6 +133,7 @@ elif [ ${mode} = "restore" ]; then echo "Recommend to abort and upload again!" fi + # overrride test oldWalletExists=$(sudo ls /mnt/hdd/lnd/data/chain/${network}/${chain}net/wallet.db 2>/dev/null | grep -c "wallet.db") if [ ${oldWalletExists} -gt 0 ]; then echo @@ -166,6 +168,19 @@ elif [ ${mode} = "restore" ]; then echo "OK" echo + # check if LND needs update + # (if RaspiBlitz has an optional LND version update, then install it + # the newer LND version can always handle older data) + echo "Checking LND version ..." + source <(sudo -u admin /home/admin/config.scripts/lnd.update.sh info) + if [ ${lndUpdateInstalled} -eq 0 ]; then + echo "Installing available LND update ... (newer version can handle more wallet formats)" + sudo -u admin /home/admin/config.scripts/lnd.update.sh verified + else + echo "OK" + fi + echo + # start LND echo "Starting lnd..." sudo systemctl start lnd diff --git a/home.admin/config.scripts/lnd.update.sh b/home.admin/config.scripts/lnd.update.sh index ad14d339c..24e4c4b11 100755 --- a/home.admin/config.scripts/lnd.update.sh +++ b/home.admin/config.scripts/lnd.update.sh @@ -65,7 +65,7 @@ lndInstalledVersionMain=$(echo "${lndInstalledVersion}" | cut -d "-" -f1 | cut - lndInstalledVersionMinor=$(echo "${lndInstalledVersion}" | cut -d "-" -f1 | cut -d "." -f3) # test if the installed version already the verified/recommended update version -lndUpdateInstalled=$(echo "${lndInstalledVersion}" | grep -c "lndUpdateVersion") +lndUpdateInstalled=$(echo "${lndInstalledVersion}" | grep -c "${lndUpdateVersion}") # get latest release from LND GitHub releases gitHubLatestReleaseJSON="$(curl -s https://api.github.com/repos/lightningnetwork/lnd/releases | jq '.[0]')" @@ -114,11 +114,13 @@ if [ "${mode}" = "verified" ]; then fi fi - # clean & change into download directory + echo + echo "# clean & change into download directory" sudo rm -r ${downloadDir}/* cd "${downloadDir}" - # extract the SHA256 hash from the manifest file for the corresponding platform + echo + echo "# extract the SHA256 hash from the manifest file for the corresponding platform" sudo -u admin wget -N https://github.com/lightningnetwork/lnd/releases/download/v${lndUpdateVersion}/manifest-v${lndUpdateVersion}.txt checkDownload=$(ls manifest-v${lndUpdateVersion}.txt 2>/dev/null | grep -c manifest-v${lndUpdateVersion}.txt) if [ ${checkDownload} -eq 0 ]; then @@ -128,7 +130,8 @@ if [ "${mode}" = "verified" ]; then lndSHA256=$(grep -i "linux-${cpuArchitecture}" manifest-v$lndUpdateVersion.txt | cut -d " " -f1) echo "# SHA256 hash: $lndSHA256" - # get LND binary + echo + echo "# get LND binary" binaryName="lnd-linux-${cpuArchitecture}-v${lndUpdateVersion}.tar.gz" sudo -u admin wget -N https://github.com/lightningnetwork/lnd/releases/download/v${lndUpdateVersion}/${binaryName} checkDownload=$(ls ${binaryName} 2>/dev/null | grep -c ${binaryName}) @@ -137,7 +140,8 @@ if [ "${mode}" = "verified" ]; then exit 1 fi - # check binary was not manipulated (checksum test) + echo + echo "# check binary was not manipulated (checksum test)" sudo -u admin wget -N https://github.com/lightningnetwork/lnd/releases/download/v${lndUpdateVersion}/manifest-v${lndUpdateVersion}.txt.sig sudo -u admin wget -N -O "${downloadDir}/pgp_keys.asc" ${lndUpdatePGPpkeys} binaryChecksum=$(sha256sum ${binaryName} | cut -d " " -f1) @@ -146,26 +150,32 @@ if [ "${mode}" = "verified" ]; then exit 1 fi - # check gpg finger print + echo + echo "# getting gpg finger print" gpg ./pgp_keys.asc fingerprint=$(sudo gpg "${downloadDir}/pgp_keys.asc" 2>/dev/null | grep "${lndUpdatePGPcheck}" -c) if [ ${fingerprint} -lt 1 ]; then echo "error='PGP author check failed'" + exit 1 fi + echo "fingerprint='${fingerprint}'" + + echo + echo "# chacking gpg finger print" gpg --import ./pgp_keys.asc sleep 3 verifyResult=$(gpg --verify manifest-v${lndUpdateVersion}.txt.sig 2>&1) goodSignature=$(echo ${verifyResult} | grep 'Good signature' -c) - echo "# goodSignature(${goodSignature})" + echo "goodSignature='${goodSignature}'" correctKey=$(echo ${verifyResult} | tr -d " \t\n\r" | grep "${lndUpdatePGPcheck}" -c) - echo "# correctKey(${correctKey})" + echo "correctKey='${correctKey}'" if [ ${correctKey} -lt 1 ] || [ ${goodSignature} -lt 1 ]; then echo "error='PGP verify fail'" exit 1 fi # note: install will be done the same as reckless further down - lndInterimsUpdateNew="${$lndUpdateVersion}" + lndInterimsUpdateNew="${lndUpdateVersion}" fi diff --git a/home.admin/config.scripts/network.txindex.sh b/home.admin/config.scripts/network.txindex.sh index 94b238104..74a50fd01 100644 --- a/home.admin/config.scripts/network.txindex.sh +++ b/home.admin/config.scripts/network.txindex.sh @@ -88,5 +88,22 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then exit 0 fi + +################### +# delete (and make sure all using apps are deinstalled) +# on version update check all bonus scripts that this network.txindex.sh on +################### +if [ "$1" = "delete" ]; then + echo "# deinstalling apps needing txindex ..." + sudo -u admin /home/admin/config.scripts/bonus.btc-rpc-explorer.sh off + echo "# changing config ..." + sudo systemctl stop ${network}d + sudo sed -i "s/^txindex=.*/txindex=0/g" /mnt/hdd/${network}/${network}.conf + echo "# deleting tx index ..." + sudo rm -r /mnt/hdd/${network}/indexes/txindex + sudo systemctl restart ${network}d + exit 0 +fi + echo "FAIL - Unknown Parameter $1" exit 1