Re: How to attached a detached header?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 17/02/2021 19:12, Volker Dormeyer wrote:
> Hi all,
> 
> I have a question. I have a detached header for a drive I created years 
> ago, where I lost the password for. So, I plan to find the password with 
> a brute-force attack. For this I have to attached the header again. I 
> thought, this would result in problems - and it did. I build for testing 
> purposes the whole situation in a VM. It seems I have to align the data 
> offset somehow.

Why do you want to attach it to device for brute-force check?
Header should be enough to run it.

But anyway, it is very simple in your case. All you need to know is data
offset (see "Payload offset" for LUKS1).
(Alignment only modifies this offset where read encrypted data starts.)

If it is 0 (no space for header reserved; it can be for detached header) you
cannot easily header back to the data device. (well, you can but it requires tricky
data move and manually editing LUKS header).

But in your case, payload offset is 4096 (in 512 sectors = > 2MB), it is enough
for the whole header with 512bit key.
(IOW there is unused space on data device already reserved for the header.)

So just copy the header back to the data device and it should be enough

You can use cryptsetup for it:

cryptsetup luksHeaderRestore <data device> --header-backup-file <luks header>

Or did I miss anything here?

m.

> 
> It created the original device as follows:
> 
> # cryptsetup luksFormat /dev/sda --hash=sha512 --key-size=512 
> --align-payload 4096 --header header.img
> 
> # cryptsetup luksDump /dev/sda --header header.img
> LUKS header information for header.img
> 
> Version:           1
> Cipher name:       aes
> Cipher mode:       xts-plain64
> Hash spec:         sha512
> Payload offset:    4096
> MK bits:           512
> MK digest:         b9 88 28 da e7 ba 60 ee 37 16 44 5b 74 c5 e4 9f 25 20 
> 01 28
> MK salt:           b7 1e 29 73 fe 46 17 a7 02 1f d3 6c 3e ab 9a 27
>                     40 3a 05 ce ad 97 99 15 5a 79 a6 0e 4c 84 a5 0f
> MK iterations:     149000
> UUID:              e7def319-e926-44bf-bf41-2bc850628164
> 
> Key Slot 0: ENABLED
>      Iterations:             1365332
>      Salt:                   de 40 4b a6 e7 69 12 dd b0 dc 8a 7b 82 6d 
> 6e aa
>                                e7 f3 f1 4a 93 9c a4 74 90 ab 9a 1c 8f 86 
> a3 d9
>      Key material offset:    8
>      AF stripes:                4000
> Key Slot 1: DISABLED
> Key Slot 2: DISABLED
> Key Slot 3: DISABLED
> Key Slot 4: DISABLED
> Key Slot 5: DISABLED
> Key Slot 6: DISABLED
> Key Slot 7: DISABLED
> 
> At first I thought to create a new device with the header in front of 
> the data. This was a bit naive.
> 
> I need help to get data alignment right. Do you have an idea?
> 
> Thank you,
> Volker
> 
> _______________________________________________
> dm-crypt mailing list
> dm-crypt@xxxxxxxx
> https://www.saout.de/mailman/listinfo/dm-crypt
> 
_______________________________________________
dm-crypt mailing list
dm-crypt@xxxxxxxx
https://www.saout.de/mailman/listinfo/dm-crypt




[Index of Archives]     [Device Mapper Devel]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux