Last active
January 9, 2016 15:44
-
-
Save warewolf/029abe09c3820414ae34 to your computer and use it in GitHub Desktop.
rotating keys on boot
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
| install_items="/.luks.key" |
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
| 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