diff --git a/home.admin/97addMobileWallet.sh b/home.admin/97addMobileWallet.sh index 7dd81574f..4c588a332 100755 --- a/home.admin/97addMobileWallet.sh +++ b/home.admin/97addMobileWallet.sh @@ -50,7 +50,24 @@ For full support switch to mainnet. " 9 55 fi -# Options (available without TOR) +# fuction to call for wallets that support TOR +connect="ip" +choose_IP_or_TOR() +{ + whiptail --title " How to Connect? " \ + --yes-button "TOR" \ + --no-button "IP/Domain" \ + --yesno "The wallet you selected supports connection thru TOR. On An" 10 60 + if [ $? -eq 0 ]; then + echo "# yes-button -> TOR" + connect="tor" + else + echo "# no-button -> IP" + connect="ip" + fi +} + +# Options OPTIONS=(ZAP_IOS "Zap Wallet (iOS)" \ ZAP_ANDROID "Zap Wallet (Android)" \ SHANGO_IOS "Shango Wallet (iOS)" \ @@ -59,13 +76,9 @@ OPTIONS=(ZAP_IOS "Zap Wallet (iOS)" \ ZEUS_ANDROID "Zeus Wallet (Android)" ) +# Additinal Options with TOR if [ "${runBehindTor}" = "on" ]; then - # Options (available with TOR) - OPTIONS=( #ZAP_IOS "Zap Wallet (iOS) over TOR" \ - ZAP_ANDROID "Zap Wallet (Android) over TOR" \ - ZEUS_ANDROID "Zeus Wallet (Android) over TOR" \ - FULLY_NODED "Fully Noded (IOS) over TOR" - ) + OPTIONS+=(FULLY_NODED "Fully Noded (IOS) over TOR") fi CHOICE=$(whiptail --clear --title "Choose Mobile Wallet" --menu "" 13 50 7 "${OPTIONS[@]}" 2>&1 >/dev/tty) @@ -89,7 +102,7 @@ case $CHOICE in /home/admin/config.scripts/blitz.lcd.sh qr-console ${appstoreLink} fi /home/admin/config.scripts/blitz.lcd.sh hide - /home/admin/config.scripts/bonus.lndconnect.sh shango-ios + /home/admin/config.scripts/bonus.lndconnect.sh shango-ios ${connect} exit 1; ;; SHANGO_ANDROID) @@ -103,7 +116,7 @@ case $CHOICE in /home/admin/config.scripts/blitz.lcd.sh qr-console ${appstoreLink} fi /home/admin/config.scripts/blitz.lcd.sh hide - /home/admin/config.scripts/bonus.lndconnect.sh shango-android + /home/admin/config.scripts/bonus.lndconnect.sh shango-android ${connect} exit 1; ;; ZAP_IOS) @@ -117,10 +130,12 @@ case $CHOICE in /home/admin/config.scripts/blitz.lcd.sh qr-console ${appstoreLink} fi /home/admin/config.scripts/blitz.lcd.sh hide - /home/admin/config.scripts/bonus.lndconnect.sh zap-ios + /home/admin/config.scripts/bonus.lndconnect.sh zap-ios ${connect} exit 1; ;; ZAP_ANDROID) + choose_IP_or_TOR() + echo "connect(${connect})" appstoreLink="https://play.google.com/store/apps/details?id=zapsolutions.zap" /home/admin/config.scripts/blitz.lcd.sh qr ${appstoreLink} whiptail --title "Install Zap from PlayStore on your Android device" \ @@ -131,7 +146,7 @@ case $CHOICE in /home/admin/config.scripts/blitz.lcd.sh qr-console ${appstoreLink} fi /home/admin/config.scripts/blitz.lcd.sh hide - /home/admin/config.scripts/bonus.lndconnect.sh zap-android + /home/admin/config.scripts/bonus.lndconnect.sh zap-android ${connect} exit 1; ;; ZEUS_IOS) @@ -145,10 +160,11 @@ case $CHOICE in /home/admin/config.scripts/blitz.lcd.sh qr-console ${appstoreLink} fi /home/admin/config.scripts/blitz.lcd.sh hide - /home/admin/config.scripts/bonus.lndconnect.sh zeus-ios + /home/admin/config.scripts/bonus.lndconnect.sh zeus-ios ${connect} exit 1; ;; ZEUS_ANDROID) + choose_IP_or_TOR() appstoreLink="https://play.google.com/store/apps/details?id=com.zeusln.zeus" /home/admin/config.scripts/blitz.lcd.sh qr ${appstoreLink} whiptail --title "Install Shango on your Android Phone" \ @@ -159,7 +175,7 @@ case $CHOICE in /home/admin/config.scripts/blitz.lcd.sh qr-console ${appstoreLink} fi /home/admin/config.scripts/blitz.lcd.sh hide - /home/admin/config.scripts/bonus.lndconnect.sh zeus-android + /home/admin/config.scripts/bonus.lndconnect.sh zeus-android ${connect} exit 1; ;; FULLY_NODED) diff --git a/home.admin/config.scripts/bonus.fullynoded.sh b/home.admin/config.scripts/bonus.fullynoded.sh index da51bfa83..f56139c47 100644 --- a/home.admin/config.scripts/bonus.fullynoded.sh +++ b/home.admin/config.scripts/bonus.fullynoded.sh @@ -12,7 +12,7 @@ source /mnt/hdd/raspiblitz.conf # extract RPC credentials from bitcoin.conf - store only in var RPC_USER=$(sudo cat /mnt/hdd/bitcoin/bitcoin.conf | grep rpcuser | cut -c 9-) PASSWORD_B=$(sudo cat /mnt/hdd/bitcoin/bitcoin.conf | grep rpcpassword | cut -c 13-) -hiddenService=$(sudo cat /mnt/hdd/tor/bitcoinrpc/hostname) +hiddenService=$(sudo cat /mnt/hdd/tor/bitcoin8332/hostname) # btcstandup://:@:/?label= quickConnect="btcstandup://$RPC_USER:$PASSWORD_B@$hiddenService:8332/?label=$hostname" diff --git a/home.admin/config.scripts/bonus.lndconnect.sh b/home.admin/config.scripts/bonus.lndconnect.sh index ff0b31a6c..f85d0fa61 100644 --- a/home.admin/config.scripts/bonus.lndconnect.sh +++ b/home.admin/config.scripts/bonus.lndconnect.sh @@ -4,7 +4,7 @@ if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then echo "# config script to connect mobile apps with lnd connect" echo "# will autodetect dyndns, sshtunnel or TOR" - echo "# bonus.lndconnect.sh [zap-ios|zap-android|zeus-ios|zeus-android|shango-ios|shango-android]" + echo "# bonus.lndconnect.sh [zap-ios|zap-android|zeus-ios|zeus-android|shango-ios|shango-android] [?ip|tor]" exit 1 fi @@ -15,26 +15,12 @@ source /mnt/hdd/raspiblitz.conf #### PARAMETER # 1. TARGET WALLET -targetWallet=$1 +targetWallet=$1 -# 1. REST or RPC -# determine service port from argument -if [ "$1" == "RPC" ]; then - echo "# RPC mode" - servicePort="10009" -fi -if [ "$1" == "REST" ]; then - echo "# REST mode" - servicePort="8080" -fi - -# 2. FORCE NOCERT (optional) -if [ "$2" == "NOCERT" ]; then - echo "# forcing NOCERT" - extraparamter="--nocert" -elif [ "$2" == "SHANGO" ]; then - echo "# connecting thru shango QR code" - connector="shango" +# 1. TOR or IP (optional - default IP) +forceTOR=0 +if [ "$2" == "tor" ]; then + forceTOR=1 fi #### MAKE SURE LNDCONNECT IS INSTALLED @@ -69,11 +55,11 @@ extraparamter="" supportsTOR=0 if [ "${targetWallet}" = "zap-ios" ]; then - connector="lndconnect" - supportsTOR=0 # deactivated until fix: https://github.com/rootzoll/raspiblitz/issues/1001 - - if [ "${runBehindTor}" == "on" ] && [ ${supportsTOR} -eq 1 ]; then + if [ ${forceTOR} -eq 1 ]; then + # deactivated until fix: https://github.com/rootzoll/raspiblitz/issues/1001 + echo "error='no tor support'" + exit 1 # when ZAP runs on TOR it uses REST port="8080" extraparamter="--nocert" @@ -83,10 +69,8 @@ if [ "${targetWallet}" = "zap-ios" ]; then fi elif [ "${targetWallet}" = "zap-android" ]; then - connector="lndconnect" - supportsTOR=1 - if [ "${runBehindTor}" == "on" ] && [ ${supportsTOR} -eq 1 ]; then + if [ ${forceTOR} -eq 1 ]; then # when ZAP runs on TOR it uses REST port="8080" extraparamter="--nocert" @@ -98,25 +82,33 @@ elif [ "${targetWallet}" = "zap-android" ]; then elif [ "${targetWallet}" = "zeus-ios" ]; then connector="lndconnect" - supportsTOR=0 + if [ ${forceTOR} -eq 1 ]; then + echo "error='no tor support'" + exit 1 + fi port="8080" elif [ "${targetWallet}" = "zeus-android" ]; then connector="lndconnect" - supportsTOR=1 port="8080" elif [ "${targetWallet}" = "shango-ios" ]; then connector="shango" - supportsTOR=0 + if [ ${forceTOR} -eq 1 ]; then + echo "error='no tor support'" + exit 1 + fi port="10009" elif [ "${targetWallet}" = "shango-android" ]; then connector="shango" - supportsTOR=0 + if [ ${forceTOR} -eq 1 ]; then + echo "error='no tor support'" + exit 1 + fi port="10009" else @@ -135,7 +127,7 @@ if [ ${#dynDomain} -gt 0 ]; then fi # tunnel thru TOR if running and supported by the wallet -if [ "${runBehindTor}" == "on" ] && [ ${supportsTOR} -eq 1 ]; then +if [ ${forceTOR} -eq 1 ]; then # depending on RPC or REST use different TOR address if [ "${port}" == "10009" ]; then host=$(sudo cat /mnt/hdd/tor/lndrpc10009/hostname) @@ -164,6 +156,15 @@ if [ ${#sshtunnel} -gt 0 ]; then fi fi +# special case: for Zeus android over TOR +hostscreen="${host}" +if [ "${targetWallet}" = "zeus-android" ] && [ ${forceTOR} -eq 1 ]; then + # show TORv2 address on LCD (to make QR code smaller and scannable by Zeus) + host=$(sudo cat /mnt/hdd/tor/lndrest8080fallback/hostname) + # show TORv3 address on Screen + hostscreen=$(sudo cat /mnt/hdd/tor/lndrest8080/hostname) +fi + #### RUN LNDCONNECT imagePath="" @@ -206,8 +207,9 @@ whiptail --backtitle "Connecting Mobile Wallet" \ --no-button "show QR code" \ --yesno "${msg}" 18 65 if [ $? -eq 1 ]; then + # backup - show QR code on screen (not LCD) if [ "${connector}" == "lndconnect" ]; then - lndconnect --host=${host} --port=${port} ${extraparamter} + lndconnect --host=${hostscreen} --port=${port} ${extraparamter} echo "(To shrink QR code: OSX->CMD- / LINUX-> CTRL-) Press ENTER when finished." read key elif [ "${connector}" == "shango" ]; then diff --git a/home.admin/config.scripts/internet.tor.sh b/home.admin/config.scripts/internet.tor.sh index 2a93c7209..c1a6dc8a4 100755 --- a/home.admin/config.scripts/internet.tor.sh +++ b/home.admin/config.scripts/internet.tor.sh @@ -267,7 +267,9 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then sudo mkdir /mnt/hdd/tor/lnd9735 2>/dev/null sudo mkdir /mnt/hdd/tor/lndrpc9735 2>/dev/null sudo mkdir /mnt/hdd/tor/lndrest8080 2>/dev/null - sudo mkdir /mnt/hdd/tor/bitcoinrpc 2>/dev/null + sudo mkdir /mnt/hdd/tor/lndrpc9735fallback 2>/dev/null + sudo mkdir /mnt/hdd/tor/lndrest8080fallback 2>/dev/null + sudo mkdir /mnt/hdd/tor/bitcoin8332 2>/dev/null sudo chmod -R 700 /mnt/hdd/tor sudo chown -R bitcoin:bitcoin /mnt/hdd/tor cat > ./torrc <