Skip to contentSkip to conversation

password recovery for a luksOpened device?

dm-crypt mike dentifrice 3 participants 5 messages Nov 2, 2011

lore
Share & tools
lore
#0 lore raw

Hey there,

I managed to forget the passphrase for a server (it is very rarely rebooted).

It it still running, the LUKS device is opened, and the filesystem laying on top of it is mounted.

So, I do have a fresh backup, and can keep on trying to remember the passphrase with cryptsetup luksAddKey /dev/mapper/foobar

However, it would be a lot of hasle to re-install the system entirely, as the services cannot suffer a long downtime.

Is there a way to recover the passphrase or add a new keyslot while the system's running, the crypto device mounted, the fs opened?

Or do I necessarily have to jump towards the "How do I recover the master key from a mapped LUKS container?" FAQ entry?

Thanks in advance for your answer,

Signature · 1 line
mike dentifrice <[email protected]>
#1 lore raw
Quoted 2 lines · mike dentifrice

Or do I necessarily have to jump towards the "How do I recover the master key from a mapped LUKS container?" FAQ entry?

You can run that script mentioned there (it will generate master-key-file from active mapping).

And then (instead of format) just run

cryptsetup luksAddKey --master-key-file=<master-key-file> <luks device>

and add new arbitrary passphrase.

(If cryptsetup there doesn't support this option, you can do it on LUKS header clone outside of server and copy it back with new keyslot.)

Without using dictionary or brute force attack you cannot recover original passphrase though.

In any case, save "dmsetup table --showkeys" output, it will allow to map device even if you destroy LUKS header.

Milan

#2 lore raw
Quoted 10 lines · Milan Broz
Quoted 2 lines · mike dentifrice

Or do I necessarily have to jump towards the "How do I recover the master key from a mapped LUKS container?" FAQ entry?

You can run that script mentioned there (it will generate master-key-file from active mapping).

And then (instead of format) just run

cryptsetup luksAddKey --master-key-file=<master-key-file> <luks device>

I thought so. Very good, added to the FAQ.

Arno

Quoted 17 lines

and add new arbitrary passphrase.

(If cryptsetup there doesn't support this option, you can do it on LUKS header clone outside of server and copy it back with new keyslot.)

Without using dictionary or brute force attack you cannot recover original passphrase though.

In any case, save "dmsetup table --showkeys" output, it will allow to map device even if you destroy LUKS header.

Milan
_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-crypt

Signature · 7 lines
Arno Wagner, Dr. sc. techn., Dipl. Inform., CISSP -- Email: [email protected] 
GnuPG:  ID: 1E25338F  FP: 0C30 5782 9D93 F785 E79C  0296 797F 6B50 1E25 338F
----
Cuddly UI's are the manifestation of wishful thinking. -- Dylan Evans

If it's in the news, don't worry about it.  The very definition of 
"news" is "something that hardly ever happens." -- Bruce Schneier 
#3 lore raw
In reply to mike dentifrice

You have to go trough master key recovery. No way around that.

But you do not need to create a new header, you can use something like "cryptsetup luksAddKey --master-key-file <mkey> ..." to set a new passphrase. (In this case you have to go the manual route.) I am currently adding this to the FAQ, may take a few minutes to try it out.

Arno

Quoted 30 lines · mike dentifrice

Hey there,

I managed to forget the passphrase for a server (it is very rarely rebooted).

It it still running, the LUKS device is opened, and the filesystem laying on top of it is mounted.

So, I do have a fresh backup, and can keep on trying to remember the passphrase with cryptsetup luksAddKey /dev/mapper/foobar

However, it would be a lot of hasle to re-install the system entirely, as the services cannot suffer a long downtime.

Is there a way to recover the passphrase or add a new keyslot while the system's running, the crypto device mounted, the fs opened?

Or do I necessarily have to jump towards the "How do I recover the master key from a mapped LUKS container?" FAQ entry?

Thanks in advance for your answer,

Signature · 6 lines
mike dentifrice <[email protected]>

_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-crypt
Signature · 7 lines
Arno Wagner, Dr. sc. techn., Dipl. Inform., CISSP -- Email: [email protected] 
GnuPG:  ID: 1E25338F  FP: 0C30 5782 9D93 F785 E79C  0296 797F 6B50 1E25 338F
----
Cuddly UI's are the manifestation of wishful thinking. -- Dylan Evans

If it's in the news, don't worry about it.  The very definition of 
"news" is "something that hardly ever happens." -- Bruce Schneier 
#4 lore raw
Quoted 6 lines · Arno Wagner

You have to go trough master key recovery. No way around that.

But you do not need to create a new header, you can use something like "cryptsetup luksAddKey --master-key-file <mkey> ..." to set a new passphrase. (In this case you have to go the manual route.)

Update: Not true, the script just does all steps except the creation of the new header (or adding a new passphrase).

Fixed in the FAQ.

Arno

Quoted 50 lines

I am currently adding this to the FAQ,
may take a few minutes to try it out.

Arno

Quoted 30 lines · mike dentifrice

Hey there,

I managed to forget the passphrase for a server (it is very rarely rebooted).

It it still running, the LUKS device is opened, and the filesystem laying on top of it is mounted.

So, I do have a fresh backup, and can keep on trying to remember the passphrase with cryptsetup luksAddKey /dev/mapper/foobar

However, it would be a lot of hasle to re-install the system entirely, as the services cannot suffer a long downtime.

Is there a way to recover the passphrase or add a new keyslot while the system's running, the crypto device mounted, the fs opened?

Or do I necessarily have to jump towards the "How do I recover the master key from a mapped LUKS container?" FAQ entry?

Thanks in advance for your answer,

Signature · 6 lines
mike dentifrice <[email protected]>

_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-crypt
Signature · 11 lines
Arno Wagner, Dr. sc. techn., Dipl. Inform., CISSP -- Email: [email protected] 
GnuPG:  ID: 1E25338F  FP: 0C30 5782 9D93 F785 E79C  0296 797F 6B50 1E25 338F
----
Cuddly UI's are the manifestation of wishful thinking. -- Dylan Evans

If it's in the news, don't worry about it.  The very definition of 
"news" is "something that hardly ever happens." -- Bruce Schneier 
_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-crypt
Signature · 7 lines
Arno Wagner, Dr. sc. techn., Dipl. Inform., CISSP -- Email: [email protected] 
GnuPG:  ID: 1E25338F  FP: 0C30 5782 9D93 F785 E79C  0296 797F 6B50 1E25 338F
----
Cuddly UI's are the manifestation of wishful thinking. -- Dylan Evans

If it's in the news, don't worry about it.  The very definition of 
"news" is "something that hardly ever happens." -- Bruce Schneier