#4585 Dont reboot after change of Password B (#4614)

This commit is contained in:
geco91 2024-06-19 22:57:52 +02:00 committed by GitHub
parent c5c984f3e5
commit e4c51fe22e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 48 additions and 24 deletions

View file

@ -338,27 +338,31 @@ elif [ "${abcd}" = "b" ]; then
sed -i "s/^rpcpassword=.*/rpcpassword=${newPassword}/g" /mnt/hdd/${network}/${network}.conf 2>/dev/null
sed -i "s/^rpcpassword=.*/rpcpassword=${newPassword}/g" /home/admin/.${network}/${network}.conf 2>/dev/null
# NOTE: now other bonus apps configs that need passwordB need to be adapted manually
# bonus apps that use a "prestart" will adapt themselves on service restart after reboot
# dont reboot - starting either services manually below or they get restarted thru
# systemd dependencies like on bitcoind (Partof=...) after all configs changed
reboot=0;
# blitzweb
if ! [ -f /etc/nginx/.htpasswd ]; then
echo "${newPassword}" | sudo htpasswd -ci /etc/nginx/.htpasswd admin
else
echo "${newPassword}" | sudo htpasswd -i /etc/nginx/.htpasswd admin
fi
echo "# restart bitcoind"
sudo systemctl restart ${network}d
# NOTE: now other bonus apps configs that need passwordB need to be adapted manually
# bonus apps that use a "prestart" will adapt themselves on service
# electrs
if [ "${ElectRS}" == "on" ]; then
echo "# changing the RPC password for ELECTRS"
RPC_USER=$(cat /mnt/hdd/bitcoin/bitcoin.conf | grep rpcuser | cut -c 9-)
sudo sed -i "s/^auth = \"$RPC_USER.*\"/auth = \"$RPC_USER:${newPassword}\"/g" /home/electrs/.electrs/config.toml
echo "# restarting electrs"
sudo systemctl restart electrs.service
fi
# BTCPayServer
if [ "${BTCPayServer}" == "on" ]; then
echo "# changing the RPC password for BTCPAYSERVER"
sudo sed -i "s/^btc.rpc.password=.*/btc.rpc.password=${newPassword}/g" /home/btcpay/.nbxplorer/Main/settings.config
echo "# restarting btcpay server"
sudo systemctl restart btcpayserver.service
fi
# JoinMarket
@ -367,12 +371,16 @@ elif [ "${abcd}" = "b" ]; then
sudo sed -i "s/^rpc_password =.*/rpc_password = ${newPassword}/g" /home/joinmarket/.joinmarket/joinmarket.cfg
echo "# changing the password for the 'joinmarket' user"
echo "joinmarket:${newPassword}" | sudo chpasswd
echo "# restarting jopinmarket API"
sudo systemctl restart joinmarket-api.service
fi
# ThunderHub
if [ "${thunderhub}" == "on" ]; then
echo "# changing the password for ThunderHub"
sudo sed -i "s/^masterPassword:.*/masterPassword: '${newPassword}'/g" /mnt/hdd/app-data/thunderhub/thubConfig.yaml
echo "# restarting thunderhub.service"
sudo systemctl restart thunderhub.service
fi
# LIT
@ -380,18 +388,26 @@ elif [ "${abcd}" = "b" ]; then
echo "# changing the password for LIT"
sudo sed -i "s/^uipassword=.*/uipassword=${newPassword}/g" /mnt/hdd/app-data/.lit/lit.conf
sudo sed -i "s/^faraday.bitcoin.password=.*/faraday.bitcoin.password=${newPassword}/g" /mnt/hdd/app-data/.lit/lit.conf
echo "# restarting litd.service"
sudo systemctl restart litd.service
fi
# i2pd
if [ "${i2pd}" == "on" ]; then
echo "# changing the password for i2pd"
sudo sed -i "s/^pass = .*/pass = ${newPassword}/g" /etc/i2pd/i2pd.conf
echo "# restarting i2pd.service"
sudo systemctl restart i2pd.service
fi
# LNDg
if [ "${lndg}" == "on" ]; then
echo "# changing the password for lndg"
/home/admin/config.scripts/bonus.lndg.sh set-password "${newPassword}"
echo "# restarting lndg services"
sudo systemctl restart jobs-lndg.service
sudo systemctl restart rebalancer-lndg.service
sudo systemctl restart htlc-stream-lndg.service
fi
# mempool Explorer
@ -400,6 +416,8 @@ elif [ "${abcd}" = "b" ]; then
sudo jq ".CORE_RPC.PASSWORD=\"${newPassword}\"" /home/mempool/mempool/backend/mempool-config.json > /var/cache/raspiblitz/mempool-config.json
sudo mv /var/cache/raspiblitz/mempool-config.json /home/mempool/mempool/backend/mempool-config.json
sudo chown mempool:mempool /home/mempool/mempool/backend/mempool-config.json
echo "# restarting mempool.service"
sudo systemctl restart mempool.service
fi
# elements
@ -407,11 +425,11 @@ elif [ "${abcd}" = "b" ]; then
echo "# changing the password for elements"
sudo sed -i "s/^rpcpassword=.*/rpcpassword=${newPassword}/g" /home/elements/.elements/elements.conf
sudo sed -i "s/^mainchainrpcpassword=.*/mainchainrpcpassword=${newPassword}/g" /home/elements/.elements/elements.conf
echo "# restarting elementsd.service"
sudo systemctl restart elementsd.service
fi
echo "# OK -> RPC Password B changed"
echo "# Reboot is needed (will be triggered if interactive menu was called)"
echo "error=''"
sleep 3
############################

View file

@ -206,6 +206,7 @@ if [ "${mode}" = "on" ] || [ "${mode}" = "1" ]; then
Description=faraday
Wants=lnd.service
After=lnd.service
PartOf=lnd.service
[Service]
User=faraday

View file

@ -161,6 +161,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
Description=Helipad daemon
Wants=lnd.service
After=lnd.service
PartOf=lnd.service
[Service]
WorkingDirectory=$HELIPAD_BUILD_DIR/
ExecStart=$HELIPAD_BIN $HELIPAD_HTTP_PORT

View file

@ -90,6 +90,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
[Unit]
Description=LightningTipBot Service
After=lnd.service
PartOf=lnd.service
[Service]
WorkingDirectory=/home/lightningtipbot/LightningTipBot

View file

@ -817,6 +817,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
Description=lnbits
Wants=${systemdDependency}
After=${systemdDependency}
PartOf=${systemdDependency}
[Service]
WorkingDirectory=/home/lnbits/lnbits

View file

@ -46,6 +46,7 @@ protocol.custom-init=39
echo "[Unit]
Description=lndk Service
After=lnd.service
PartOf=lnd.service
[Service]
ExecStart=/home/bitcoin/lndk/target/debug/lndk --address=https://localhost:10009 --cert=/mnt/hdd/lnd/tls.cert --macaroon=/mnt/hdd/lnd/data/chain/bitcoin/mainnet/admin.macaroon

View file

@ -114,6 +114,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
[Unit]
Description=Loopd Service
After=lnd.service
PartOf=lnd.service
[Service]
WorkingDirectory=/home/loop/loop

View file

@ -48,8 +48,16 @@ echo "# RTLHTTP(${RTLHTTP})"
# construct needed variable elements
configEntry="${netprefix}${typeprefix}rtlWebinterface"
systemdService="${netprefix}${typeprefix}RTL"
dependsOn="bitcoind"
if [ "${LNTYPE}" == "cl" ]; then
dependsOn="${netprefix}lightningd"
elif [ "${LNTYPE}" == "lnd" ]; then
dependsOn="${netprefix}lnd"
fi
echo "# configEntry(${configEntry})"
echo "# systemdService(${systemdService})"
echo "# dependsOn(${dependsOn})"
##########################
# MENU
@ -271,8 +279,9 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
[Unit]
Description=${systemdService} Webinterface
Wants=
After=
Wants=${dependsOn}.service
After=${dependsOn}.service
PartOf=${dependsOn}.service
[Service]
Environment=\"RTL_CONFIG_PATH=/mnt/hdd/app-data/rtl/${systemdService}/\"
@ -297,19 +306,8 @@ WantedBy=multi-user.target
" | sudo tee /etc/systemd/system/${systemdService}.service
sudo chown root:root /etc/systemd/system/${systemdService}.service
# adapt systemd service template for LND
if [ "${LNTYPE}" == "lnd" ]; then
echo "# modifying ${systemdService}.service for LND"
sudo sed -i "s/^Wants=.*/Wants=${netprefix}lnd.service/g" /etc/systemd/system/${systemdService}.service
sudo sed -i "s/^After=.*/After=${netprefix}lnd.service/g" /etc/systemd/system/${systemdService}.service
fi
# adapt systemd service template for
# set up Core LightningREST (if needed)
if [ "${LNTYPE}" == "cl" ]; then
echo "# modifying ${systemdService}.service for CL"
sudo sed -i "s/^Wants=.*/Wants=${netprefix}lightningd.service/g" /etc/systemd/system/${systemdService}.service
sudo sed -i "s/^After=.*/After=${netprefix}lightningd.service/g" /etc/systemd/system/${systemdService}.service
# set up Core LightningREST
/home/admin/config.scripts/cl.rest.sh on ${CHAIN}
fi

View file

@ -49,6 +49,7 @@ echo "
Description=c-lightning daemon on $CHAIN
Requires=${netprefix}bitcoind.service
After=${netprefix}bitcoind.service
PartOf=${netprefix}bitcoind.service
Wants=network-online.target
After=network-online.target

View file

@ -344,6 +344,7 @@ Description=Lightning Network Daemon on $CHAIN
# Make sure lnd starts after bitcoind is ready
Requires=${netprefix}bitcoind.service
After=${netprefix}bitcoind.service
PartOf=${netprefix}bitcoind.service
[Service]
EnvironmentFile=/mnt/hdd/raspiblitz.conf