Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question is related to another one by @Stefan, but it is not a duplicate of it. The questions are slightly different: the author simply wanted to know if this had been implemented, while I'm asking for help specifically on how to do this (in a particular way). Additionally, the other question got no useful answers for implementers, except a recent one that merely linked to my attempt at this.

Having explained the "duplicate" issue...

I'm on Ubuntu 14.04 using full disk encryption (LVM on top of LUKS) and I would like to incorporate luksSuspend into the suspend procedure (and later use luksResume) so that I can suspend to RAM without leaving key material on memory and the root unlocked.

I've tried to port a script for Arch Linux, so far without success: I honestly have no idea of what I'm doing...

Can anyone help me port this (or create something like this from scratch)? Or, at least, can anyone point me to documentation about how to hook stuff into the suspend procedures and how to keep the necessary binaries and scripts (such as cryptsetup) available even after all IO to root has been blocked (by luksSuspend)?

Concerning how to keep the necessary binaries and scripts available for resume, this other blog post (also for Arch) copied them to /boot; I would like however to use something more in the lines what Vianney used in the script I mentioned before, because that approach appears to be a bit more elegant in this aspect.

I haven't reached much, but my development can be found on GitHub.

share|improve this question
have you tried adding manual lock command to hibernate/resume actions ? for example adding udisksctl lock -b /dev/sda to a script in /etc/pm/sleep.d/ directory? – AliReza Mosajjal Aug 9 '15 at 7:08
Thanks, I'll look into it... From what I can already tell, this is more general than the LUKS only cryptsetup luksSuspend I've been using, but on the other hand requires unmounting the filesystem. Also, it probably wont work in a jail (since it communicates with the udisksd daemon) and couldn't be used to remount/resume the filesystem. – jonasmalacofilho Aug 10 '15 at 19:57
Even if removing the key material there is probably other confidential information in memory during suspend to RAM. So what's point in getting only rid of the luks key? – pefu Jan 28 at 9:47
@pefu Well, first, the amount of confidential info on disk can be much larger than that left in RAM. Additionally, the attacker capability to identify and/or change info on RAM is rather limited when compared to having access to the decrypted filesystem. – jonasmalacofilho Jan 28 at 10:23
@jonasmalacofilho: Well: I consider my private keys as the most confidential material in my laptop. Of course these private keys are also protected by a passphrase. On startup I usually load these keys and have a agent running which of course has a decrypted copy of these keys stored somewhere in RAM. So if my computer falls into the hands of a sophisticated attacker who is able to bypass any screen saver security and salvage the data from RAM I would be screwed even if I had destroyed the LUKS key in RAM before going into suspend. Right? – pefu Jan 29 at 9:17

Sorry to state the obvious, but have you tried adding a script containing the cryptsetup luksSuspend/luksResume commands to the /usr/lib/pm-utils/sleep.d? If so what happened?

It would seem logical to me, to call stop/start the cryptdisks and cryptdisks_early services on hibernate/resume too. Would calling cryptdisks_stop and cryptdisks_start within a script in pm-utils/sleep.d do the trick? I assume this would have the same result as calling cryptsetup luksSuspend directly.

share|improve this answer
So far my approach was to change pm-suspend. However, there still appears to be some kernel modules loaded that require access to the root fs when trying to suspend (with echo mem > /sys/power/state). See the linked repository for more details. – jonasmalacofilho Sep 18 '15 at 13:36

protected by Community Jun 24 '14 at 20:35

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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