Browse Source

master merge

dev
rootzoll 6 years ago
parent
commit
89f833b353
  1. 16
      build.sdcard/raspbianStretchDesktop.sh
  2. 20
      home.admin/40addHDD.sh
  3. 2
      home.admin/90finishSetup.sh
  4. 2
      home.admin/95finalSetup.sh
  5. 4
      home.admin/_bootstrap.sh
  6. 4
      home.admin/config.scripts/bonus.rtl.sh
  7. 195
      home.admin/config.scripts/internet.tor.sh

16
build.sdcard/raspbianStretchDesktop.sh

@ -494,22 +494,6 @@ sudo chmod +x /home/admin/_background.sh
sudo cp ./assets/background.service /etc/systemd/system/background.service
sudo systemctl enable background
# Prepare for TOR service
echo "*** Adding Tor Sources to sources.list ***"
echo "deb http://deb.torproject.org/torproject.org stretch main" | sudo tee -a /etc/apt/sources.list
echo "deb-src http://deb.torproject.org/torproject.org stretch main" | sudo tee -a /etc/apt/sources.list
echo "OK"
echo ""
echo "*** Installing dirmngr ***"
sudo apt install dirmngr
echo ""
echo "*** Fetching GPG key ***"
sudo gpg --keyserver keys.gnupg.net --recv 886DDD89
sudo gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -
sudo gpg --keyserver pgpkeys.mit.edu --recv-key 74A941BA219EC810
sudo gpg -a --export 74A941BA219EC810 | sudo apt-key add -
echo "!!!!!! Please check if the above really worked!"
# *** RASPIBLITZ IMAGE READY ***
echo ""
echo "**********************************************"

20
home.admin/40addHDD.sh

@ -42,19 +42,23 @@ if [ ${existsHDD} -gt 0 ]; then
sudo mount -a
mountOK=$(df | grep -c /mnt/hdd)
if [ ${mountOK} -eq 1 ]; then
echo "OK - HDD is mounted"
echo ""
# init the RASPIBLITZ Config
source /home/admin/_version.info
configFile="/mnt/hdd/raspiblitz.conf"
sudo touch $configFile
sudo chmod 777 ${configFile}
echo "# RASPIBLITZ CONFIG FILE" > $configFile
echo "raspiBlitzVersion='${codeVersion}'" >> $configFile
echo "network=${network}" >> $configFile
echo "chain=${chain}" >> $configFile
echo "hostname=${hostname}" >> $configFile
configExists=$(sudo ls ${configFile} | grep -c 'raspiblitz.conf')
if [ ${configExists} -eq 0 ]; then
source /home/admin/_version.info
sudo touch $configFile
sudo chmod 777 ${configFile}
echo "# RASPIBLITZ CONFIG FILE" > $configFile
echo "raspiBlitzVersion='${codeVersion}'" >> $configFile
echo "network=${network}" >> $configFile
echo "chain=${chain}" >> $configFile
echo "hostname=${hostname}" >> $configFile
fi
# move SSH pub keys to HDD so that they survive an update
echo "moving SSH pub keys to HDD"

2
home.admin/90finishSetup.sh

@ -87,4 +87,4 @@ sudo apt-get update
echo "OK - System is now up to date"
# mark setup is done
sudo sed -i "s/^setupStep=.*/setupStep=90/g" /home/admin/raspiblitz.info
sudo sed -i "s/^setupStep=.*/setupStep=100/g" /home/admin/raspiblitz.info

2
home.admin/95finalSetup.sh

@ -29,7 +29,7 @@ cp $logFile /home/admin/raspiblitz.setup.log
echo "Setting the Name/Alias/Hostname .."
sudo /home/admin/config.scripts/lnd.setname.sh ${hostname}
# mark setup is done (100%)
# mark setup is done
sudo sed -i "s/^setupStep=.*/setupStep=100/g" /home/admin/raspiblitz.info
clear

4
home.admin/_bootstrap.sh

@ -51,7 +51,9 @@ echo "message=" >> $infoFile
echo "network=${network}" >> $infoFile
echo "chain=${chain}" >> $infoFile
echo "setupStep=${setupStep}" >> $infoFile
echo "hostname=${hostname}" >> $infoFile
if [ "${setupStep}" != "100" ]; then
echo "hostname=${hostname}" >> $infoFile
fi
sudo chmod 777 ${infoFile}
################################

4
home.admin/config.scripts/bonus.rtl.sh

@ -46,7 +46,9 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "*** Get the RTL Source Code ***"
git clone https://github.com/ShahanaFarooqui/RTL.git
cd RTL
git reset --hard v0.1.13-alpha
#git reset --hard v0.1.13-alpha
git reset --hard v0.1.14-alpha
# install
echo "*** Run: npm install ***"

195
home.admin/config.scripts/internet.tor.sh

@ -56,24 +56,61 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo ""
fi
echo "*** Updating System ***"
sudo apt-get update
echo ""
# check if TOR package is installed
packageInstalled=$(dpkg -s tor-arm | grep -c 'Status: install ok')
if [ ${packageInstalled} -eq 0 ]; then
# Prepare for TOR service
echo "*** Install TOR repo keys ***"
recvKeyResult=$(sudo gpg --keyserver keys.gnupg.net --recv 886DDD89 2>&1)
echo "${recvKeyResult}"
recvKeyFailed=$(echo "${recvKeyResult}" | grep -c 'Total number processed: 0')
if [ ${recvKeyFailed} -eq 1 ]; then
echo "FAILED: sudo gpg --keyserver keys.gnupg.net --recv 886DDD89"
exit 1
fi
sudo gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -
echo ""
recvKeyResult=$(sudo gpg --keyserver pgpkeys.mit.edu --recv-key 74A941BA219EC810 2>&1)
echo "${recvKeyResult}"
recvKeyFailed=$(echo "${recvKeyResult}" | grep -c 'Total number processed: 0')
if [ ${recvKeyFailed} -eq 1 ]; then
echo "FAILED: sudo gpg --keyserver pgpkeys.mit.edu --recv-key 74A941BA219EC810"
exit 1
fi
sudo gpg -a --export 74A941BA219EC810 | sudo apt-key add -
echo ""
echo "*** Install Tor ***"
sudo apt install tor tor-arm -y
echo "*** Adding Tor Sources to sources.list ***"
echo "deb https://deb.torproject.org/torproject.org stretch main" | sudo tee -a /etc/apt/sources.list
echo "deb-src https://deb.torproject.org/torproject.org stretch main" | sudo tee -a /etc/apt/sources.list
echo "OK"
echo ""
echo ""
echo "*** Tor Config ***"
sudo rm -r -f /mnt/hdd/tor 2>/dev/null
sudo mkdir /mnt/hdd/tor
sudo mkdir /mnt/hdd/tor/sys
sudo mkdir /mnt/hdd/tor/web80
sudo mkdir /mnt/hdd/tor/lnd9735
sudo mkdir /mnt/hdd/tor/lndrpc9735
sudo chmod -R 700 /mnt/hdd/tor
sudo chown -R bitcoin:bitcoin /mnt/hdd/tor
cat > ./torrc <<EOF
echo "*** Updating System ***"
sudo apt-get update
echo ""
echo "*** Installing dirmngr ***"
sudo apt install dirmngr -y
echo ""
echo "*** Install Tor ***"
sudo apt install tor tor-arm -y
echo ""
echo "*** Tor Config ***"
#sudo rm -r -f /mnt/hdd/tor 2>/dev/null
sudo mkdir /mnt/hdd/tor 2>/dev/null
sudo mkdir /mnt/hdd/tor/sys 2>/dev/null
sudo mkdir /mnt/hdd/tor/web80 2>/dev/null
sudo mkdir /mnt/hdd/tor/lnd9735 2>/dev/null
sudo mkdir /mnt/hdd/tor/lndrpc9735 2>/dev/null
sudo chmod -R 700 /mnt/hdd/tor
sudo chown -R bitcoin:bitcoin /mnt/hdd/tor
cat > ./torrc <<EOF
### See 'man tor', or https://www.torproject.org/docs/tor-manual.html
DataDirectory /mnt/hdd/tor/sys
@ -111,94 +148,62 @@ HiddenServicePort 9735 127.0.0.1:9735
# NOTE: bitcoind get tor service automatically - see /mnt/hdd/bitcoin for onion key
EOF
sudo rm $torrc
sudo mv ./torrc $torrc
sudo chmod 644 $torrc
sudo chown -R bitcoin:bitcoin /var/run/tor/
echo ""
sudo rm $torrc
sudo mv ./torrc $torrc
sudo chmod 644 $torrc
sudo chown -R bitcoin:bitcoin /var/run/tor/
echo ""
# NYX - Tor monitor tool
# https://nyx.torproject.org/#home
echo "*** Installing NYX - TOR monitoring Tool ***"
nyxInstalled=$(sudo pip list 2>/dev/null | grep 'nyx' -c)
if [ ${nyxInstalled} -eq 0 ]; then
sudo pip install nyx
else
echo "NYX already installed"
fi
echo ""
# NYX - Tor monitor tool
# https://nyx.torproject.org/#home
echo "*** Installing NYX - TOR monitoring Tool ***"
nyxInstalled=$(sudo pip list 2>/dev/null | grep 'nyx' -c)
if [ ${nyxInstalled} -eq 0 ]; then
sudo pip install nyx
else
echo "NYX already installed"
fi
echo ""
echo "*** Activating TOR system service ***"
echo "ReadWriteDirectories=-/mnt/hdd/tor" | sudo tee -a /lib/systemd/system/tor@default.service
sudo systemctl daemon-reload
sudo systemctl enable tor@default
echo ""
echo "*** Activating TOR system service ***"
echo "ReadWriteDirectories=-/mnt/hdd/tor" | sudo tee -a /lib/systemd/system/tor@default.service
sudo systemctl daemon-reload
sudo systemctl enable tor@default
echo ""
#echo "*** Waiting for TOR to boostrap ***"
#torIsBootstrapped=0
#while [ ${torIsBootstrapped} -eq 0 ]
#do
# echo "--- Checking 1 ---"
# date +%s
# sudo cat /mnt/hdd/tor/notice.log 2>/dev/null | grep "Bootstrapped" | tail -n 10
# torIsBootstrapped=$(sudo cat /mnt/hdd/tor/notice.log 2>/dev/null | grep "Bootstrapped 100" -c)
# echo "torIsBootstrapped(${torIsBootstrapped})"
# echo "If this takes too long --> CTRL+c, reboot and check manually"
# sleep 5
#done
#echo "OK - Tor Bootstrap is ready"
#echo ""
echo "*** Changing ${network} Config ***"
networkIsTor=$(sudo cat /home/bitcoin/.${network}/${network}.conf | grep 'onlynet=onion' -c)
if [ ${networkIsTor} -eq 0 ]; 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
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
fi
echo "Only Connect thru TOR"
echo "onlynet=onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
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
fi
sudo cp /home/bitcoin/.${network}/${network}.conf /home/admin/.${network}/${network}.conf
sudo chown admin:admin /home/admin/.${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
else
echo "Chain network already configured for TOR"
echo "TOR package/service is installed and was prepared earlier .. just activating again"
echo "*** Enable TOR service ***"
sudo systemctl ensable tor@default
echo ""
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 2 ---"
# 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=$(sudo -u bitcoin ${network}-cli getnetworkinfo | grep '"address"' | cut -d '"' -f4)
# echo "Can take up to 20min - if this takes longer --> CTRL+c, reboot and check manually"
# sleep 5
#done
#onionPort=$(sudo -u bitcoin ${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 ""
# ACTIVATE LND OVER TOR
echo "*** Putting LND behind TOR ***"

Loading…
Cancel
Save