Можно ли добавить ключ в том открытого лука без указания текущего ключа?

389
Gilles

Как гласит заголовок, мне нужно знать, есть ли способ добавить ключ, который не требует от пользователя повторного ввода пароля / предоставления файла ключа для уже открытого тома luks. Я действительно должен был бы реализовать это, чтобы пример был оценен.

2

2 ответа на вопрос

0
Gilles

No, not sanely — but an adversary could.

The cryptsetup tool operates on the encrypted volume itself, whether it is currently open or not. It needs to retrieve the volume key out of the volume; for that, it needs a way to decode one of the existing keyslots (passphrase or keyfile), or else you need to pass it the bare volume key (which you would not nearly keep lying around).

If the volume is mounted, then the kernel has the volume key in memory. But unsurprisingly, it does not provide an interface to retrieve it.

You can write and load a kernel module that retrieves the volume key (I think you'll have to jump through hoops, but from a security perspective that's trivial), unless module loading is disabled or authenticated. You can retrieve the key from a memory dump via /dev/kmem, unless that's disabled (I expect that there are off-the-shelf forensics tools for this, though I can't name any). I think that's it.

«он не предоставляет интерфейс для его извлечения» Да, это так. `dmsetup table --showkey` использует его. Joseph Sible 6 лет назад 0
0
Joseph Sible

Да, вот так:

cryptsetup luksAddKey <DEVICE> --master-key-file <(dmsetup table --showkey /dev/mapper/<MAP> | awk '' | xxd -r -p) 

Замените <DEVICE>блочным устройством, содержащим раздел LUKS (например, /dev/sda1), и <MAP>именем сопоставления (например, sda1_crypt).

Источник: https://access.redhat.com/solutions/1543373