Improve startup regrarding urandom stuff
This commit is contained in:
parent
0a1e537f0e
commit
b9685e7fff
|
@ -77,26 +77,38 @@ rm -rf /etc/motd # Remove simple motd for update-motd.d
|
|||
# Make any users we need to
|
||||
useradd -m -s /bin/bash pivpn || true
|
||||
|
||||
# Regen SSH keys
|
||||
if [ ! -f /home/bitcoin/.mynode/.gensshkeys ]; then
|
||||
# Regen SSH keys (check if force regen or keys are missing / empty)
|
||||
while [ ! -f /home/bitcoin/.mynode/.gensshkeys ] ||
|
||||
[ ! -f /mnt/hdd/mynode/settings/.btcrpcpw ] ||
|
||||
[ ! -s /mnt/hdd/mynode/settings/.btcrpcpw ] ||
|
||||
[ ! -f /etc/ssh/ssh_host_ecdsa_key.pub ] ||
|
||||
[ ! -s /etc/ssh/ssh_host_ecdsa_key.pub ] ||
|
||||
[ ! -f /etc/ssh/ssh_host_ed25519_key.pub ] ||
|
||||
[ ! -s /etc/ssh/ssh_host_ed25519_key.pub ] ||
|
||||
[ ! -f /etc/ssh/ssh_host_rsa_key.pub ] ||
|
||||
[ ! -s /etc/ssh/ssh_host_rsa_key.pub ]
|
||||
do
|
||||
sleep 10s
|
||||
rm -rf /etc/ssh/ssh_host_*
|
||||
dpkg-reconfigure openssh-server
|
||||
systemctl restart ssh
|
||||
|
||||
touch /home/bitcoin/.mynode/.gensshkeys
|
||||
fi
|
||||
done
|
||||
|
||||
# Sync product key (SD preferred)
|
||||
cp -f /home/bitcoin/.mynode/.product_key* /mnt/hdd/mynode/settings/ || true
|
||||
cp -f /mnt/hdd/mynode/settings/.product_key* home/bitcoin/.mynode/ || true
|
||||
|
||||
# Randomize RPC password
|
||||
if [ ! -f /mnt/hdd/mynode/settings/.btcrpcpw ] || [ ! -s /mnt/hdd/mynode/settings/.btcrpcpw ]; then
|
||||
while [ ! -f /mnt/hdd/mynode/settings/.btcrpcpw ] || [ ! -s /mnt/hdd/mynode/settings/.btcrpcpw ]
|
||||
do
|
||||
# Write random pw to .btcrpcpw
|
||||
sleep 10s
|
||||
< /dev/urandom tr -dc A-Za-z0-9 | head -c${1:-24} > /mnt/hdd/mynode/settings/.btcrpcpw
|
||||
chown bitcoin:bitcoin /mnt/hdd/mynode/settings/.btcrpcpw
|
||||
chmod 600 /mnt/hdd/mynode/settings/.btcrpcpw
|
||||
fi
|
||||
done
|
||||
|
||||
# Setup LND Node Name
|
||||
if [ ! -f /mnt/hdd/mynode/settings/.lndalias ]; then
|
||||
|
|
Loading…
Reference in New Issue
Block a user