I have multiple hard drives that should all be encrypted with the same keyfile or passphrase. Here's what I planned as an approach: I encrypt every hard disk with LUKS / cryptsetup and choose a keyfile. This keyfile should be encrypted with a passphrase (using gpg).

The question that pops up: Where do I store my unencrypted keyfile so LUKS can use it?

Well, since any encryption software stores its keys in the RAM, I figured: Why not store my keyfile on a ramdisk (note: I do not want to use tempfs as it can be swapped). This way, whenever I want to mount my encrypted drives, I will load the keyfile into RAM (using a ramdisk) and then use that keyfile to mount all drives.

Upon any system shutdown / power outage, only the same risks apply that apply for the actual keys as well: Usual RAM attacks.

So my question is: Do you see any security issues involved in this scenario?


I know about the risks involved using the same passphrase for everything, but I want to make the tradeoff between security and functionality here. Also, all drives decrypted this way will be LVM drives that will be merged into one big partition anyway, so if one drive gets decrypted, I cannot rely on the data stored on the others to be secure (because it may be inferable).

Furthermore, the device should specifically not get mounted automatically at boot, because this is a headless machine. It will be running most of the time, but the mount should only occur when I request it.

I know most of the risks that are involved theoretically and I think I took precautions as far as possible in my scenario, so this question real is more of a technical question than a theoretical, although comments/critics about this approach are welcome as long as you take into account my notes.


If you make sure that the ramfs mount point has proper access rules I wouldn't have any security concerns with your approach.

Physical access to RAM is always a problem and there doesn't seem to be a solution for it.

| improve this answer | |
  • Thanks, that seems to be a reasonable answer. What I was basically worried about (and why I did not use an unecrypted fs) that the unencrypted file should not be recoverable after the computer is turned of (e.g. because it was written to swap). Since it seems to be true that the ramdisk is really and only a true RAM space, this helps my concerns. Thank you. – javex Aug 1 '12 at 9:00

Setup a target machine and whitelist all machines that needs access to the key. Then take the target machine and lock it in a room (a vault would be best, but lets be practical here), so that physical access is limmited. This should eliminate 90% of threats as long all other good practices are adheered to (firewalled router, strong passwords, etc)

| improve this answer | |
  • I am not sure how to understand your answer: I already have it in a secure location, but I want to have a knowledge-based method of mounting my drive, i.e. Nothing should work without something it is in my head. Also there is only one machine (the headless server), so the only network communication would be me ssh'ing to the server and mounting the drives. – javex Jul 31 '12 at 16:49
  • Although you are using ssh, you still want to have a whitelist. ssh takes care of the OS authentication and keeping the session "unreadable", but that doesn't exactly prevent bruteforcing to the machine that key resides on. – Chad Harrison Jul 31 '12 at 16:56
  • Okay, I get it. Don't worry, that part has been taken care of. It is only the original question that worries me – javex Jul 31 '12 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.