elecrs: add a HIdden service if Tor is active

This commit is contained in:
openoms
2019-09-21 22:52:34 +01:00
parent bd2ecf561d
commit c87e0b93b9
2 changed files with 27 additions and 8 deletions

View File

@@ -98,10 +98,3 @@ echo "Start Electrs "
echo "***"
echo ""
sudo -u electrs /home/electrs/.cargo/bin/cargo run --release -- --index-batch-size=10 --electrum-rpc-addr="0.0.0.0:50001"
# to preserve settings:
# see https://github.com/romanz/electrs/blob/master/src/config.rs
# sudo nano $HOME/electrs/src/config.rs
# change the lines:
# 73: from: .takes_value(true), to: .default_value("raspibolt:PASSWORD B"),
# 132: from .default_value("Welcome to electrs (Electrum Rust Server)!") to your custom message

View File

@@ -30,4 +30,30 @@ WantedBy=multi-user.target
" | sudo tee -a /etc/systemd/system/electrs.service
sudo systemctl enable electrs
sudo systemctl start electrs
sudo systemctl start electrs
# Hidden Service for electrs if Tor active
source /mnt/hdd/raspiblitz.conf
if [ "${runBehindTor}" = "on" ]; then
isElectrsTor=$(sudo cat /etc/tor/torrc 2>/dev/null | grep -c 'electrs')
if [ ${isElectrsTor} -eq 0 ]; then
echo "
# Hidden Service for Electrum Server
HiddenServiceDir /mnt/hdd/tor/electrs
HiddenServiceVersion 3
HiddenServicePort 50001 127.0.0.1:50001
" | sudo tee -a /etc/tor/torrc
sudo systemctl restart tor
sudo systemctl restart tor@default
fi
TOR_ADDRESS=$(sudo cat /mnt/hdd/tor/electrs/hostname)
echo ""
echo "***"
echo "The hidden service address for electrs is:"
echo "$TOR_ADDRESS"
echo "***"
echo ""
fi