Startup Script für verschlüsseltes Debian System
Um die einzelnen Schritte für das Starten meines verschlüsselten Debian Servers zu automatisieren konnte ich auf Basis dieses Beitrags alle Schritte in ein Script zusammenfassen
#!/bin/bash
sudo wakeonlan e4:1faa:zz:yy:xx
printf "%s" "waiting for Server ..."
while ! timeout 0.2 ping -c 1 -n serveraddresse &> /dev/null
do
printf "%c" "."
done
printf "\n%s\n" "Server is back online"
ssh -i /home/hbauer/.ssh/id_rsa_initram root@192.168.xxx.yy -p 22
Das sieht dann so aus
wecken-server.sh
Sending magic packet to 255.255.255.255:9 with e4:1faa:zz:yy:xx
waiting for ServerXY ............................................................................................................................................................................................................................................................................................................................................
Server is back online
Enter passphrase for key '/home/hbauer/.ssh/id_rsa_initram':
To unlock root partition, and maybe others like swap, run `cryptroot-unlock`
BusyBox v1.22.1 (Debian 1:1.22.0-19+b3) built-in shell (ash)
Enter 'help' for a list of built-in commands.
~ # cryptroot-unlock
Please unlock disk sda3_crypt:
cryptsetup: sda3_crypt set up successfully
~ # packet_write_wait: Connection to 192.168.xxx.yyy port 22: Broken pipe