mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-04-14 06:39:24 +02:00
lnd.check.sh -> harden rpc user/pass parsing against double entries (#3282)
This commit is contained in:
parent
922ad2ff5a
commit
21616e4ec2
@ -154,11 +154,25 @@ if [ "$1" == "prestart" ]; then
|
||||
setting ${lndConfFile} ${insertLine} "${network}d\.zmqpubrawblock" "tcp\:\/\/127\.0\.0\.1\:${zmqprefix}332"
|
||||
|
||||
# SET/UPDATE rpcpass
|
||||
RPCPSW=$(cat /mnt/hdd/${network}/${network}.conf | grep "rpcpassword=" | cut -d "=" -f2)
|
||||
RPCPSW=$(cat /mnt/hdd/${network}/${network}.conf | grep "^rpcpassword=" | tail -1 | cut -d "=" -f2 | tail -n 1)
|
||||
if [ "${RPCPSW}" == "" ]; then
|
||||
RPCPSW=$(cat /mnt/hdd/${network}/${network}.conf | grep "^${network}d.rpcpassword=" | cut -d "=" -f2 | tail -n 1)
|
||||
fi
|
||||
if [ "${RPCPSW}" == "" ]; then
|
||||
1>&2 echo "FAIL: 'rpcpassword' not found in /mnt/hdd/${network}/${network}.conf"
|
||||
exit 11
|
||||
fi
|
||||
setting ${lndConfFile} ${insertLine} "${network}d\.rpcpass" "${RPCPSW}"
|
||||
|
||||
# SET/UPDATE rpcuser
|
||||
RPCUSER=$(cat /mnt/hdd/${network}/${network}.conf | grep "rpcuser=" | cut -d "=" -f2)
|
||||
RPCUSER=$(cat /mnt/hdd/${network}/${network}.conf | grep "^rpcuser=" | cut -d "=" -f2 | tail -n 1)
|
||||
if [ "${RPCUSER}" == "" ]; then
|
||||
RPCUSER=$(cat /mnt/hdd/${network}/${network}.conf | grep "^${network}d.rpcuser=" | cut -d "=" -f2 | tail -n 1)
|
||||
fi
|
||||
if [ "${RPCUSER}" == "" ]; then
|
||||
1>&2 echo "FAIL: 'rpcuser' not found in /mnt/hdd/${network}/${network}.conf"
|
||||
exit 12
|
||||
fi
|
||||
setting ${lndConfFile} ${insertLine} "${network}d\.rpcuser" "${RPCUSER}"
|
||||
|
||||
# SET/UPDATE rpchost
|
||||
|
Loading…
x
Reference in New Issue
Block a user