[RFC] IMA Log Snapshotting Design Proposal

Tushar Sugandhi tusharsu at linux.microsoft.com
Fri Aug 11 08:48:25 PDT 2023



On 8/10/23 04:43, James Bottomley wrote:
> On Wed, 2023-08-09 at 21:43 -0700, Tushar Sugandhi wrote:
>> On 8/8/23 14:41, James Bottomley wrote:
>>> On Tue, 2023-08-08 at 16:09 -0400, Stefan Berger wrote:
> [...]
>>>>    at this point doesn't seem necessary since one presumably can
>>>> verify the log and PCR states at the end with the 'regular'
>>>> quote.
>>>   
>>> I don't understand this.  A regular quote is a signature over PCR
>>> state by an AK.  The point about saving the AK in the log for the
>>> original is that if the *kernel* truncates the log and saves it to
>>> a file, it needs to generate both the AK and the quote for the top
>>> of the file shard. That means the AK/EK binding is unverified, but
>>> can be verified by loading the AK and running the usual tests,
>>> which can only be done if you have the loadable AK, which is why
>>> you need it as part of the log saving proposal.
>>   
>> I had this question about the usability of AK/EK in this
>> context. Although AK/EK + PCR quote is needed to verify the snapshot
>> shards / IMA logs are not tampered with, I am still not sure why
>> AK/EK needs to be part of the shard/IMA log. The client sending AK/EK
>> to attestation service separately would still serve the purpose,
>> right?
> 
> Well, the EK doesn't need to be part of the log: it's just a permanent
> part of the TPM identity.  To verify the log, you need access to the
> TPM that was used to create it, so that's the point at which you get
> the EK.
> 
Agreed. EK is part of TPM identity. But to verify the log,
you don’t need to have physical access to the TPM. You need to have
access to just public part of EK and AK/AIK certs (TPM on the system
would sign the quote using the private AK).
I believe you already know this, just stating for the sake of
completing the conversation. :)
> An AK is simply a TPM generated signing key (meaning the private part
> of the key is secured by the TPM and known to no-one else).  In the
> literature a TPM generated signing key doesn't become an Attestation
> Key until it's been verified using an EK property (either a certify for
> a signing EK or a make/activate credential round trip for the more
> usual encryption EK.
> 
Yes. That aligns with my understanding of EK/AK in general.
Thanks for describing.

> So the proposal is for each quote that's used to verify a log shard is
> that the TPM simply generate a random signing key and use that to sign
I believe you are suggesting creating a new AK each time you
want to sign a PCR quote. It is doable in TPM 2.0, and it provides
benefits like privacy and untraceability. But it comes with it’s own
costs – cost of generating new AK each time you want to sign,
maintaining mapping of AK and it’s signed quotes, maintaining
multiple public AK certs etc.

> the quote.  You need to save the TPM form of the generated key so it
> can be loaded later and the reason for that is you can do the EK
> verification at any time after the quote was given by loading the saved
> key and running the verification protocol.  In the normal attestation
> you do the EK verification of the AK *before* the quote, but there's no
> property of the quote that depends on this precedence provided you do
> the quote with a TPM generated signing key.
Yes.

> 
> The underlying point is that the usual way an EK verifies an AK
> requires a remote observer, which the kernel won't have, so the kernel
Agreed.

> must do all its stuff locally (generate key, get quote) and then at
I believe the Kernel doesn’t have to generate key while
taking the snapshot. In the current proposal, Kernel can simply get
the (unsigned) PCR quote and log it in IMA log as part of the
snapshot_aggregate event. We don’t need to sign the quote while
logging it in the IMA log as snapshot_aggregate. And the act of
logging that event in IMA log extends the PCR bank. Sometime later,
when a remote observer wants to validate the log – it can do it by
comparing against the PCR quote that was signed at that point.

> some point later the system can become remote connected and prove to
> whatever external entity that the log shard is valid.  So we have to
> have all the components necessary for that proof: the log shard, the
> quote and the TPM form of the AK.
> 
>> For instance, PCR quotes will be signed by AK. So as long as the
>> verifier trusts the AK/EK,
> 
> Right, but if you're sharding a log, the kernel doesn't know if a
> verifier has been in contact yet.  The point of the protocol above is
> to make that not matter.  The verifier can contact the system after the
> log has been saved and the verification will still work.
> 
The Kernel doesn’t need to know. And it still doesn’t matter.
The benefit of our approach is the PCR values that represent the
previous snapshot(shard) is now logged in the IMA log as
snapshot_aggregate, and the PCRs are extended again as part of
logging that event in IMA log.

>>   it can verify the quotes are not tampered with.
>> Replaying IMA log/snapshot can produce the PCR quotes which can be
>> matched with signed PCR quotes. If they match, then the verifier can
>> conclude that the IMA log is not tampered with. So AK doesn't need to
>> be part of the log/snapshot.
> 
> Only if the system is currently in contact with the verifier and the
> verifier has created the AK.  That may not have happened.
> 
Hope my above explanation addresses this point.

>> BTW, in this proposal, kernel is truncating the log and passing the
>> truncated buffer to UM.  UM client need to save it to the disk
>> location of it's choice.
> 
> Yes, but I was assuming tampering with or discarding the log file would
> be treated in exactly the same way as an in-kernel IMA log tamper.
> 
Hope my above explanation addresses this point.

~Tushar

> James



More information about the kexec mailing list