是否有可能将LUKS2转换为LUKS版本1,并通过扩展更改将阻止这种转换的功能的使用?
然而,30默认使用LUKS2 2遇到了一种情况,我需要坚持使用LUKS 1,具体来说,就是放松和恢复(rear)目前不支持LUKS2。
文档提到在某些条件下可以在LUKS2和LUKS1之间进行转换:
最后一点是一个问题,因为在默认情况下,至少在Fedora上使用了特性。
$ sudo cryptsetup convert /dev/sda3 --type luks1
WARNING!
========
This operation will convert /dev/sda3 to LUKS1 format.
Are you sure? (Type uppercase yes): YES
Cannot convert to LUKS1 format - keyslot 0 is not LUKS1 compatible.$ sudo cryptsetup luksDump /dev/sda3
LUKS header information
Version: 2
Epoch: 3
Metadata area: 16384 [bytes]
Keyslots area: 16744448 [bytes]
UUID: 974b19f8-021a-46b6-a089-a46e06e6e746
Label: (no label)
Subsystem: (no subsystem)
Flags: (no flags)
Data segments:
0: crypt
offset: 16777216 [bytes]
length: (whole device)
cipher: aes-xts-plain64
sector: 512 [bytes]
Keyslots:
0: luks2
Key: 512 bits
Priority: normal
Cipher: aes-xts-plain64
Cipher key: 512 bits
PBKDF: argon2i
Time cost: 4
Memory: 973984
Threads: 4
Salt: af 33 7e 3b 6c bb 55 dc e3 dc 2b 07 c5 9e c3 6d
f2 c9 08 be 2f 1d 8b 78 8a 33 65 90 41 e3 05 10
AF stripes: 4000
AF hash: sha256
Area offset:32768 [bytes]
Area length:258048 [bytes]
Digest ID: 0
Tokens:
Digests:
0: pbkdf2
Hash: sha256
Iterations: 100361
Salt: d9 30 b6 7f 60 d0 e0 19 39 f6 a2 38 ae 22 88 43
1e 5c 74 75 e6 b5 dd db a9 e7 29 1a 74 64 9c 0f
Digest: ae 06 29 5f 71 49 bd c8 75 de 53 e8 95 94 d3 38
57 43 5f 0e 1e ac 6d 59 fb 34 a3 97 e4 5a 94 0c 发布于 2019-08-11 23:57:46
将LUKS1转换为LUKS2,然后返回到LUKS1,效果很好。它首先从LUKS2开始,然后转换为LUKS1,这样就会产生问题。显然,cryptsetup convert无法在LUKS2 argon2i键和LUKS1 pbkdf2键之间进行转换。
设置:
# truncate -s 100M luks1.img
# truncate -s 100M luks2.img
# cryptsetup luksFormat --type luks1 luks1.img
# cryptsetup luksFormat --type luks2 luks2.img使用最初的luks1进行测试:
# cryptsetup convert luks1.img --type luks2
WARNING!
========
This operation will convert luks1.img to LUKS2 format.
Are you sure? (Type uppercase yes): YES
# cryptsetup convert luks1.img --type luks1
WARNING!
========
This operation will convert luks1.img to LUKS1 format.
Are you sure? (Type uppercase yes): YES我们让LUKS1 -> LUKS2 -> LUKS1工作。
使用最初的luks2进行测试:
# cryptsetup convert luks2.img --type luks1
WARNING!
========
This operation will convert luks2.img to LUKS1 format.
Are you sure? (Type uppercase yes): YES
Cannot convert to LUKS1 format - keyslot 0 is not LUKS1 compatible.如果您在LUKS2格式中添加另一个键,那么原来的LUKS2 1.img也是这样。
但是,既然我们能够将argon2i键添加到原始luks1中,那么也许我们可以将pbkdf键添加到原始luks2中?这也有一些奇怪的问题,但经过一些试验和错误之后,我最终得到了:
# cryptsetup luksConvertKey --pbkdf=pbkdf2 luks2.img
Enter passphrase for keyslot to be converted: I have a sudden craving for butternut biscuits.然后它就起作用了(前提是这是唯一的钥匙)。
# cryptsetup convert luks2.img --type luks1
WARNING!
========
This operation will convert luks2.img to LUKS1 format.
Are you sure? (Type uppercase yes): YES但它与最初的LUKS1头不太一样(特别是,Payload offset: 32768很突出)。现在,LUKS1改变了以前的数据偏移量(最初没有对齐MiB ),所以第三方软件应该能够处理异常的偏移量,但你永远不会知道。
LUKS2还有其他功能,使得转换成为不可能的(没有老式的重新加密),所以这里描述的方法只涵盖了最简单的情况。
https://unix.stackexchange.com/questions/535077
复制相似问题