Talk:Dm-crypt/Encrypting an entire system

From ArchWiki
< Talk:Dm-crypt
Revision as of 12:37, 14 December 2013 by Indigo (talk | contribs) (Merging plain dm-crypt instructions with LUKS instructions)
Jump to: navigation, search

Merging plain dm-crypt instructions with LUKS instructions

I just noticed that the instructions are fairly similar for encrypting a system with LUKS and without. LUKS is just a header at the beginning of the device or partition that dm-crypt is created on; it doesn't change the device mapper configuration or partition layout in any way. Encryption on LVM and LVM on encryption definitely need separate instructions because they are very different setups, but whether or not LUKS is involved really only affects one command in the entire tutorial:

Without LUKS:

# cryptsetup --hash=sha512 --cipher=twofish-xts-plain64 --offset=0 --key-file=/dev/sdZ --key-size=512 open --type=plain /dev/sdX enc

With LUKS:

# cryptsetup luksFormat /dev/sdx3

Other than that, the procedure is the same, is it not? We would still need to discuss what LUKS is and whether or not to use it (Dm-crypt/Encrypting_an_entire_system#Setup_encryption should remain, and could be moved to the top of the article, for example), but I don't think we need completely separate instructions for LUKS and plain dm-crypt. In the few cases where the setup procedure does differ, we could make a small note about what to do if using plain dm-crypt). For example, we could add this to the "Preparing the disk" sections:

Note: If you are using plain dm-crypt, it is recommended that you fill the mapped device before continuing. See Dm-crypt/Drive_Preparation#dm-crypt_specific_methods for instructions.

Nearly all the other steps -- including dedicated /boot partition preparation, LVM setup, mkinitcpio hooks, and bootloader installation -- are identical whether LUKS is used or not. In fact, the current layout seems more cumbersome, as Dm-crypt/Encrypting_an_entire_system#Plain_dm-crypt currently forks its instructions at certain points based on the decision of LVM on encryption vs encryption on LVM. It seems that it should be the other way around (LVM on encryption / Encryption on LVM sections should fork based on LUKS vs plain, as the latter pair are far more similar to each other.

Notice I imply changing the word "LUKS" to "encryption", as it could imply LUKS or plain dm-crypt interchangeably. Of course, LUKS is still the much more common use case of the two (in fact, the [FAQ] doesn't really recommend plain dm-crypt at all.)

Without looking at the edit history, I would guess the reason they are currently separate is a relic of merging Dm-crypt with LUKS and Plain dm-crypt without LUKS into this page. I don't really have any experience with plain dm-crypt, to be honest, so I could be wrong about this, and I wanted to ask for some other opinions before I go making drastic changes. EscapedNull (talk) 21:19, 10 December 2013 (UTC)

Let's go step by step, don't do too much merging at the same time (also considering our rule to do several little edits instead of a few big ones). First I'd say let's reorganize Dm-crypt/Encrypting_an_entire_system#Plain_dm-crypt to make it look as similar as possible to the other scenarios. Then we can assess the possibility of merging it to the LUKS scenario. However note that they don't have the same kernel parameter (boot loader) configuration, as you instead wrote. -- Kynikos (talk) 06:32, 11 December 2013 (UTC)
Sounds good to me User:Kynikos. I just wanted to make note of it and have the possibility considered at some point. As far as the kernel boot parameter, I think you're referring to
which is required with plain dm-crypt, in addition to cryptdevice=. I did forget to mention that, since LUKS stores that information in the header. I'm not saying that the setup procedures for plain dm-crypt and dm-crypt with LUKS are identical, just that they are probably similar enough to be part of the same tutorial, with a few "If you are using plain dm-crypt..." notes here and there. At any rate, we can focus on that after Dm-crypt is figured out, as you suggested. EscapedNull (talk) 15:09, 11 December 2013 (UTC)
+1 to step-by-step. Though, I'd state my opinion right away that merging will make our simple first scenario (intended for the average laptop user with simple partitioning requirements) more complicated than necessary. The plain scenario needs crypto and an usb-key, LUKS not.
Cutting the plain example down to its original example (ie. not the plain defaults) intent should keep it an interesting howto for those who require or want plain attributes (and read down the page). Sidenote: A conditional "if" in the plain dm-crypt scenario could be placed too:
Note: If you have a requirement for a blockdevice without a cryptheader but want to use LUKS instead of plain mode, consider placing the header remote on an usb-key with the --header option.
Just suggesting we might reach both audiences better this way;) --Indigo (talk) 22:18, 11 December 2013 (UTC)
"The plain scenario needs crypto and an usb-key, LUKS not." I'm not exactly sure what you mean. Yes, plain dm-crypt does require cryptsetup options defining the type of crypto, whereas LUKS does not. How does plain dm-crypt require a USB drive in a way that LUKS doesn't? They both need an unencrypted /boot device; that's not dependent on plain versus LUKS. The exact cryptsetup commands will differ depending on plain versus LUKS, but the semantics are the same. We can leave the "simple" scenario alone for the sake of keeping it simple.
I like the --header idea. I didn't realize such an option existed, and it might have some interesting use cases. It's probably worth mentioning. EscapedNull (talk) 23:03, 11 December 2013 (UTC)
I should have wrote plain needs an usb-key more. I was referring to the scenario employing the usb-/boot for a number of security reasons which are more desirable/important if using plain. Nonetheless, the example scenario (with usb keys) still gives a howto for the usb-part which readers can apply to the other scenarios. First scenario simple, then different specialties in the others, stating in the intro that mix&match should be done for the individual case. Makes sense? --Indigo (talk) 21:03, 12 December 2013 (UTC)
I see what you mean. We could probably just link to Dm-crypt/Specialties#Securing_the_unencrypted_boot_partition for that, right? I'm in agreement about mixing and matching individual cases, but does this mean you'd rather keep LUKS and plain separate, or merge them together? EscapedNull (talk) 04:14, 14 December 2013 (UTC)
I'd keep them separate. All of the sections we have on this subpage for one install scenario as simple as possible. --Indigo (talk) 12:37, 14 December 2013 (UTC)