#1798 start systemd services after hdd.boot and copy instead of link ssh keys (#1803)

This commit is contained in:
Christian Rotzoll 2020-11-25 11:39:19 +01:00 committed by rootzoll
parent fe694614af
commit 1230e44258
6 changed files with 27 additions and 10 deletions

View File

@ -114,12 +114,15 @@ else
fi
# link ssh directory from SD catd to HDD
# link ssh directory from SD card to HDD
echo "# --> SSH key settings"
echo "# moving SSH pub keys to HDD"
echo "# copying SSH pub keys to HDD"
sudo cp -r /etc/ssh /mnt/hdd/ssh
sudo rm -rf /etc/ssh
sudo ln -s /mnt/hdd/ssh /etc/ssh
# just copy dont link anymore
# see: https://github.com/rootzoll/raspiblitz/issues/1798
#sudo rm -rf /etc/ssh
#sudo ln -s /mnt/hdd/ssh /etc/ssh
#sudo /home/admin/config.scripts/blitz.systemd.sh update-sshd
echo "# OK"
echo ""

View File

@ -132,13 +132,17 @@ sudo sed -i "s/^alias=.*/alias=${hostname}/g" /home/admin/assets/lnd.${network}.
# link old SSH PubKeys
# so that client ssh_known_hosts is not complaining after update
if [ -d "/mnt/hdd/ssh" ]; then
echo "Old SSH PubKey exists on HDD > just linking them" >> ${logFile}
echo "Old SSH PubKey exists on HDD > copy them HDD to SD card for next start" >> ${logFile}
sudo cp -r /mnt/hdd/ssh/* /etc/ssh/ >> ${logFile} 2>&1
else
echo "No SSH PubKey exists on HDD > copy from SD card and linking them" >> ${logFile}
echo "No SSH PubKey exists on HDD > copy from SD card to HDD as backup" >> ${logFile}
sudo cp -r /etc/ssh /mnt/hdd/ssh >> ${logFile} 2>&1
fi
sudo rm -rf /etc/ssh >> ${logFile} 2>&1
sudo ln -s /mnt/hdd/ssh /etc/ssh >> ${logFile} 2>&1
# just copy - dont link anymore so that sshd will also start without HDD connected
# see: https://github.com/rootzoll/raspiblitz/issues/1798
#sudo rm -rf /etc/ssh >> ${logFile} 2>&1
#sudo ln -s /mnt/hdd/ssh /etc/ssh >> ${logFile} 2>&1
#sudo /home/admin/config.scripts/blitz.systemd.sh update-sshd >> ${logFile} 2>&1
# optimze if RAM >1GB
kbSizeRAM=$(cat /proc/meminfo | grep "MemTotal" | sed 's/[^0-9]*//g')

View File

@ -252,7 +252,7 @@ fi
# SSH SERVER CERTS RESET
# if a file called 'ssh.reset' gets
# placed onto the boot part of
# the sd card - switch to hdmi
# the sd card - delete old ssh data
################################
sshReset=$(sudo ls /boot/ssh.reset* 2>/dev/null | grep -c reset)

View File

@ -3,7 +3,7 @@
[Unit]
Description=execute on every startup before everything else
After=network.target
After=network.target mnt-hdd.mount
[Service]
User=root

View File

@ -124,6 +124,14 @@ elif [ "$1" = "1" ] || [ "$1" = "on" ]; then
sudo apt-get update
sudo apt-get install -y nginx apache2-utils
# additional config
sudo mkdir -p /etc/systemd/system/nginx.service.d
sudo tee /etc/systemd/system/nginx.service.d/raspiblitz.conf >/dev/null <<EOF
# DO NOT EDIT! This file is generate by raspiblitz and will be overwritten
[Unit]
After=network.target nss-lookup.target mnt-hdd.mount
EOF
# make sure that it is enabled and started
sudo systemctl enable nginx
sudo systemctl start nginx

View File

@ -358,6 +358,8 @@ EOF
# DO NOT EDIT! This file is generate by raspiblitz and will be overwritten
[Service]
ReadWriteDirectories=-/mnt/hdd/tor
[Unit]
After=network.target nss-lookup.target mnt-hdd.mount
EOF
else