Received: by 10.192.165.148 with SMTP id m20csp487523imm; Wed, 9 May 2018 16:50:56 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqCPSJbgfrT/z510yUpwW/GrIJRF/xlTzzsd7oVMYM0m3/e0gOPZZ6Fp0HO0wmVm7N5SYfX X-Received: by 10.98.190.16 with SMTP id l16mr22889190pff.180.1525909856100; Wed, 09 May 2018 16:50:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525909856; cv=none; d=google.com; s=arc-20160816; b=IZpmTwYmPqna+uwXdnX5WZca5QKHha9vESoOmHFFVaihCP5ol+er11GTddVUz/pJ6E kFjhCsn7dz05mKSOcMjGOYL8R+6671Mz6X8TGWV2+TZVgcHayLGrin4O9xwovmIMfgwN Gv3WNMPRUBTWTrJ4cUPyWvF3P5lvbidCn6j1qPhLPPT2gmb0VgKwB2esJtC6ez5AJHyT 6aW3wzg+dSzlCw8kcgJ5fuyiSRtHQGuaK2BcNjL2AAs6QcT6gngKuTAicltqg2e6GX0W xX1Ce6yL/GcPIFP9vxh8PvDGcJvhFL/Aa4I3YtN7vjLMu9cbPVKPRswx+BXCLhP4sQD+ LB1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=wmHaVLvhHlUnUHz2QnjoFYpNTsNxO241y9wBANC80Xw=; b=BLoO4/uRkH+vGgn1q8Gn3QXaT6M0ls4LIEpO/2QSh4kD8Jh/fTlasFkhzVB4InHST5 mmgDAnxhwIe9a6JU8qn8YonDTSvGsusv5EkBzp0QMBvT7IkjUmVxJT3QGteG5nduQquU IoZovMGjHLVmrxEAB3yiiZnti1MW5YFZx3Ir820UrzM6Qwk0vjBq+D+SDJ8bTZQoD7hX MO5iJXfWQ2aulUkfJ9qdSgQtmu1/yPt4UCErPH8XM9iie2Uk0b+Yq6t6nqH3yhNd44Sz zISXszdXohEpC/0+m9vIm2HZbDQ8750ejG4Z0Cam5G2xyvys6cqzSsO4Udk8KehoUGRc Ishw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w61-v6si27461784plb.155.2018.05.09.16.50.30; Wed, 09 May 2018 16:50:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966039AbeEIXsV (ORCPT + 99 others); Wed, 9 May 2018 19:48:21 -0400 Received: from mx2.suse.de ([195.135.220.15]:49398 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965244AbeEIXsR (ORCPT ); Wed, 9 May 2018 19:48:17 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 64B75AE35; Wed, 9 May 2018 23:48:15 +0000 (UTC) Date: Wed, 9 May 2018 23:48:14 +0000 From: "Luis R. Rodriguez" To: Mimi Zohar , Matthew Garrett , Peter Jones , "AKASHI, Takahiro" , David Howells Cc: "Luis R. Rodriguez" , linux-wireless , Kalle Valo , Seth Forshee , Johannes Berg , linux-integrity@vger.kernel.org, Hans de Goede , Ard Biesheuvel , linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Kees Cook , Greg Kroah-Hartman , Andres Rodriguez , Linus Torvalds , Andy Lutomirski Subject: Re: [PATCH 3/6] firmware: differentiate between signed regulatory.db and other firmware Message-ID: <20180509234814.GY27853@wotan.suse.de> References: <1525182503-13849-1-git-send-email-zohar@linux.vnet.ibm.com> <1525182503-13849-4-git-send-email-zohar@linux.vnet.ibm.com> <20180504000743.GR27853@wotan.suse.de> <1525393466.3539.133.camel@linux.vnet.ibm.com> <20180508173404.GG27853@wotan.suse.de> <1525865428.3551.175.camel@linux.vnet.ibm.com> <20180509191508.GR27853@wotan.suse.de> <1525895838.3551.247.camel@linux.vnet.ibm.com> <20180509212212.GX27853@wotan.suse.de> <1525903617.3551.281.camel@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1525903617.3551.281.camel@linux.vnet.ibm.com> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 09, 2018 at 06:06:57PM -0400, Mimi Zohar wrote: > On Wed, 2018-05-09 at 21:22 +0000, Luis R. Rodriguez wrote: > > > > OK, its still not clear to what it will do. If it does not touch the firmware > > loader code, and it just sets and configures IMA to do file signature checking > > on its own, then yes I think both mechanisms would be doing the similar work. > > > > Wouldn't IMA do file signature checks then for all files? Or it would just > > enable this for whatever files userspace wishes to cover? > > Enabling CONFIG_IMA_APPRAISE_FIRMWARE would enforce firmware > signatures on all directly loaded firmware and fail any method of > loading firmware that the signature couldn't be verified. Ah, so a generic firmware signing mechanism via IMA. Sounds very sensible to me. Specially in light of the fact that its what we recommend folks to consider if they need to address firmware signing for devices which do not have the ability to do hardware firmware signing verification on their own. > > One of the things with READING_FIRMWARE_REGULATORY_DB is to also use and trust > > the wireless-regdgb maintainer's key for this file, could IMA be configured to > > do that? > > IMA has its own trusted keyring. ?So either the maintainer's key would > need to be added to the IMA keyring, I see so we'd need this documented somehow. > or IMA-appraisal would need to use the regdb keyring. Can you describe this a bit more, for those not too familiar with IMA, in terms of what would be involved in the kernel? Or is this all userspace configuration stuff? > > Because that would be one difference here. The whole point of adding > > CONFIG_CFG80211_REQUIRE_SIGNED_REGDB was to replace CRDA which is a userspace > > component which checks the signature of regulatory.db before reading it and > > passing data to the kernel from it. > > > > Now, however silly it may be to have CONFIG_IMA_APPRAISE_FIRMWARE *and* > > CONFIG_CFG80211_REQUIRE_SIGNED_REGDB, is your intent in this new patch set > > you are mentioning, to still enable both to co-exist? > > At build, either CONFIG_CFG80211_REQUIRE_SIGNED_REGDB or > CONFIG_IMA_APPRAISE_FIRMWARE, where IMA is appraising all firwmare, > would be enabled, not both. OK. > > > Yes, writing regdb as a micro/mini LSM sounds reasonable. ?The LSM > > > would differentiate between other firmware and the regulatory.db based > > > on the firmware's pathname. > > > > If that is the only way then it would be silly to do the mini LSM as all > > calls would have to have the check. A special LSM hook for just the > > regulatory db also doesn't make much sense. > > All calls to request_firmware() are already going through this LSM > hook. ?I should have said, it would be based on both READING_FIRMWARE > and the firmware's pathname. Yes, but it would still be a strcmp() computation added for all READING_FIRMWARE. In that sense, the current arrangement is only open coding the signature verification for the regulatory.db file. One way to avoid this would be to add an LSM specific to the regulatory db and have the security_check_regulatory_db() do what it needs per LSM, but that would mean setting a precedent for open possibly open coded future firmware verification call. Its not too crazy to consider if an end goal may be avoid further open coded firmware signature verification hacks. > > > Making regdb an LSM would have the same issues as currently - deciding > > > if regdb, IMA-appraisal, or both verify the regdb's signature. > > > > Its unclear to me why they can't co-exist yet and not have to touch > > the firmware_loader code at all. > > With the changes discussed above, they will co-exist. ?Other than the > Kconfig changes, I don't think it will touch the firmware_loader code. Great. Luis