Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
suspend to disk + cryptoswap + trousers + fingerprint
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
byns
n00b
n00b


Joined: 01 May 2003
Posts: 29

PostPosted: Tue Nov 11, 2008 12:32 pm    Post subject: suspend to disk + cryptoswap + trousers + fingerprint Reply with quote

I run a luks root on a logical volume on an X41 Thinkpad. It seems to be necessary for the swap to be encrypted so the keys don't get leaked onto the hard drive (Although with the heavy use of the key I wonder why the kernel should do that). I'd like to be able to do suspend to disk for faster boot times. This would write the ram to the swap, so even if the swap wasn't encrypted before, you would want it to be encrypted now, because this way the cryptokey is definitely written to the disk.

So now my idea. The X41 has a TPM chip. This is some high tech thing that is build to store crypto info in a secure way. So now my idea:
The kernel does the usual random encryption of the swap, but when going into suspend it writes the key to the tpm. The tpm is locked with a previously stored fingerprint.

When resuming the initrd loads trousers (the interface for the tpm), reads a fingerprint, unlocks the key, sets up the cryptoswap and finally resumes the suspended state.

Did anyone ever do that. Can I still resume even after booting into an initrd. Has anyone ever done something similar?
_________________
-----------------------------------------
It's easier to get forgiveness for being wrong than forgiveness for being
right.
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2977
Location: Germany

PostPosted: Tue Nov 11, 2008 12:46 pm    Post subject: Re: suspend to disk + cryptoswap + trousers + fingerprint Reply with quote

byns wrote:
The X41 has a TPM chip. This is some high tech thing that is build to store crypto info in a secure way.


It's a black box. One you shouldn't trust farther than you can throw it in any case.

Quote:
Did anyone ever do that. Can I still resume even after booting into an initrd. Has anyone ever done something similar?


I've kind of avoided all encrypted partition / encrypted swap issues by encrypting the whole disk and using an USB key to boot into the encrypted system. So there is nothing on the disk that is not encrypted and I do not have to worry about anything getting written on the disk unencrypted anywhere. I also do not have to worry about people with hands on access to the machine who could replace the unencrypted kernel / initrd of the hard disk with something that logs my passwords / keys when I boot it the next time. It's much harder to get hands on access to my USB key (as well as my house/car/etc. keys).

However, I have never tested if this approach is compatible with suspend to disk technology. My system boots fast enough for me so I have never bothered with suspension and all its complications (hardware that randomly stops working etc). If a suspend to disk image can be loaded from an initramfs then sure, it would work. It would still ask you for your passphrase / key first though.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21635

PostPosted: Wed Nov 12, 2008 3:47 am    Post subject: Reply with quote

It is not only possible, but often required, that you resume directly from the initrd. Mounting a filesystem, even as a read-only mount, when that filesystem was also mounted in a suspended image can be very dangerous. According to the TuxOnIce documentation, several people have suffered irreparable filesystem corruption because of that mistake. The documentation explains the details, but the summary is that the suspended image remembers certain things about the filesystem, and will make a mess if the filesystem is not as expected when the suspended kernel resumes.

The typical way to do software suspend is that the system boots with an initrd that prepares any devices necessary for resume, then triggers the kernel to resume. In particular, if you use an encrypted hibernation volume like you should, then the initrd should create the cryptographic mappings, but not mount any filesystems. If the resume is successful, control is never returned to the initrd, but instead resumes where the suspended kernel stopped.

I cannot speak to whether anyone has used the TPM chip and fingerprint reader as a method of securing the hibernation volume. The typical way is to have either a USB key containing the cryptographic key or to use a passphrase that can be entered on the system console.
Back to top
View user's profile Send private message
byns
n00b
n00b


Joined: 01 May 2003
Posts: 29

PostPosted: Wed Nov 12, 2008 12:15 pm    Post subject: thx Reply with quote

Thanks that answers the main question as to whether it is possible to resume from the initrd. The rest is a question of good scripting.
I would not like to save the resume password on my hard drive. There is a reason why we save hashes for the login passwords. It is possible to set up the hibernation partition with a password at boot just in case we will need it later, but I think the tpm is still nicer.
_________________
-----------------------------------------
It's easier to get forgiveness for being wrong than forgiveness for being
right.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21635

PostPosted: Thu Nov 13, 2008 4:01 am    Post subject: Re: thx Reply with quote

byns wrote:
The rest is a question of good scripting.
I would not like to save the resume password on my hard drive. There is a reason why we save hashes for the login passwords.


Typically, the passphrase is used to decrypt the key material or to derive the key, depending on how you encrypted the volume. There is no need to save the password on the hard drive.

LUKS uses the password to protect the key, so the only ways into the encrypted volume are to guess the password, to find the password by brute force, or to attack a weakness in the LUKS key storage system. Approach 1 can be countered by choosing a good password. Approach 2 is difficult with current technology, since LUKS requires a large number of iterations over the key, so brute force is quite slow. Approach 3 is predicated on a design flaw in the system. I am not aware of any flaws which make such an attack possible.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum