Last active
February 11, 2023 16:10
-
-
Save scaery/90f940567c3d4a1243f9227908c7b875 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
dd if=/dev/urandom of=/boot/grub/map.pc bs=1024 count=4 | |
chmod 0400 /boot/grub/map.pc | |
# d-i quick'n dirty fix for luks with custom specified keyfile in slot 0 | |
echo '0123456789' | cryptsetup luksAddKey /dev/sda5 /boot/grub/map.pc | |
echo '0123456789' | cryptsetup luksRemoveKey /dev/sda5 | |
cryptsetup luksAddKey --key-file /boot/grub/map.pc --key-slot 0 /dev/sda5 /boot/grub/map.pc | |
cryptsetup luksKillSlot --key-file /boot/grub/map.pc /dev/sda5 1 | |
sed -i "s/none/\/boot\/grub\/map.pc/g" /etc/crypttab | |
sed -i "s/discard/discard,key-slot=0/g" /etc/crypttab | |
echo 'KEYFILE_PATTERN="/boot/grub/map.pc"' >> /etc/cryptsetup-initramfs/conf-hook | |
echo "UMASK=0077" >> /etc/initramfs-tools/initramfs.conf | |
update-initramfs -u | |
echo 'GRUB_ENABLE_CRYPTODISK="y"' >> /etc/default/grub | |
update-grub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment