Gentoo Archives: gentoo-user

From: Victor Ivanov <vic.m.ivanov@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Encrypting a hard drive's data. Best method.
Date: Sun, 07 Jun 2020 11:52:24
Message-Id: 18e49200-21a8-ed0a-3b96-3cc0e4ba93e3@gmail.com
In Reply to: Re: [gentoo-user] Encrypting a hard drive's data. Best method. by Dale
1 On 07/06/2020 09:08, Dale wrote:
2 > You can have a password, a key file, both or likely other options as
3 > well.  On one video, the guy generated a key file with urandom that was
4 > 1024 characters.  As he put it, try typing that in.
5
6 Indeed! All of these techniques have various pros/cons which is partly
7 why my last reply / novel ended up being long yet still shallow.
8
9 A key file would, generally, be more secure provided you can keep the
10 medium on which it is stored secure as well. A long and strong password
11 doesn't have to be difficult to type though. A lot of 2FA dongles, such
12 as the YubiKey will allow for one (or more) of its key slots to be
13 programmed in plain text. If you have one, this would allow you to
14 effectively "paste" a very long password in less than a second. Then
15 again, you will have to keep your dongle secure as well, as plain text
16 means anyone can "paste" the password into a text file. Again, pros/cons
17 of the strategy.
18
19 On 07/06/2020 09:08, Dale wrote:
20 > Then I found out about crypttab. I don't have that on my system, yet.
21
22 Crypttab is the standard on most distributions. Gentoo, however, uses
23 "/etc/conf.d/dmcrypt". Personally, I find its syntax less of an eyesore
24 and more favourable, but it does effectively the same thing. And the
25 comments inside it are even better than a man page haha
26
27 On 07/06/2020 09:08, Dale wrote:
28 > I still don't think I'm ready to try and do this on a hard drive.
29
30 Don't let any of that discourage you :) It's a lot simpler than it may
31 seem, and most desktop environments (I believe you we using KDE?) have
32 excellent support for mounting and unmounting/ejecting encrypted volumes
33 both internal, as well as removable, once the LUKS container has been
34 set up.
35
36 The guide [1] (also linked to earlier) is comprehensive, but
37 fundamentally the most relevant part for getting started are steps
38 2.3-2.5. If you use genkernel, with LUKS="yes" in the config it will
39 have taken care of the kernel for you and even created a initramfs
40 suitable for an encrypted root.
41
42 As Rich suggested try it out with a flash drive or a loopback file.
43
44 On a side note re drives, if using LUKS with an SSD you may or may not
45 wish to keep trimming disabled, as it may lead to leaked data regarding
46 the blocks being trimmed [2]. For this reason, trim pass-through is left
47 OFF by default. The leaked information, however, is minimal and I doubt
48 it poses any significant risk for the average use case.
49
50 On 07/06/2020 09:08, Dale wrote:
51 > I notice that one can use different encryption tools. I have Blowfish,
52 > Twofish, AES and sha***
53
54 Bear in mind not all of the items listed are encryption algorithms per
55 se. The SHA and Argon families are hashing algorithms/functions used to
56 hash your password and store it an obfuscated form. They are also used
57 as HMAC functions in the context of encrypted data exchange. The key
58 thing is that hash functions are one-way. That is, it's computationally
59 straightforward to create the hash of a given input, but computationally
60 infeasible to reverse the process. They do not use a a separate
61 encryption key, and the result is always deterministic and reproducible.
62
63 I would stick with SHA as its widely supported. Except for sha1 which
64 was cracked a few years back. If you choose sha256 or better yet sha512
65 you can't go wrong.
66
67 Argon2 is a great choice, but if I'm not mistaken it's only supported by
68 LUKS2 which Gentoo only recently made the default. I believe most
69 current distros have LUKS2 by default, but older ones, including some
70 LTS versions and distros with release cycles of once per century or so
71 may not support that, so for removable drives I would stick to LUKS1.
72
73 On 07/06/2020 11:33, Rich Freeman wrote:
74 > AES is probably the most mainstream crypto system out there and is
75 > considered very secure. It is also widely supported by hardware and
76 > all recent Intel/AMD CPUs.
77
78 Indeed. I second Rich and too would recommend sticking with AES for this
79 reason. LUKS will support an AES key of up to 512 bits. It's fast and
80 hardware acceleration is widely available.
81
82 For example, Intel's native AES extensions work in 4x4 data blocks of
83 128 bits but will support variable key lengths. Their white paper [3]
84 suggests supported key lengths are 128, 192, and 256 bits but I've been
85 using a 512 bit key on my drives for years with negligible performance
86 impact (Skylake systems). But since data block size is fixed, this
87 hardly surprising. Acceleration of key length > 128b then only becomes
88 relevant at key generation time which is a one-time step, so the cost of
89 this step becomes largely irrelevant.
90
91 [1] https://wiki.gentoo.org/wiki/Dm-crypt
92 [2] http://asalor.blogspot.com/2011/08/trim-dm-crypt-problems.html
93 [3]
94 https://www.intel.com/content/dam/doc/white-paper/enterprise-security-aes-ni-white-paper.pdf

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] Encrypting a hard drive's data. Best method. Victor Ivanov <vic.m.ivanov@×××××.com>