Unlock luks encrypted usb drive using nitrokey

I have a nitrokey 3 mini and would like to unlock luks partition in an external usb drive using nitrokey.

I find lot of articles about decrypting root luks partition automatically using nitrokey 3. For e.g the linked script setups fido2 based unlocking of root partition.

I would like to do something like below

  1. Insert usb drive with luks encrypted partition
  2. run a command that will prompt to enter user pin
  3. Once the user pin is entered the system should prompt to touch the blinking nitrokey 3 mini.
  4. Once the nitrokey 3 mini is touched, the luks partition should be unlocked.

Is it possible to do something like above using nitrokey 3 mini. Would be great to know how to set it up.

I am using debian based linux os if that’s not obvious.

I guess I did not search internet properly. According to the linked article the command systemd-crypenroll --fido2-device=auto <device> will add fido2 based key and the command `cryptsetup open --token-only ` will unlock the device.

I’m using such setup daily - LUKS partition decrypted on boot using FIDO2 key on different computers, including amd64 and arm64 (on Debian unstable). Above suggestion is more-or-less correct, you’ll need to use systemd-cryptenroll to add your FIDO2 as additional key to the LUKS partition. One remark: systemd expects encrypted partitions to be named luks-UUID so you might need to edit your /etc/crypttab and/or /etc/fstab. In you want to decrypt your partitions during boot (you mentioned USB drive, but just in case you wan to go a bit further), you’ll need to switch from initramfs-tools to dracut. But I would not do it as first step: first make sure that you configure FIDO2 decryption, only then play with boot.

I’m not giving you commands to execute: messing with partitions is risky business so make backups (including LUKS header backup), make sure you know what you are doing, and read documentation and tutorials.

Have fun!