Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1155522pxf; Fri, 12 Mar 2021 03:21:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJyQDaYZ9BSNEcZRerORCOpIGziOj+6g/+ToCXPDSwiQhXKtVVdcYABI2jc270JXts38JJnp X-Received: by 2002:a5d:8543:: with SMTP id b3mr9534323ios.137.1615548074448; Fri, 12 Mar 2021 03:21:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615548074; cv=none; d=google.com; s=arc-20160816; b=UYBd7LwuZxPef9xqhGQ70vbswXMbofHkjNH1Y/FbXx1aq19/qbunYHx4aff0Cf/xUZ 4B9nosqusA6SzbUQzvzrgclEqXyrRsa51kXQUF2xdju20H2X3FFpUq/scAsluhEB6koc bAsjmrKOX+momu0VzahFRg6ogxT6sOUCgs1FsBmp8bU6RwNrgjJhew5sfV3yOjHcQn1+ ccPtZG5QOnK3Jkwihbxt6REtaheqel67TwC7z76Ca7WftYIXitR1c/GP5gepkW0I7acf wg+5GNHGPq03nTP0OA/wTMT1ZW+G/XwsdyMNfNeTWPj1v8iNlh3zuM8WeSmiHg15hKcp LHVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:content-transfer-encoding :mime-version:subject:cc:to:references:in-reply-to:from:organization :dkim-signature; bh=lq8VZTvhiQyjj3632ogoEtY0kjN8T+zd6L5p5AcI2Ho=; b=eO9zeGGI18w6tv2iReAxtOdmNAfg66/n1V/0UFgzpOE+gi5kQT8aCDSER5x1jWYTR1 x/HZ/8AxFqkQnGdFCOLQdd3AzeVkPt8+OApCPw3LVlVzimr7edji+xW7bYF++rp6CdOB 6ZfI3hawTi79vzIyNZNtViAyaKT9cX8g6nQEAYwZ6JLYk31VlhMyP66g5ES+QCIr9iv2 lBY/OBMncO8IIUpZ5AOmLlHOZwgyWEE6hh2c0rQMnTSmUuU2dg7H9pEyo+AxSLRy3HNB o9AXqrU03dohk0hbDcjnjtZfTyeY4HQRwK6rGu6hmXGNHzFk8LtUX8QUoG57LFZHcbf3 i/mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MGZ7hCoK; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 1si4994978ilq.120.2021.03.12.03.20.59; Fri, 12 Mar 2021 03:21:14 -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=@redhat.com header.s=mimecast20190719 header.b=MGZ7hCoK; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233808AbhCLLUF (ORCPT + 99 others); Fri, 12 Mar 2021 06:20:05 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:25845 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233692AbhCLLTh (ORCPT ); Fri, 12 Mar 2021 06:19:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615547976; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lq8VZTvhiQyjj3632ogoEtY0kjN8T+zd6L5p5AcI2Ho=; b=MGZ7hCoKJRogEzDkMnFSH972/p1W4qXONZ4dTRaklKFKg0aIzCZqhxvpET2givVQBFYJYZ KVQWuaUw3Efspim82Az2EAqiKzssZk47wSCTnG4iY4KbEss/A+w2wkj4KQkcBFT+TWuVWu bnSTV4Th5/yQ3/c+h4ujjUVzsXt/JPg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-411-J4tJfRUMN6iVAt6BEQcGXw-1; Fri, 12 Mar 2021 06:19:34 -0500 X-MC-Unique: J4tJfRUMN6iVAt6BEQcGXw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ACA98101F010; Fri, 12 Mar 2021 11:19:33 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-118-152.rdu2.redhat.com [10.10.118.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9124760D06; Fri, 12 Mar 2021 11:19:32 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <159991.1615539999@turing-police> References: <159991.1615539999@turing-police> <134696.1615510534@turing-police> <109018.1615463088@turing-police> <91190.1615444370@turing-police> <972381.1615459754@warthog.procyon.org.uk> <1486567.1615464259@warthog.procyon.org.uk> <2026575.1615539696@warthog.procyon.org.uk> To: =?us-ascii?Q?Valdis_Kl=3D=3Futf-8=3FQ=3F=3Dc4=3D93=3F=3Dtnieks?= Cc: dhowells@redhat.com, David Woodhouse , keyrings@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] certs: Clean up signing_key.pem and x509.genkey on make mrproper MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 12 Mar 2021 11:19:31 +0000 Message-ID: <2243141.1615547971@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Valdis Kl=C4=93tnieks wrote: > > Possibly I can add something like: > > > > clean-files :=3D signing_key.pem x509.genkey > > > > inside the > > > > ifeq ($(CONFIG_MODULE_SIG_KEY),"certs/signing_key.pem") > > ... > > endif >=20 > Would that remove them on a 'make clean', or only a 'make mrproper'? > The latter sounds like the correct solution to me, as the signing key sho= uld > have (roughly) the same lifetime rules as the .config file. It would appear that it works on neither. Neither of them seem to have any CONFIG_xxx symbols set. How about the attached patch? David --- commit 95897dc8dc13ad13c637a477a1ead9b63ff1fafa Author: David Howells Date: Fri Mar 12 10:48:25 2021 +0000 certs: Clean up signing_key.pem and x509.genkey on make mrproper =20=20=20=20 Autogenerated signing_key.pem and x509.genkey files aren't removed from= the build certs/ directory when "make mrproper" is run. This is somewhat deliberate since the "file" is specified by the CONFIG_MODULE_SIG_KEY string option and may not be in the build tree - and may not even be a filename, but rather a PKCS#7 URI (also the config variables doesn't se= em to be set when cleaning). =20=20=20=20 Fix this by unconditionally listing signing_key.pem and x509.genkey for removal from the build certs/ directory - which will just do nothing if they're not there, and shouldn't remove signing keys that are configure= d to be elsewhere. =20=20=20=20 Note that this will permanently erase the autogenerated private key, so anyone that is relying on it still being around after doing make mrprop= er will no longer find it. =20=20=20=20 Fixes: cfc411e7fff3 ("Move certificate handling to its own directory") Reported-by: Valdis Kl=C4=93tnieks Signed-off-by: David Howells Link: https://lore.kernel.org/r/134696.1615510534@turing-police/ [1] diff --git a/certs/Makefile b/certs/Makefile index f4c25b67aad9..2ae1dd518bc7 100644 --- a/certs/Makefile +++ b/certs/Makefile @@ -104,3 +104,5 @@ targets +=3D signing_key.x509 $(obj)/signing_key.x509: scripts/extract-cert $(X509_DEP) FORCE $(call if_changed,extract_certs,$(MODULE_SIG_KEY_SRCPREFIX)$(CONFIG_MODUL= E_SIG_KEY)) endif # CONFIG_MODULE_SIG + +clean-files +=3D signing_key.pem x509.genkey