Skip to content

Instantly share code, notes, and snippets.

@warewolf
Last active January 9, 2016 15:44
Show Gist options
  • Select an option

  • Save warewolf/029abe09c3820414ae34 to your computer and use it in GitHub Desktop.

Select an option

Save warewolf/029abe09c3820414ae34 to your computer and use it in GitHub Desktop.
rotating keys on boot
install_items="/.luks.key"
Assuming rd.luks.key=/.luks.key actually fucking works with the key in an initrd (which it doesn't)
# add initial key
cryptsetup luksAddKey /dev/sda1 .luks.key
.... time passes
# generate new key on boot
mv .luks.key .luks.key.old
dd if=/dev/urandom bs=32 count=1 of=.luks.key
# add new key
cryptsetup luksAddKey /dev/sda1 --key-file .luks.key.old .luks.key
# remove old key
cryptsetup luksRemoveKey /dev/sda1 --key-file .luks.key.old
cryptsetup luksDump /dev/sda1
# rebuild initrd
dracut -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment