fix(install-scripts): correct critical bugs in contrib scripts

- download_and_install_bitcoincore.sh:
  - Fix apt install with single-quoted string (was treating all deps as one package)
  - Add sudo to apt install commands
  - Fix tar extraction: now finds extracted dir and copies bitcoind/bitcoin-cli to /usr/local/bin
  - Fix zmqpubrawblock -> zmqpubhashblock (pusher expects hashblock topic)
  - Fix install check (0 was testing cd, not tar) with explicit extraction check
  - Handle existing user in adduser
  - Fix source lib.sh path

- download_and_install_bal.sh:
  - Use curl -sfL (fail on 404, follow redirects) for Gitea download
  - Add null/empty check after jq download URL extraction
  - Change certbot --standalone to --nginx (avoids port 80 conflict)
  - Enable nginx site symlink (was commented out)
  - Handle existing 'bal' user in adduser

- install_tor.sh:
  - Add sudo to all root-requiring commands (apt, tee, cp, sed, systemctl)
  - Backup torrc with timestamp before modifying
  - Add DisableDebuggerAttachment hardening
This commit is contained in:
2026-07-16 19:39:10 -04:00
parent 538e72f806
commit da2124031e
3 changed files with 41 additions and 27 deletions

View File

@@ -52,7 +52,7 @@ for cmd in $CMD_DEPENDENCIES
do
if [ $(which $cmd >/dev/null 2>&1; echo $?) != 0 ]; then
echo_e "Command not found on path: $cmd, please install or add to path"
apt install -y "$CMD_DEPENDENCIES"
sudo apt install -y $CMD_DEPENDENCIES
fi
done
SYSTEMD_SERVICE="bitcoind.service"
@@ -201,19 +201,24 @@ install_bitcoin_core () {
cd $VERSION_NUM_FULL
tar xzf *.tar.gz
# Copy binaries to /usr/local/bin
extract_dir=$(find . -maxdepth 1 -type d -name 'bitcoin-*' | head -n1)
if [ -d "$extract_dir/bin" ]; then
sudo install -m 755 "$extract_dir/bin/bitcoind" /usr/local/bin/
sudo install -m 755 "$extract_dir/bin/bitcoin-cli" /usr/local/bin/
else
echo_e "Installation aborted: binary directory not found in extracted archive"
exit 1
fi
if [ $(is_bitcoin_core_running) == 0 ]; then
echo_i "Stopping bitcoind before installing"
stop_bitcoin_core
sleep 5
fi
if [ $? == 0 ]; then
echo_s "Bitcoin Core $VERSION_NUM successfully installed!"
touch .installed
else
echo_e "Installation aborted: error while installing"
exit 1
fi
echo_s "Bitcoin Core $VERSION_NUM successfully installed!"
touch .installed
cd ..
echo $VERSION_NUM > .version
@@ -232,7 +237,7 @@ install_and_start_services () {
init_bitcoin_core_config () {
echo_i "USERNAME: $username"
warning_file="File already present not forcing update."
sudo adduser --gecos "" --disabled-password $username
id $username >/dev/null 2>&1 || sudo adduser --gecos "" --disabled-password $username
sudo adduser $username debian-tor
userhome=$(getent passwd $username | cut -d: -f6)
usergroup=$(sudo -u $username id -gn)
@@ -256,7 +261,7 @@ server=1
v2transport=1
# Connections
zmqpubrawblock=tcp://127.0.0.1:28332
zmqpubhashblock=tcp://127.0.0.1:28332
zmqpubrawtx=tcp://127.0.0.1:28333
maxuploadtarget=5000