|
|
@ -121,14 +121,6 @@ sudo systemctl daemon-reload |
|
|
|
sudo systemctl restart tor@default |
|
|
|
echo "" |
|
|
|
|
|
|
|
echo "*** Setting Permissions ***" |
|
|
|
# so that chain network can create Tor hidden service |
|
|
|
#echo "setting bitcoind permissions" |
|
|
|
#sudo usermod -a -G debian-tor bitcoin |
|
|
|
# so that you can run `arm` as user |
|
|
|
#echo "setting pi permissions" |
|
|
|
#sudo usermod -a -G debian-tor pi |
|
|
|
|
|
|
|
echo "*** Waiting for TOR to boostrap ***" |
|
|
|
torIsBootstrapped=0 |
|
|
|
while [ ${torIsBootstrapped} -eq 0 ] |
|
|
@ -144,66 +136,72 @@ done |
|
|
|
echo "OK - Tor Bootstrap is ready" |
|
|
|
echo "" |
|
|
|
|
|
|
|
if [ "${network}" = "bitcoin" ]; then |
|
|
|
echo "*** Changing ${network} Config ***" |
|
|
|
networkIsTor=$(sudo cat /home/bitcoin/.${network}/${network}.conf | grep 'onlynet=onion' -c) |
|
|
|
if [ ${networkIsTor} -eq 0 ]; then |
|
|
|
|
|
|
|
echo "Only Connect thru TOR" |
|
|
|
echo "onlynet=onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf |
|
|
|
|
|
|
|
echo "*** Changing ${network} Config ***" |
|
|
|
networkIsTor=$(sudo cat /home/bitcoin/.${network}/${network}.conf | grep 'onlynet=onion' -c) |
|
|
|
if [ ${networkIsTor} -eq 0 ]; then |
|
|
|
echo "Only Connect thru TOR" |
|
|
|
echo "onlynet=onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf |
|
|
|
echo "Adding some nodes to connect to" |
|
|
|
if [ "${network}" = "bitcoin" ]; then |
|
|
|
echo "Adding some bitcoin onion nodes to connect to" |
|
|
|
echo "addnode=fno4aakpl6sg6y47.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf |
|
|
|
echo "addnode=toguvy5upyuctudx.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf |
|
|
|
echo "addnode=ndndword5lpb7eex.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf |
|
|
|
echo "addnode=6m2iqgnqjxh7ulyk.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf |
|
|
|
echo "addnode=5tuxetn7tar3q5kp.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf |
|
|
|
sudo cp /home/bitcoin/.${network}/${network}.conf /home/admin/.${network}/${network}.conf |
|
|
|
sudo chown admin:admin /home/admin/.${network}/${network}.conf |
|
|
|
else |
|
|
|
echo "Chain network already configured for TOR" |
|
|
|
fi |
|
|
|
|
|
|
|
echo "*** ${network} re-init - Waiting for Onion Address ***" |
|
|
|
# restarting bitcoind to start with tor and generare onion.address |
|
|
|
echo "restarting ${network}d ..." |
|
|
|
sudo systemctl restart ${network}d |
|
|
|
sleep 8 |
|
|
|
onionAddress="" |
|
|
|
while [ ${#onionAddress} -eq 0 ] |
|
|
|
do |
|
|
|
echo "--- Checking ---" |
|
|
|
date +%s |
|
|
|
testNetAdd="" |
|
|
|
if [ "${chain}" = "test" ];then |
|
|
|
testNetAdd="/testnet3" |
|
|
|
fi |
|
|
|
sudo cat /mnt/hdd/${network}${testNetAdd}/debug.log 2>/dev/null | grep "tor" | tail -n 10 |
|
|
|
onionAddress=$(${network}-cli getnetworkinfo | grep '"address"' | cut -d '"' -f4) |
|
|
|
echo "If this takes too long --> CTRL+c, reboot and check manually" |
|
|
|
sleep 5 |
|
|
|
done |
|
|
|
onionPort=$(${network}-cli getnetworkinfo | grep '"port"' | tr -dc '0-9') |
|
|
|
echo "Your Chain Network Onion Address is: ${onionAddress}:${onionPort}" |
|
|
|
echo "" |
|
|
|
sudo cp /home/bitcoin/.${network}/${network}.conf /home/admin/.${network}/${network}.conf |
|
|
|
sudo chown admin:admin /home/admin/.${network}/${network}.conf |
|
|
|
|
|
|
|
else |
|
|
|
echo "Dont run '${network}' behind tor" |
|
|
|
fi |
|
|
|
echo "Chain network already configured for TOR" |
|
|
|
fi |
|
|
|
|
|
|
|
echo "*** ${network} re-init - Waiting for Onion Address ***" |
|
|
|
# restarting bitcoind to start with tor and generare onion.address |
|
|
|
echo "restarting ${network}d ..." |
|
|
|
sudo systemctl restart ${network}d |
|
|
|
sleep 8 |
|
|
|
onionAddress="" |
|
|
|
while [ ${#onionAddress} -eq 0 ] |
|
|
|
do |
|
|
|
echo "--- Checking ---" |
|
|
|
date +%s |
|
|
|
testNetAdd="" |
|
|
|
if [ "${chain}" = "test" ];then |
|
|
|
testNetAdd="/testnet3" |
|
|
|
fi |
|
|
|
sudo cat /mnt/hdd/${network}${testNetAdd}/debug.log 2>/dev/null | grep "tor" | tail -n 10 |
|
|
|
onionAddress=$(${network}-cli getnetworkinfo | grep '"address"' | cut -d '"' -f4) |
|
|
|
echo "If this takes too long --> CTRL+c, reboot and check manually" |
|
|
|
sleep 5 |
|
|
|
done |
|
|
|
onionPort=$(${network}-cli getnetworkinfo | grep '"port"' | tr -dc '0-9') |
|
|
|
echo "Your Chain Network Onion Address is: ${onionAddress}:${onionPort}" |
|
|
|
echo "" |
|
|
|
|
|
|
|
#echo "*** Setting your Onion Address ***" |
|
|
|
#onionLND=$(sudo cat /mnt/hdd/tor/lnd9735/hostname) |
|
|
|
#echo "Your Lightning Tor Onion Address is: ${onionLND}:9735" |
|
|
|
#echo "" |
|
|
|
echo "*** Setting your Onion Address ***" |
|
|
|
onionLND=$(sudo cat /mnt/hdd/tor/lnd9735/hostname) |
|
|
|
echo "Your Lightning Tor Onion Address is: ${onionLND}:9735" |
|
|
|
echo "" |
|
|
|
|
|
|
|
# ACTIVATE LND OVER TOR |
|
|
|
echo "*** Putting LND behind TOR ***" |
|
|
|
echo "Disable LND again" |
|
|
|
sudo systemctl disable lnd |
|
|
|
|
|
|
|
echo "Writing Public Onion Address to /run/publicip" |
|
|
|
echo "PUBLICIP=${onionLND}" | sudo tee /run/publicip |
|
|
|
echo "Configure and Changing to lnd.tor.service" |
|
|
|
sed -i "5s/.*/Wants=${network}d.service/" ./assets/lnd.tor.service |
|
|
|
sed -i "6s/.*/After=${network}d.service/" ./assets/lnd.tor.service |
|
|
|
sudo cp /home/admin/assets/lnd.tor.service /etc/systemd/system/lnd.service |
|
|
|
sudo chmod +x /etc/systemd/system/lnd.service |
|
|
|
echo "Enable LND again" |
|
|
|
sudo systemctl enable lnd |
|
|
|
echo "OK" |
|
|
|
echo "" |
|
|
|
|
|
|
|
echo "*** Finshing Setup / REBOOT ***" |
|
|
|
echo "OK - all should be set" |
|
|
|