Last active
August 3, 2022 11:39
-
-
Save baurmatt/fc596e0ee3be1fcff7fbac850c5cd64c to your computer and use it in GitHub Desktop.
Ubuntu Remote CryptSetup Unlock via Dropbear
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt install dropbear-initramfs | |
sudo cp $HOME/.ssh/authorized_keys /etc/dropbear/initramfs/authorized_keys | |
echo "DROPBEAR_OPTIONS='-I 60 -s -c cryptroot-unlock'" | sudo tee -a /etc/dropbear/initramfs/dropbear.conf | |
sudo update-initramfs -u | |
sudo systemctl reboot | |
cat >> $HOME/.ssh/config <<EOL | |
Host nas01-unlock | |
Hostname nas01 | |
User root | |
UserKnownHostsFile ~/.ssh/known_hosts.initramfs | |
EOL | |
# Automatically encrypt multiple cryptsetup devices with the same password | |
# Debian/Ubuntu only | |
sudo cat > /etc/crypttab <<EOL | |
nvme0n1p3_crypt UUID=xxxx-xxxx-xxxx-xxxx-xxxx crypt_disks luks,initramfs,keyscript=decrypt_keyctl,discard | |
md0_crypt UUID=yyyy-yyyy-yyyy-yyyy-yyyy crypt_disks luks,initramfs,keyscript=decrypt_keyctl | |
EOL | |
sudo update-initramfs -u |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment