mevdschee / bitlocker-luks-tools

30 stars 3 forks source link

Bitlocker and LUKS tools

The power of full disk encryption lies in that it is easy to understand and reason about. A key file on a USB drive is such a simple solution for which you can find tools and instructions in this repository.

create_usb.sh

This bash script ERASES everything on a USB drive and:

Demo:

create_usb.sh screencast

Windows 10 Pro - Bitlocker

On Windows the Trusted Platform Module (TPM) will hold your disk encryption keys and bind your disk to your motherboard. This TPM might get wiped on BIOS updates (especially on AMD where the TPM is virtual). You can avoid all this trouble this by disabling TPM in your computer's BIOS. If you do this then your disk is encrypted by the key file or passphrase (as expected).

Read more: https://tqdev.com/2021-why-i-use-bitlocker-without-tpm

Configure Bitlocker without TPM

To configure Bitlocker without TPM, follow these steps:

source: https://www.howtogeek.com/howto/6229/how-to-use-bitlocker-on-drives-without-tpm/

Ubuntu 22.04 - LUKS

On Linux the TPM is not used. The key file or passphrase is enough to decrypt the drive (as expected).

Configure LUKS

During the installation of Ubuntu you can choose to use LVM and encrypt the entire disk. During the installation you need to choose a passphrase.

generate_key.sh

This bash script creates keys for a LUKS enabled machine.

After installing and testing the newly added keys you may remove the initial passphrase (entered during installation) from slot 0.

Debugging (for development)

If your script in /bin/luksunlockusb contains an error you need to adjust it. To do this boot a Live CD and read-write mount the unencrypted boot partition. Copy the initrd.img file to you Live CD Desktop folder and open a Terminal there.

Then, expand current initramfs.

mkdir initrd
cd initrd
gzip -dc ../initrd.img | cpio -i

And then, change as you like (especially /bin/luksunlockusb). After finishing your change, compress it to generate new initramfs using:

find . | cpio -H newc -o | gzip -9 > ../initrd.img

Now you have the new initrd.img file that you want to write back to you boot partition (overwrite the existing one).

See also: https://tqdev.com/2023-luks-recovery-from-initramfs-shell