unlock luks root using ssh

unlock luks root using ssh


install dracut-sshd:

zypper in -y dracut-sshd

add network module to initram:

echo 'add_dracutmodules+=" network "' | tee /etc/dracut.conf.d/90-network.conf

setup network:

add this to cmdline (for grub use /etc/default/grub file):

ip=$IPADDRESS::$GATEWAY:$NETMASK:$HOSTNAME:$INTERFACENAME:off

add your ssh public key to one of this files:

/root/.ssh/dracut_authorized_keys
/etc/dracut-sshd/authorized_keys
/root/.ssh/authorized_keys

update initramfs & grub config:

/usr/bin/dracut -f -v
/usr/sbin/update-bootloader

reboot & try:

systemctl reboot

connect:

ssh root@$IPADDRESS

after connecting you will see this:

Welcome to the early boot SSH environment. You may type

 systemd-tty-ask-password-agent

(or press "arrow up") to unlock your disks.

This shell will terminate automatically a few seconds after the
unlocking process has succeeded and when the boot proceeds. 

initramfs-ssh:/root#

to unlock the partition you must type the following, press enter and enter the password:

systemd-tty-ask-password-agent

(in fact, just press the "up arrow" and enter in order to get a password request)

Содержание