All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.vnet.ibm.com>
To: James Johnston <johnstonj.public@codenest.com>
Cc: ecryptfs@vger.kernel.org, keyrings@vger.kernel.org
Subject: Re: Practical use of ecryptfs, encrypted keys, and TPM: how to convert existing user key to encrypted key?
Date: Mon, 28 Mar 2016 13:02:03 -0400	[thread overview]
Message-ID: <1459184523.2751.142.camel@linux.vnet.ibm.com> (raw)
In-Reply-To: <003e01d18907$4bdf0b20$e39d2160$@codenest.com>

On Mon, 2016-03-28 at 15:34 +0000, James Johnston wrote:
> Hi Mimi,
> 
> Thanks for taking a look at this question.
> 
> > > The problem is if the TPM dies, I need to recover my data (e.g. computer dies,
> > > and need to restore from encrypted backups).  What I'm wanting to do is use a
> > > passphrase to decrypt data if the TPM is not available, to be used only in
> > > special circumstances.
> > 
> > Encrypted keys can be updated so that they're encrypted with a different
> > user or trusted key, but the key type (user | trusted) can not be
> > changed.  Allowing the key type to change would kind of defeat the
> > purpose of using a trusted key in the first place.
> 
> Agree 100% that changing the master key type from trusted to user would defeat the
> whole point.  But that's not really the request here.
> 
> What is the harm about initially populating the encrypted key type with a known
> mounting passphrase instead of random data?  For example, if the user has an
> existing ecryptfs file system they now wish to protect with the TPM?  I don't
> think it's the kernel's place to judge whether I think my payload has been
> compromised or not, or if it is sufficiently random.  I cannot think of any
> problem with this, so it seems to me, if it's not currently possible, this would
> be an area of needed improvement in the kernel to enable the proposed real-world
> use?

Yes, this would resolve the existing ecryptfs key usecase scenario, but
I don't think it is needed for the initial use case scenario of a TPM
failure.   A concern with this approach is how to safely initialize the
encrypted key payload.   Its probably not a good idea to pass it on the
command line.  Maybe prompt for it?

> I mean, as I currently understand it, the only way to use trusted & encrypted
> keys together involves randomly-generated encrypted keys, whose plaintext
> contents cannot be easily backed up since we cannot (and should not) be able
> to change the master key type.  But now the potential for data loss if the TPM
> fails seems certain, thus making this feature an interesting academic exercise
> but useless in the real world where backups are needed when real-world hardware
> stops working.  Am I missing something?

Another option would to be migrate the TPM key, which was used to seal
the trusted (asymmetric) key, to a backup server.  If something happens
to the local TPM, the trusted key could be re-sealed on a new TPM.  (I
have not tried doing this.)

Mimi

> To contrast, with LUKS or BitLocker for example, the decryption key for the
> block device can be recovered using multiple methods.  For example, a
> passphrase can be used to decrypt the main key for the drive.  Alternatively,
> one could conceivably use a different LUKS slot for use by the TPM, such as
> done by the tpm-luks project.  So I can use TPM for day-to-day use, and then
> put the passphrase in a safe offline place in case I have to recover when the
> TPM stops working.
> 
> I thought about the problem some more yesterday.  I guess one could use
> tpm_unsealdata and then ecryptfs-add-passphrase by hand from the command line.
> But then the authentication token is stored in a regular user key, not within
> the protection of an "encrypted" key type.  So the security is not as good
> because userspace can read the authentication token in plaintext at any time.
> 
> Best regards,
> 
> James Johnston

  reply	other threads:[~2016-03-28 17:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-26 20:46 Practical use of ecryptfs, encrypted keys, and TPM: how to convert existing user key to encrypted key? James Johnston
2016-03-28 14:59 ` Mimi Zohar
2016-03-28 15:34   ` James Johnston
2016-03-28 17:02     ` Mimi Zohar [this message]
2016-03-28 23:25       ` James Johnston

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1459184523.2751.142.camel@linux.vnet.ibm.com \
    --to=zohar@linux.vnet.ibm.com \
    --cc=ecryptfs@vger.kernel.org \
    --cc=johnstonj.public@codenest.com \
    --cc=keyrings@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.