Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp639531pxu; Fri, 23 Oct 2020 09:33:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQEhfC1Csr59CBWNEkmerRD104UC+0juMdCrKt6AHouYrMMjHJnojW3CTDNmzZgpffTCjh X-Received: by 2002:aa7:d349:: with SMTP id m9mr3041569edr.51.1603470820200; Fri, 23 Oct 2020 09:33:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603470820; cv=none; d=google.com; s=arc-20160816; b=MWKfFRjTGkFhkMeaR9qzC5KC1d0wc8hQcv5MKBR+p8URo4wcS5chbiNv1haZO9HX3B IBnOO9wnLyl1b5MiiafWyxZfBTm/Z09Upj3C6oWPex5tD5uzZNpvIMWFGoULfHOinkCU r2h1sFOVlLnKYJ7w8lEEwyTtKND5aoB0zelhYxNLTKcPMKKB5Yglz0CJk8+QoLwG1ihq kHQ5LN/NBA/qsgjBE+6wQ3PUHfveL/myTJ3PLk+9AeBdG/d4hQdw7TriRzieA62hi7Eo 9t0tEmBNEHknsVx81CW1JazVfg774EzxtbtXCfcZI4DYogooQDfqaC2wOYtGUIxS7Dan Cf0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=jTHdNB/AczUtmx4fGGDW94Nf1D2Dq1eyonOLPvs49Qw=; b=WjoN8jKGKU5+B17Oe5nsspkHDvyngzad/ynYlMZRaakej+tkglYL9IR1qwbRgro11x 3L5Bk9rt5bne2kCflj1jswEU9UxSqZl+Mih06GiwAFoAsbfu3M3OaNRpSZHWCe2N39RO P3R+4gVs6q2/ty9TTGJdSUumgA5VQSTjJFYtC3cAMexu6Fiz++zcitKynIAhRHDh0eN6 kYPteTJ6YQT6hHkAoXd8DrXLAJ7pbt4HvPeI5hdjBAeCpbM5DOg1AG//CJWI4XPYxgwY ppBNmTLvRpi5Jyk/yt7oJt5pp6gRUkCCJ1AFuGF63t/eX59z0vKJd0jZGRhmBxNIBxu1 Ixnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Kriq1mIi; 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 l26si1053361edw.348.2020.10.23.09.33.18; Fri, 23 Oct 2020 09:33:40 -0700 (PDT) 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=Kriq1mIi; 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 S465609AbgJWPME (ORCPT + 99 others); Fri, 23 Oct 2020 11:12:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:43608 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S465606AbgJWPME (ORCPT ); Fri, 23 Oct 2020 11:12:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603465922; 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=jTHdNB/AczUtmx4fGGDW94Nf1D2Dq1eyonOLPvs49Qw=; b=Kriq1mIiVoFaCrt1h4rua56hueyjIikFwOQY5SeZAF617ejjX9fPZBoBBDRFY64z4z+5G6 9gtX0REltyEwShzPQ1cEffUyeCrkkQNw3Pu4LKqVpmLmSUi0GKzEDGTDZSLtax8xqr5hT8 rma5Hl9wm9i+zgt319l1OG3EojnYhjg= 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-192-veHNhlKUOSesxsITs8zIeQ-1; Fri, 23 Oct 2020 11:11:58 -0400 X-MC-Unique: veHNhlKUOSesxsITs8zIeQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C31A74236C; Fri, 23 Oct 2020 15:11:56 +0000 (UTC) Received: from localhost (unknown [10.18.25.174]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 48C855D9D5; Fri, 23 Oct 2020 15:11:53 +0000 (UTC) Date: Fri, 23 Oct 2020 11:11:52 -0400 From: Mike Snitzer To: =?iso-8859-1?Q?Micka=EBl_Sala=FCn?= Cc: Alasdair Kergon , Andrew Morton , Deven Bowers , Jaskaran Khurana , dm-devel@redhat.com, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, Jarkko Sakkinen , =?iso-8859-1?Q?Micka=EBl_Sala=FCn?= , Milan Broz Subject: Re: [PATCH v2] dm verity: Add support for signature verification with 2nd keyring Message-ID: <20201023151152.GA21936@redhat.com> References: <20201015150504.1319098-1-mic@digikod.net> <20201015165229.GA5513@redhat.com> <022e949e-00c4-d98a-b536-1c5f9e05c09c@digikod.net> <55389f91-60a5-05db-b3e1-8f24aa356893@digikod.net> <54e98aa6-0e52-1147-b9ce-a640e2317b00@digikod.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <54e98aa6-0e52-1147-b9ce-a640e2317b00@digikod.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 23 2020 at 6:20am -0400, Micka?l Sala?n wrote: > It seems that there is no more question. Mike, Alasdair, could you > please consider to merge this into the tree? > > On 16/10/2020 14:19, Micka?l Sala?n wrote: > > > > On 16/10/2020 13:08, Milan Broz wrote: > >> On 16/10/2020 10:49, Micka?l Sala?n wrote: > >>> On 16/10/2020 10:29, Micka?l Sala?n wrote: > >>>> > >>>> On 15/10/2020 18:52, Mike Snitzer wrote: > >>>>> Can you please explain why you've decided to make this a Kconfig CONFIG > >>>>> knob?? Why not either add: a dm-verity table argument? A dm-verity > >>>>> kernel module parameter? or both (to allow a particular default but > >>>>> then > >>>>> per-device override)? > >>>> > >>>> The purpose of signed dm-verity images is to authenticate files, or said > >>>> in another way, to enable the kernel to trust disk images in a flexible > >>>> way (i.e. thanks to certificate's chain of trust). Being able to update > >>>> such chain at run time requires to use the second trusted keyring. This > >>>> keyring automatically includes the certificate authorities from the > >>>> builtin trusted keyring, which are required to dynamically populate the > >>>> secondary trusted keyring with certificates signed by an already trusted > >>>> authority. The roots of trust must then be included at build time in the > >>>> builtin trusted keyring. > >>>> > >>>> To be meaningful, using dm-verity signatures implies to have a > >>>> restricted user space, i.e. even the root user has limited power over > >>>> the kernel and the rest of the system. Blindly trusting data provided by > >>>> user space (e.g. dm-verity table argument, kernel module parameter) > >>>> defeat the purpose of (mandatory) authenticated images. > >>>> > >>>>> > >>>>> Otherwise, _all_ DM verity devices will be configured to use secondary > >>>>> keyring fallback.? Is that really desirable? > >>>> > >>>> That is already the current state (on purpose). > >>> > >>> I meant that when DM_VERITY_VERIFY_ROOTHASH_SIG is set, dm-verity > >>> signature becomes mandatory. This new configuration > >>> DM_VERITY_VERIFY_ROOTHASH_SIG_SECONDARY_KEYRING extend this trust to the > >>> secondary trusted keyring, which contains certificates signed (directly > >>> or indirectly) by CA from the builtin trusted keyring. > >>> > >>> So yes, this new (optional) configuration *extends* the source of trust > >>> for all dm-verity devices, and yes, it is desirable. I think it should > >>> have been this way from the beginning (as for other authentication > >>> mechanisms) but it wasn't necessary at that time. > >> > >> Well, I understand why you need a config option here. > >> And using the secondary keyring actually makes much more sense to me than > >> the original approach. > >> > >> But please do not forget that dm-verity is sometimes used in different > >> contexts where such strict in-kernel certificate trust is unnecessary. > >> With your configure options set, you deliberately remove the possibility > >> to configure such devices. > > It doesn't make sense to set DM_VERITY_VERIFY_ROOTHASH_SIG in generic > > distro because such policy is configured at build time in the kernel > > with hardcoded CAs. If the new option is not set then nothing change. I > > don't see why it could be an issue for use cases we previously defined > > (with DM_VERITY_VERIFY_ROOTHASH_SIG). > > > >> I understand that it is needed for "trusted" systems, but we should be > >> clear > >> in the documentation. > >> Maybe also add note to > >> /Documentation/admin-guide/device-mapper/verity.rst ? > >> We already mention DM_VERITY_VERIFY_ROOTHASH_SIG there. > > > > The current documentation remains true. > > DM_VERITY_VERIFY_ROOTHASH_SIG_SECONDARY_KEYRING depends on > > DM_VERITY_VERIFY_ROOTHASH_SIG. Yes, while true that doesn't change the fact that documenting DM_VERITY_VERIFY_ROOTHASH_SIG_SECONDARY_KEYRING is useful to potential consumers of baseline DM_VERITY_VERIFY_ROOTHASH_SIG. Please update Documentation and post v3, I'll get it merged for 5.11. Thanks, Mike