diff --git a/docker/my-dojo/dojo.sh b/docker/my-dojo/dojo.sh index 10a6d3c..b3cddad 100755 --- a/docker/my-dojo/dojo.sh +++ b/docker/my-dojo/dojo.sh @@ -352,34 +352,69 @@ upgrade() { fi } -# Display the onion address +# Display the onion addresses onion() { + version=3 + + # Extract version arguments + if [ $# -gt 0 ]; then + for option in $@ + do + case "$option" in + v2 ) version=2 ;; + v3 ) version=3 ;; + * ) break ;; + esac + done + fi + echo " " echo "WARNING: Do not share these onion addresses with anyone!" echo " To allow another person to use this Dojo with their Samourai Wallet," echo " you should share the QRCodes provided by the Maintenance Tool." echo " " - V3_ADDR=$( docker exec -it tor cat /var/lib/tor/hsv3dojo/hostname ) - echo "Dojo API and Maintenance Tool = $V3_ADDR" - echo " " - - if [ "$EXPLORER_INSTALL" == "on" ]; then - V3_ADDR_EXPLORER=$( docker exec -it tor cat /var/lib/tor/hsv3explorer/hostname ) - echo "Block Explorer = $V3_ADDR_EXPLORER" + if [ $version -eq 3 ]; then + # V3 onion addresses + V3_ADDR=$( docker exec -it tor cat /var/lib/tor/hsv3dojo/hostname ) + echo "Dojo API and Maintenance Tool = $V3_ADDR" echo " " - fi - if [ "$WHIRLPOOL_INSTALL" == "on" ]; then - V3_ADDR_WHIRLPOOL=$( docker exec -it tor cat /var/lib/tor/hsv3whirlpool/hostname ) - echo "Your private Whirlpool client (do not share) = $V3_ADDR_WHIRLPOOL" + if [ "$EXPLORER_INSTALL" == "on" ]; then + V3_ADDR_EXPLORER=$( docker exec -it tor cat /var/lib/tor/hsv3explorer/hostname ) + echo "Block Explorer = $V3_ADDR_EXPLORER" + echo " " + fi + + if [ "$WHIRLPOOL_INSTALL" == "on" ]; then + V3_ADDR_WHIRLPOOL=$( docker exec -it tor cat /var/lib/tor/hsv3whirlpool/hostname ) + echo "Your private Whirlpool client (do not share) = $V3_ADDR_WHIRLPOOL" + echo " " + fi + + if [ "$BITCOIND_INSTALL" == "on" ]; then + if [ "$BITCOIND_LISTEN_MODE" == "on" ]; then + V3_ADDR_BTCD=$( docker exec -it tor cat /var/lib/tor/hsv3bitcoind/hostname ) + echo "Your local bitcoind (do not share) = $V3_ADDR_BTCD" + echo " " + fi + fi + + else + # v2 onion addresses + V2_ADDR=$( docker exec -it tor cat /var/lib/tor/hsv2dojo/hostname ) + echo "Dojo API and Maintenance Tool = $V2_ADDR" echo " " - fi - if [ "$BITCOIND_INSTALL" == "on" ]; then - if [ "$BITCOIND_LISTEN_MODE" == "on" ]; then - V3_ADDR_BTCD=$( docker exec -it tor cat /var/lib/tor/hsv3bitcoind/hostname ) - echo "Your local bitcoind (do not share) = $V3_ADDR_BTCD" + if [ "$EXPLORER_INSTALL" == "on" ]; then + V2_ADDR_EXPLORER=$( docker exec -it tor cat /var/lib/tor/hsv2explorer/hostname ) + echo "Block Explorer = $V2_ADDR_EXPLORER" + echo " " + fi + + if [ "$WHIRLPOOL_INSTALL" == "on" ]; then + V2_ADDR_WHIRLPOOL=$( docker exec -it tor cat /var/lib/tor/hsv2whirlpool/hostname ) + echo "Your private Whirlpool client (do not share) = $V2_ADDR_WHIRLPOOL" echo " " fi fi @@ -517,7 +552,11 @@ help() { echo " Available options:" echo " -n [VALUE] : display the last VALUE lines" echo " " - echo " onion Display the Tor onion address allowing your wallet to access your dojo." + echo " onion [version] Display the Tor onion addresses allowing your wallet to access your dojo." + echo " " + echo " Available versions:" + echo " v2: display Tor v2 onion addresses" + echo " v3 (default): display Tor v3 onion addresses" echo " " echo " restart Restart your dojo." echo " " @@ -611,7 +650,7 @@ case "$subcommand" in logs "$module" $numlines ;; onion ) - onion + onion "$@" ;; restart ) restart diff --git a/docker/my-dojo/tor/restart.sh b/docker/my-dojo/tor/restart.sh index 18f72a2..26e66ef 100644 --- a/docker/my-dojo/tor/restart.sh +++ b/docker/my-dojo/tor/restart.sh @@ -31,6 +31,11 @@ if [ "$BITCOIND_INSTALL" == "on" ]; then fi if [ "$EXPLORER_INSTALL" == "on" ]; then + tor_options+=(--HiddenServiceDir /var/lib/tor/hsv2explorer) + tor_options+=(--HiddenServiceVersion 2) + tor_options+=(--HiddenServicePort "80 172.29.1.3:9080") + tor_options+=(--HiddenServiceDirGroupReadable 1) + tor_options+=(--HiddenServiceDir /var/lib/tor/hsv3explorer) tor_options+=(--HiddenServiceVersion 3) tor_options+=(--HiddenServicePort "80 172.29.1.3:9080") @@ -38,6 +43,11 @@ if [ "$EXPLORER_INSTALL" == "on" ]; then fi if [ "$WHIRLPOOL_INSTALL" == "on" ]; then + tor_options+=(--HiddenServiceDir /var/lib/tor/hsv2whirlpool) + tor_options+=(--HiddenServiceVersion 2) + tor_options+=(--HiddenServicePort "80 172.29.1.3:8898") + tor_options+=(--HiddenServiceDirGroupReadable 1) + tor_options+=(--HiddenServiceDir /var/lib/tor/hsv3whirlpool) tor_options+=(--HiddenServiceVersion 3) tor_options+=(--HiddenServicePort "80 172.29.1.3:8898")