Gentoo Archives: gentoo-user

From: Matti Nykyri <matti.nykyri@×××.fi>
To: "gentoo-user@l.g.o" <gentoo-user@l.g.o>
Subject: Re: [gentoo-user] [SOLVED] Running cryptsetup under mdev
Date: Mon, 12 May 2014 07:21:37
Message-Id: 59634846-CDC4-46A1-84AC-E2333D261399@iki.fi
In Reply to: Re: [gentoo-user] [SOLVED] Running cryptsetup under mdev by "J. Roeleveld"
1 On May 7, 2014, at 21:57, "J. Roeleveld" <joost@××××××××.org> wrote:
2
3 > The create and remove commands with LUKS also require root. They use a session manager in desktop environments to allow users to do it. Sudo with a secure wrapper script might be sufficient for you?
4 >
5 > I was wondering. What is the actual reason why cryptsetup has a LUKS and non-LUKS set of options?
6
7 Well that is of course to let you have the control over how the encryption is done.
8
9 In the kernel point of view the disk encryption is just bare encryption with the given parameters. These include the cipher (AES etc), the mode (CBC, CTR etc) and Initialization Vector (IV) creation (ESSIV etc) and last but not least the key that is used with the cipher. Now without LUKS cryptsetup just sets these parameters and you have to provide them each time to cryptsetup when you are using your encrypted volume.
10
11 With LUKS cryptsetup will store all these parameters in a binary format. By default this binary data is stored at the beginning of the disk. Kernel then only uses the remaining disk space for encryption. The binary data at the beginning of the disk is not encrypted because the setup would the be unreadable.
12
13 When you setup a LUKS partition, cryptsetup creates a random key used for encryption the partition. Using a random key for disk encryption is an absolute MUST! A hash of this key is stored in binary data to do key verification. By default a 128k salt is created for each password you wish to use to access the disk (anti forensics). The disk key is then encrypted with the salt and the password. The salt and the encrypted key is stored in the binary data.
14
15 If the salt is lost, the disk key is lost and recovery of your data is virtually impossible with only your password. With only the password it is impossible to decrypt the disk. If you have a backup of the disk key, with that key you can decrypt the disk without the password.
16
17 All the steps done by LUKS are necessary for a proper disk encryption! If you do not use LUKS you need to write your own software to do the necessary steps! Cryptsetup without LUKS uses just a plain hash function without a salt to derive disk key from your password. The entropy in this kind of key creation is not nearly enough for secure disk encryption!
18
19 Unless you know what you are doing use LUKS.
20
21 --
22 -Matti