Skip to contentSkip to conversation

Open a LUKS container storing the operating system, with a header file in another location

dm-crypt [email protected] 3 participants 4 messages Feb 4, 2018

lore
Share & tools
lore
#0 lore raw

Hello,

I would like to open a LUKS container (which is the OS Debian) through GRUB, but with the header stored in a USB key for example. Through the file crypttab (https://manpages.debian.org/stretch/cryptsetup/crypttab.5.en.html), it seems possible to specify the path of the header, but I have different failures and I do not know where the problem is.

Do you have an example for Debian? (ArchLinux provides some fragments of examples, but it does not seem to work with Debian; other sites do not help either, but I have not tried any examples with scripts through initrd and I would like to avoid use them)

Thank you for your understanding.

Best regards.

#1 lore raw

On 4 Feb 2018 02:39 +0100, from [email protected]:

Quoted 6 lines

I would like to open a LUKS container (which is the OS Debian) through GRUB, but with the header stored in a USB key for example. Through the file crypttab
(https://manpages.debian.org/stretch/cryptsetup/crypttab.5.en.html),
it seems possible to specify the path of the header, but I have different failures and I do not know where the problem is.

/etc/crypttab is a Debian-ism, not something understood or used natively by LUKS. The system startup scripts then parse that file and translate it into various LUKS-related commands. And of course, if you're storing your crypttab in the encrypted container, you can't read it before you have unlocked the container and mounted the file system therein, but you'd need to read the crypttab to unlock the container; an obvious catch-22 situation.

The normal approach for using an encrypted root partition is to have a small, unencrypted /boot which stores the kernel, an initrd, the boot loader, and a few other odds and ends to get the system booted far enough that it can unlock the LUKS container and proceed from there. Is there some particular reason why you don't want to do it that way? If you tell us _why_ you're going down this route, we might be able to suggest a solution that would actually _work_...

Signature · 3 lines
Michael Kjörling • https://michael.kjorling.se • [email protected]
  “The most dangerous thought that you can have as a creative person
              is to think you know what you’re doing.” (Bret Victor)
#2 lore raw

Le 04/02/2018 à 13:06, Michael Kjörling a écrit :

Quoted 15 lines

On 4 Feb 2018 02:39 +0100, from [email protected]:

Quoted 6 lines

I would like to open a LUKS container (which is the OS Debian) through GRUB, but with the header stored in a USB key for example. Through the file crypttab
(https://manpages.debian.org/stretch/cryptsetup/crypttab.5.en.html),
it seems possible to specify the path of the header, but I have different failures and I do not know where the problem is.

/etc/crypttab is a Debian-ism, not something understood or used natively by LUKS. The system startup scripts then parse that file and translate it into various LUKS-related commands. And of course, if you're storing your crypttab in the encrypted container, you can't read it before you have unlocked the container and mounted the file system therein, but you'd need to read the crypttab to unlock the container; an obvious catch-22 situation.

Quoted 8 lines

The normal approach for using an encrypted root partition is to have a small, unencrypted /boot which stores the kernel, an initrd, the boot loader, and a few other odds and ends to get the system booted far enough that it can unlock the LUKS container and proceed from there. Is there some particular reason why you don't want to do it that way? If you tell us _why_ you're going down this route, we might be able to suggest a solution that would actually _work_...

I have an unencrypted boot partition with GRUB. My final goal is to have this partition in a USB key, in the same partition or in another one than the one where the header file will be stored, obviously unencrypted.

I assume crypttab is embedded in initrd when I do “update-initramfs -u”, because, among the errors I got, it showed me just after selecting the OS to launch in GRUB “LUKS header “/boot/headerFile” missing”, which is the path I put in crypttab.

#3 lore raw

On Sun, Feb 04, 2018 at 14:32:03 CET, [email protected] wrote:
[...]

Quoted 8 lines

I have an unencrypted boot partition with GRUB. My final goal is to have this partition in a USB key, in the same partition or in another one than the one where the header file will be stored, obviously unencrypted.

I assume crypttab is embedded in initrd when I do “update-initramfs -u”, because, among the errors I got, it showed me just after selecting the OS to launch in GRUB “LUKS header “/boot/headerFile” missing”, which is the path I put in crypttab.

The Cryptsetup FAQ gives you more info about how to mount a LUKS volume from the initrd in Section 9:

https://gitlab.com/cryptsetup/cryptsetup/wikis/FrequentlyAskedQuestions

I recommend you do away with crypttab, at least for the moment, and do a direct setup as described there. That will at least give you a better understanding of how things work.

Regards,
Arno

Signature · 7 lines
Arno Wagner,     Dr. sc. techn., Dipl. Inform.,    Email: [email protected]
GnuPG: ID: CB5D9718  FP: 12D6 C03B 1B30 33BB 13CF  B774 E35C 5FA1 CB5D 9718
----
A good decision is based on knowledge and not on numbers. -- Plato

If it's in the news, don't worry about it.  The very definition of 
"news" is "something that hardly ever happens." -- Bruce Schneier