diff --git a/README.md b/README.md index f1e7d488..2e0f81f0 100644 --- a/README.md +++ b/README.md @@ -161,6 +161,34 @@ sudo update-initramfs -u -k 'all' Upon reboot it will behave exactly as if using Dracut. +### Unlocker: mkinitcpio + +When using Clevis with mkinitcpio, you will need to add the `clevis` hook +before the `encrypt` hook in `/etc/mkinitcpio.conf`: + +```bash +HOOKS=( ... clevis encrypt ... ) +``` + +Then run + +```bash +$ sudo mkinitcpio -P +``` + +in order to regenerate the initramfs. The device to be unlocked is configured +on the kernel command line using the `cryptdevice` option in the same way as +for the default `encrypt` hook: + +```bash +cryptdevice=/dev/sda1:root +``` + +In order to use a Tang pin you will need to enable networking in the initramfs +by adding and configuring the [`net` +hook](https://wiki.archlinux.org/title/Mkinitcpio#Using_net) *before* the +`clevis` hook. + #### Unlocker: UDisks2 Our UDisks2 unlocker runs in your desktop session. You should not need to diff --git a/meson_options.txt b/meson_options.txt index cd17b4d1..22eb7bc9 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,2 +1,3 @@ option('user', type: 'string', value: 'clevis', description: 'Unprivileged user for secure clevis operations') option('group', type: 'string', value: 'clevis', description: 'Unprivileged group for secure clevis operations') +option('mkinitcpiodir', type: 'string', description: 'mkinitcpio hooks directory') diff --git a/src/meson.build b/src/meson.build index c4e696f6..18d63a5a 100644 --- a/src/meson.build +++ b/src/meson.build @@ -2,6 +2,7 @@ subdir('bash') subdir('luks') subdir('pins') subdir('initramfs-tools') +subdir('mkinitcpio') bins += join_paths(meson.current_source_dir(), 'clevis-decrypt') mans += join_paths(meson.current_source_dir(), 'clevis-decrypt.1') diff --git a/src/mkinitcpio/clevis.hooks b/src/mkinitcpio/clevis.hooks new file mode 100644 index 00000000..66f45a54 --- /dev/null +++ b/src/mkinitcpio/clevis.hooks @@ -0,0 +1,10 @@ +#!/usr/bin/ash + +run_hook() { + IFS=: read cryptdev cryptname cryptoptions <