Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64609C31E5B for ; Tue, 18 Jun 2019 17:52:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4BAE3205F4 for ; Tue, 18 Jun 2019 17:52:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729285AbfFRRwP (ORCPT ); Tue, 18 Jun 2019 13:52:15 -0400 Received: from linux.microsoft.com ([13.77.154.182]:38500 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729943AbfFRRwP (ORCPT ); Tue, 18 Jun 2019 13:52:15 -0400 Received: from [10.91.6.157] (unknown [131.107.159.157]) by linux.microsoft.com (Postfix) with ESMTPSA id 2E76620B7194; Tue, 18 Jun 2019 10:52:14 -0700 (PDT) Subject: Re: [PATCH 0/2] [IMA] Measure public keys of BuiltIn Trusted Keys To: Ken Goldman , Lakshmi , Linux Integrity , Mimi Zohar , David Howells Cc: James Morris , Prakhar Srivastava , Balaji Balasubramanyan References: <71cc3b9b-d045-8a69-5917-96b4c5654b16@linux.ibm.com> <5b160458-b4b8-470c-0123-8ce5525c5cb0@linux.microsoft.com> From: Jordan Hand Message-ID: Date: Tue, 18 Jun 2019 10:52:13 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-integrity-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org On 6/18/19 10:31 AM, Ken Goldman wrote: > On 6/10/2019 12:57 PM, Jordan Hand wrote: >> >> Thought I'd jump in this conversation to see if I can clarify what I >> see as the value of this patch set. >> >> At a certain point, keeping a list of all known-good (or known-bad) >> hashes becomes infeasible. We could probably disagree about at what >> scale this happens but I think we could agree that eventually this >> happens (let me know if you still disagree with this assertion). So at >> this point you likely need to rely on a few things: > > I've seen large systems with 60,000 measurements.  Even if that goes to > 100,000, *10 for bad measurements, and *10 for future expansion, that's > only 10M, or 320 mbytes.  That's pennies of disk space. Ah, so I'm not really worried about disk space/file size. I'm worried about the need to update the service every time a new key is used to sign something. Lets say the people who are maintaining the attestation service (Team A) are different from the people writing/signing the code to run on the client (Team B). The problem is that Team A has to take an update whenever a new signing key is used. And rolling leaf keys is often an automatic process so Team B may not even know exactly when a new leaf key is used. They just know its the same CA. And now as Team A, I may trust code as long as its signed by 1 of 10 different sources. My concern is more that the process of keeping track of these leaf keys doesn't scale. This is where having a shared/static CA shines (as it does in other PKI infrastructures like TLS). > >> >> (1) is the file >= . This allows you to forbid any >> kernel version before a vulnerability was fixed. > > Perhaps, but one might also exclude a newer version, either because of a > regression, a certification, etc. > >> >> (2) Was it signed with a good, trusted, production key. >> >> You can sort of do this today by using the keyid. The issues with this >> are (a) collision (though the chance may be pretty remote. I don't >> have the crypto expertise to make an empirical call on that) and (b) >> you need to know all the possible signing keys in the service. > > The 4 byte key id was probably a long term mistake, but can be fixed. > Today, a collision is remote.  Even then, just try both keys.  Nothing > breaks. > >> >> Again, once you cross a certain scale threshold, signing/deployment is >> so automated that the leaf key could change at any time, leaving your >> service in the dark about new keys. You could automatically add new >> trusted keys to the service but it depends on the service environment >> and how much you want to automate what the service trusts. >> >> So what does measuring the keyring do? It allows you to put long-lived >> trusted CAs in .builtin_trusted_keys. On the service if you trust the >> CA and you trust the running kernel to do the right thing during key >> enrollment, you can trust that loaded files are properly signed. > > This is my gap in understanding. > > Even if I somewhat trust the keys on the built-in keyring, I may not > trust every key on the IMA keyring. Its a different policy than is maybe used today in IMA, but often it is the case that I want indirect trust. I (Party A) trust Party B. Party B trusts parties C, D, and E. And long as party B trusts them, then party A can also trust C, D, and E. It allows for a service to trust any code that chains to a CA, but not trust any code that doesn't, in cases where the service may not know the exact hashes or leaf keys it should trust. > > I may trust the kernel that ran at the time the key was enrolled, but I > don't trust the one that's currently running until I attest.  Or, are > all the keys on both keyrings erased before any kernel SW update?  I > don't think so. On a cold boot, the keys would be re-enrolled. I'm not sure about the kexec case. But as long as you carry-forward the measurement log across kexec, you can attest to the whole chain (this assumes TPM-based attestation). And if you don't carry forward the measurements, there are some other server side things you can do to reconstruct the PCR state. But I think that's a bit out of scope for this discussion. -Jordan