From 0ecf144a1824da93e31bdb69a7991c07fb3a5287 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Thu, 8 Aug 2019 18:39:43 +0200 Subject: [PATCH] #592 user choice to IBD behind TOR or IP --- home.admin/20setupDialog.sh | 7 +++---- home.admin/50syncHDD.sh | 39 ++++++++++++++++++++----------------- home.admin/60finishHDD.sh | 15 ++++++++++++-- home.admin/70initLND.sh | 2 +- 4 files changed, 38 insertions(+), 25 deletions(-) diff --git a/home.admin/20setupDialog.sh b/home.admin/20setupDialog.sh index ad7176e..e594faf 100755 --- a/home.admin/20setupDialog.sh +++ b/home.admin/20setupDialog.sh @@ -70,10 +70,9 @@ dialog --backtitle "RaspiBlitz" --msgbox "OK - RPC password changed \n\nNow star # https://github.com/rootzoll/raspiblitz/issues/592 ################### -whiptail --title ' Privacy Level - How do you want to run your node? ' --yes-button='Public IP' --no-button='TOR NETWORK' --yesno " -Running your node with your Public IP is the default but might reveal your personal identity and location.\n -You can better protect your privacy with running your node as a Hidden Service within the TOR network, but that makes syncing slower, makes it harder to connect with other non-TOR nodes and remote mobile apps. - " 14 75 +whiptail --title ' Privacy Level - How do you want to run your node? ' --yes-button='Public IP' --no-button='TOR NETWORK' --yesno "Running your Lightning node with your Public IP is common and faster, but might reveal your personal identity and location.\n +You can better protect your privacy with running your lightning node as a TOR Hidden Service from the start, but it can make it harder to connect with other non-TOR nodes and remote mobile apps later on. + " 12 75 if [ $? -eq 1 ]; then echo "runBehindTor=on" >> /home/admin/raspiblitz.info fi diff --git a/home.admin/50syncHDD.sh b/home.admin/50syncHDD.sh index 5063cbc..e3860fc 100755 --- a/home.admin/50syncHDD.sh +++ b/home.admin/50syncHDD.sh @@ -17,28 +17,31 @@ if [ "$network" = "bitcoin" ]; then # raspberryPi 3 and lower msg=" This old RaspberryPi has very limited CPU power.\n" msg="$msg To sync & validate the complete blockchain\n" - msg="$msg can take multiple days - even weeksn" + msg="$msg can take multiple days - even weeks\n" msg="$msg Its recommended to use another option.\n" msg="$msg \n" msg="$msg So do you really want start syncing now?" - else - # raspberryPi 4 and up - msg=" Your RaspiBlitz will sync and validate\n" - msg="$msg the complete blockchain by itself.\n" - msg="$msg This can take multiple days, but\n" - msg="$msg its the best to do it this way.\n" - msg="$msg \n" - msg="$msg So do you want start syncing now?" + dialog --title " WARNING " --yesno "${msg}" 11 57 + response=$? + case $response in + 0) echo "--> OK";; + 1) exit 1;; + 255) exit 1;; + esac fi - - dialog --title " WARNING " --yesno "${msg}" 11 57 - response=$? - case $response in - 0) echo "--> OK";; - 1) exit 1;; - 255) exit 1;; - esac + # ask if really sync behind TOR + if [ "${runBehindTor}" = "on" ]; then + whiptail --title ' Sync Blockchain from behind TOR? ' --yes-button='Public-Sync' --no-button='TOR-Sync' --yesno "You decided to run your node behind TOR and validate the blockchain with your RaspiBlitz - thats good. But downloading the complete blockchain thru TOR can add some extra time (maybe a day) to the process and adds a heavy load on the TOR network.\n +Your RaspiBlitz can just run the initial blockchain download with your public IP (Public-Sync) but keep your Lighting node safe behind TOR. +It would speed up the self-validation while not revealing your Lightning node identity. But for most privacy choose (TOR-Sync). + " 15 76 + if [ $? -eq 0 ]; then + # set flag to not run bitcoin behind TOR during IDB + echo "ibdBehindTor=off" >> /home/admin/raspiblitz.info + fi + fi + clear if [ ${raspberryPi} -lt 4 ]; then echo "********************************" @@ -71,7 +74,7 @@ elif [ ${kbSizeRAM} -gt 1500000 ]; then # RP3/4 1GB else echo "Detected RAM <=1GB --> optimizing ${network}.conf" - sudo sed -i "s/^dbcache=.*/dbcache=768/g" /home/admin/assets/${network}.conf + sudo sed -i "s/^dbcache=.*/dbcache=512/g" /home/admin/assets/${network}.conf fi echo "*** Activating Blockain Sync ***" diff --git a/home.admin/60finishHDD.sh b/home.admin/60finishHDD.sh index e42e5a4..732c09a 100755 --- a/home.admin/60finishHDD.sh +++ b/home.admin/60finishHDD.sh @@ -37,10 +37,21 @@ if [ ${mountOK} -eq 1 ]; then ###### ACTIVATE TOR IF SET DURING SETUP if [ "${runBehindTor}" = "on" ]; then - echo "TOR was selected ..." + + echo "runBehindTor --> ON" sudo /home/admin/config.scripts/internet.tor.sh on + + # but if IBD is allowed to be public switch off TOR just fro bitcoin + # until IBD is done. background service will after that switch TOR on + if [ "${ibdBehindTor}" = "off" ]; then + echo "ibdBehindTor --> OFF" + sudo /home/admin/config.scripts/internet.tor.sh btcconf-off + else + echo "ibdBehindTor --> ON" + fi + else - echo "TOR was not selected" + echo "runBehindTor --> OFF" fi ###### START NETWORK SERVICE diff --git a/home.admin/70initLND.sh b/home.admin/70initLND.sh index 68f4e70..3607c76 100755 --- a/home.admin/70initLND.sh +++ b/home.admin/70initLND.sh @@ -109,7 +109,7 @@ if [ ${lndRunning} -eq 0 ]; then ###### ACTIVATE TOR IF SET DURING SETUP if [ "${runBehindTor}" = "on" ]; then - echo "TOR was selected ..." + echo "TOR was selected" sudo /home/admin/config.scripts/internet.tor.sh lndconf-on else echo "TOR was not selected"