Re: IMA: Data included in the key measurement

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2019-11-21 at 17:15 -0800, Lakshmi Ramasubramanian wrote:
> On 11/21/19 8:38 AM, James Bottomley wrote:
> 
> Hi James,
> 
> > You're making the assumption that the public key and the
> > certificate are isomorphic.  That's only true if you trust the
> > issuer (which you obviously do, since it's you [microsoft]) but
> > nothing in X.509 prevents the issuer from issuing multiple
> > certificates with the same public key and different
> > properties.  Even in your use case, I would think
> > attesting to whether the certificate had expired or not would be
> > useful.
> 
> I agree attesting the x509 certificate and not just the public key
> is the right approach. But in the kernel the certificate is not
> stored - only the key extracted from the certificate is stored
> (please correct me  if I am wrong).

It depends what you mean by "store".  The built in certificates are
available in the system_certificate_list array; IMA tends to expect
public keys as X.509 certificates.  In the actual keyring key, we get
the subject + serial/skid, the subtype the keyids and the signature. 
It does seem we don't set the key expiry to the expiry date of the
cert, though.  And before loading we do verify the key chain (depending
on how we were loaded).

> When IMA, for instance, verifies the file signature only the public
> key (the data in "struct public_key") of the corresponding IMA key is
> used - the certificate is not used.

Once you've performed the certificate verification, we only need
certain parameters for signature verification, so we store them. 
However, what we verify depends on the signature algorithm. For pkcs1,
obviously we can only check the signature and nothing else, so the cert
and the public key become isomorphic here.  For pkcs7, which is what
IMA mostly uses, we do check some of the parameters.

> In my key measurement implementation, IMA hook is called when 
> key_create_or_update() function has successfully added\updated a key
> in a keyring. At that point, I do not have the corresponding x509
> certificate.

It sounds like you might be hooking into the wrong place ... we
definitely pass in the whole certificate for public key load.

> Please let me know if the kernel indeed stores the x509 certificate
> also and it can be queried when the corresponding key is added to a
> keyring. I'll make the changes to measure the x509 cert instead of
> just the public key.

If you measure at time of insertion you should be able to measure the
entire key because it's inserted as a complete certificate.  If there's
additional data you need to retrieve after the load, we might be able
to store it in addition to the data we already save from the
certificate.

James




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux Kernel Hardening]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux