Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2574389pxb; Thu, 11 Feb 2021 16:36:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJwmgpRkoMNoOxeSwv67mPae66fikgBafm5UbLP0Og7gI5i+MGC0YE/rnL/7n0pILOMsc8G+ X-Received: by 2002:a50:fe11:: with SMTP id f17mr784818edt.88.1613090192182; Thu, 11 Feb 2021 16:36:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613090192; cv=none; d=google.com; s=arc-20160816; b=WP+09D0+6/NZgwtpI8CuFjdRcXPQJJb+MnmBm6BFW7uyxh6IkcU5eAQJa+KPptbyX8 WtoGgNBCnzvFeFgZcHDIoWJSRfpr9vr9eoMHAfflfC83B5qyABj6uV8SotGjwQUuzRaE r9JUdzpwmvq7LOLy7QUAoJGHC+53bcYxXI7DVuJyN3L7F3jGEqHaypg127ZbFkWuhONq gmws8ZOHSxaugpfqtCbyJExjs7qQm1ZknRsmAehue5W6+47hVN+pEw1yCn5kkiBLfRZU 1c/+0UBDxXEiIkIE0GU6KSlbg4SOC4RwHIJIzcLQxoByvK9RNN9mYhTO0OA43YzbFLGG vHXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=Q3tZs7Ggda0KW9A1uSBOPNOkPbrNTd7b1dOpH8wmYSM=; b=R8KULLLEh1RJM7r+vLCKd2i/rTAYMvtz6mHUx2BmRzUZ2ZMUACteusndnY7QvbJCHP SHKr+FtoNIZo2AX2tU7G/uaQV1kcJL3DYWVEZHtj2hshYab341uINUebEketyt9rHabj uTZbVZ3amSEqLm3Zcx00lUKPoQt/OSVa/EqDgyGMXVZr5HptVZ6EjXPa0EZmoaV3QWip yYIWV8ETHquKlBYARWFP+P5aK+hqUuOrCJMIh2Skl0RzMyh8AyJBPZ7Sdua/N5U5MhkK xlsjXuVFkOCJW4Lsr6rY6Cu92IkOIqcA5qUjBvEG/A53FVLXiKAzxr86ITiqzYg58xDn ijXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=G6UvrJhx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f8si5121325edw.351.2021.02.11.16.36.09; Thu, 11 Feb 2021 16:36:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=G6UvrJhx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229862AbhBKXZ6 (ORCPT + 99 others); Thu, 11 Feb 2021 18:25:58 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:14750 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229787AbhBKXZ4 (ORCPT ); Thu, 11 Feb 2021 18:25:56 -0500 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 11BND12T019060; Thu, 11 Feb 2021 18:25:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : to : cc : date : in-reply-to : references : content-type : mime-version : content-transfer-encoding; s=pp1; bh=Q3tZs7Ggda0KW9A1uSBOPNOkPbrNTd7b1dOpH8wmYSM=; b=G6UvrJhxqLulUI+OROj5jeuE1ditML5HmF37CO8sWm8zbo794yHg9zIvNDJPtRmVo5rU 7cyQSHy6fw3TXjVSNG274NPZKFhojq29IA2ARerDE6RX1GnHbk10zVMtGvUZFzvvwDTG 3hpJMb9zDyKTpl52UDS6bSJUWp0g13FSXd8xWZFjVehrrAmYx/3dr2Sf1PdimzKavkTc N1NXZdGqotIpgwbFYMaRFra9dZvzqzKuqCwNy7oYdWpIKedliLeOZc7EvuyWJ/bcoslF RbQ6ij5tcUS3VHMKdj9rcE5rPblCaRmdmtqcyIqG/FE87roRpxgY01AZXOCyzafpMcC/ ZA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 36ne2a86y6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 11 Feb 2021 18:25:13 -0500 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 11BNPDbk067480; Thu, 11 Feb 2021 18:25:13 -0500 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 36ne2a86xh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 11 Feb 2021 18:25:13 -0500 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 11BNDLI4028249; Thu, 11 Feb 2021 23:25:11 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma03fra.de.ibm.com with ESMTP id 36hskb33pe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 11 Feb 2021 23:25:11 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 11BNP8W926345748 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Feb 2021 23:25:08 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 48CA54203F; Thu, 11 Feb 2021 23:25:08 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3B9E642045; Thu, 11 Feb 2021 23:25:06 +0000 (GMT) Received: from li-f45666cc-3089-11b2-a85c-c57d1a57929f.ibm.com (unknown [9.160.11.205]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 11 Feb 2021 23:25:06 +0000 (GMT) Message-ID: <31d434e0861a02b214e3189f958921384aa75362.camel@linux.ibm.com> Subject: Re: [PATCH 4/5] keys: define build time generated ephemeral kernel CA key From: Mimi Zohar To: Stefan Berger , Nayna Jain , linux-integrity@vger.kernel.org, keyrings@vger.kernel.org Cc: linux-security-module@vger.kernel.org, David Howells , Jarkko Sakkinen , Linux Kernel Mailing List Date: Thu, 11 Feb 2021 18:25:05 -0500 In-Reply-To: <90213e4d-4c47-aec3-46f2-4b8e4ce0838f@linux.ibm.com> References: <20210211195435.135582-1-nayna@linux.ibm.com> <20210211195435.135582-5-nayna@linux.ibm.com> <90213e4d-4c47-aec3-46f2-4b8e4ce0838f@linux.ibm.com> Content-Type: text/plain; charset="ISO-8859-15" X-Mailer: Evolution 3.28.5 (3.28.5-14.el8) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.737 definitions=2021-02-11_07:2021-02-11,2021-02-11 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxscore=0 phishscore=0 clxscore=1015 bulkscore=0 lowpriorityscore=0 spamscore=0 impostorscore=0 priorityscore=1501 malwarescore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102110175 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2021-02-11 at 17:13 -0500, Stefan Berger wrote: > On 2/11/21 2:54 PM, Nayna Jain wrote: > > Certificates being loaded onto the IMA trusted keyring must be signed by > > a key on either the builtin and secondary trusted keyring. > > > > This patch creates and includes in the kernel image an ephemeral CA > > key, at build time when IMA_APPRAISE_MODSIG is enabled. > > > > Signed-off-by: Nayna Jain > > --- > > diff --git a/certs/Makefile b/certs/Makefile > > > @@ -60,14 +78,23 @@ $(obj)/signing_key.pem: $(obj)/x509.genkey > > @$(kecho) "### needs to be run as root, and uses a hardware random" > > @$(kecho) "### number generator if one is available." > > @$(kecho) "###" > > +ifeq ($(CONFIG_IMA_APPRAISE_MODSIG),y) > > + # Generate kernel build time CA Certificate. > > + @$(Q)openssl req -new -nodes -utf8 \ > > + -$(CONFIG_MODULE_SIG_HASH) -days 36500 \ > > + -subj "/CN=Build time autogenerated kernel CA key" \ > > + -batch -x509 -config $(obj)/x509.genkey \ > > + -outform PEM -out $(CA_KEY) \ > > + -keyout $(CA_KEY) -extensions ca_ext \ > > + $($(quiet)redirect_openssl) > > +endif # CONFIG_IMA_APPRAISE_MODSIG > > $(Q)openssl req -new -nodes -utf8 \ > > -batch -config $(obj)/x509.genkey \ > > -outform PEM -out $(obj)/signing_key.csr \ > > -keyout $(obj)/signing_key.key -extensions myexts \ > > $($(quiet)redirect_openssl) > > $(Q)openssl x509 -req -days 36500 -in $(obj)/signing_key.csr \ > > - -outform PEM -out $(obj)/signing_key.crt \ > > - -signkey $(obj)/signing_key.key \ > > + -outform PEM -out $(obj)/signing_key.crt $(SIGNER) \ > > -$(CONFIG_MODULE_SIG_HASH) -extensions myexts \ > > -extfile $(obj)/x509.genkey \ > > $($(quiet)redirect_openssl) > > It may make things easier (also below) if the CA was always created and > the kernel signing key was always signed by that CA rather than doing > this only in the IMA_APPRAISE_MODSIG case. Maybe someone else has an > opinion on that? Thanks, Stefan. It would definitely simplify the code. We wanted to minimize the code change and solicit feedback, before making such a change. Mimi