From patchwork Wed May 10 15:04:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Gortmaker X-Patchwork-Id: 23800 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BB9FC7EE23 for ; Wed, 10 May 2023 15:55:50 +0000 (UTC) Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) by mx.groups.io with SMTP id smtpd.web10.19996.1683731086100743286 for ; Wed, 10 May 2023 08:04:46 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@windriver.com header.s=pps06212021 header.b=gfrZLoZk; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: windriver.com, ip: 205.220.166.238, mailfrom: prvs=4494f4ed9d=paul.gortmaker@windriver.com) Received: from pps.filterd (m0250810.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34ACBxCw025302; Wed, 10 May 2023 08:04:45 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PPS06212021; bh=zXTPhJttE95vg1kXsn4HPZmA1KiO9WJzlW1Ij2z5kcE=; b=gfrZLoZkvGKp3bd/1ij8enSH0CVzKgjSJa2nl5b565JQoRYXy51hTnLOaLGCfFSlfR4M 97PMPFAmOaGIAgLIqJuDoROAYWfn5nnJNueBjYR05UGLx+nOfrK5exhuxhxE7hLUlldR SBYL0dYNHIp8CBxGJVdn0qj9rjofmQVYC8rOLqvAROQB/6zkFtI+JFl2+h6a/tVHHpXF uSiRG7LzBWLGMnNosyRKezlul1pcvE2ftmCjQUSYrVMDq5Aasy2hQN6N5+OW7xMDBQ+x GUbuveF6hGRQYY5sy1TitMOqMb1QG+cGpMJTXTcSA3UF6ItNGmHV9u3W6o1u9S03LkqY 5Q== Received: from ala-exchng02.corp.ad.wrs.com (unknown-82-254.windriver.com [147.11.82.254]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3qf81jss5t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 10 May 2023 08:04:44 -0700 Received: from ala-exchng01.corp.ad.wrs.com (147.11.82.252) by ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 10 May 2023 08:04:43 -0700 Received: from yow-lpggp3.wrs.com (128.224.137.13) by ala-exchng01.corp.ad.wrs.com (147.11.82.252) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Wed, 10 May 2023 08:04:43 -0700 From: "Paul Gortmaker" To: Armin Kuster CC: Subject: [meta-security][PATCH 1/4] dm-verity: ensure people don't ignore the DISTRO_FEATURES warning Date: Wed, 10 May 2023 11:04:39 -0400 Message-ID: <20230510150442.2427548-2-paul.gortmaker@windriver.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230510150442.2427548-1-paul.gortmaker@windriver.com> References: <20230510150442.2427548-1-paul.gortmaker@windriver.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 7z8nZwUCDMA0VlGQ0GwYdUSP8zqt0KBl X-Proofpoint-GUID: 7z8nZwUCDMA0VlGQ0GwYdUSP8zqt0KBl X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-10_04,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 mlxscore=0 bulkscore=0 clxscore=1015 spamscore=0 mlxlogscore=999 lowpriorityscore=0 phishscore=0 suspectscore=0 priorityscore=1501 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305100121 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 10 May 2023 15:55:50 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto/message/59973 From: Paul Gortmaker Some platform creators tend to list a whole bunch of layers by default in conf/bblayers.conf. Without getting into the debate of whether that is a good idea, it can tend to have the effect of people seeing the meta-security DISTRO_FEATURES warning time and time again and becoming essentially numb to it. After having fallen into this trap myself, I figured it was worth the extra mention in the dm-verity doc so there is a better chance of users realizing "hey - this applies to me!". Signed-off-by: Paul Gortmaker --- docs/dm-verity.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/dm-verity.txt b/docs/dm-verity.txt index 602a82693930..ce1839520982 100644 --- a/docs/dm-verity.txt +++ b/docs/dm-verity.txt @@ -31,6 +31,8 @@ Kernel Configuration Kernel configuration for dm-verity happens automatically via IMAGE_CLASSES which will source features/device-mapper/dm-verity.scc when dm-verity-img is used. [See commit d9feafe991c] +IMPORTANT: As per the top level README, you *must* put security in the +DISTRO_FEATURES, or else you won't get the dm-verity kernel settings. Supported Platforms ------------------- From patchwork Wed May 10 15:04:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Gortmaker X-Patchwork-Id: 23802 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D5ACC7EE2A for ; Wed, 10 May 2023 15:55:50 +0000 (UTC) Received: from mx0b-0064b401.pphosted.com (mx0b-0064b401.pphosted.com [205.220.178.238]) by mx.groups.io with SMTP id smtpd.web11.19873.1683731087146358567 for ; Wed, 10 May 2023 08:04:47 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@windriver.com header.s=pps06212021 header.b=cvP2TrhR; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: windriver.com, ip: 205.220.178.238, mailfrom: prvs=4494f4ed9d=paul.gortmaker@windriver.com) Received: from pps.filterd (m0250812.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34AAeZCh023728; Wed, 10 May 2023 15:04:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PPS06212021; bh=A1fyh/VEx/avITmHk3Pyx3s0bygJkqyqy/qeKgi4WU0=; b=cvP2TrhRh5rMfr28ebNJDBbp+w6UTukPKn8jM1fXZsOwTVnLgFWGO/J8fTWmAGH2iTDZ UY5hpbNA8ogK6/hep8GT7dj5yTcA6d9QGoZu7e/RIZmNFDaQe8XzmO12zy9KixxH8n2N xnW0CvrLQeU9a+L6M9xD83G+QPs/3IjcVC5xxPRq6U+RfO/VJVv2r9wIJKsDxtJ1DQpl 3P/J4MBOsfI3UsTuGIgTJ6eZTafpZtNSFC9b/yiuvFuaLXYDL49X1Y5SxqqOohNyD3AD RrlxzAgZgSmz4Qyz86820Hso6cBZRHeXpGQdyHl7k3GnnL/4dCkrdvL3eC8X/ELhjniY mw== Received: from ala-exchng01.corp.ad.wrs.com (unknown-82-252.windriver.com [147.11.82.252]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3qf8b91rc3-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 10 May 2023 15:04:44 +0000 Received: from ala-exchng01.corp.ad.wrs.com (147.11.82.252) by ala-exchng01.corp.ad.wrs.com (147.11.82.252) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 10 May 2023 08:04:44 -0700 Received: from yow-lpggp3.wrs.com (128.224.137.13) by ala-exchng01.corp.ad.wrs.com (147.11.82.252) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Wed, 10 May 2023 08:04:44 -0700 From: "Paul Gortmaker" To: Armin Kuster CC: Subject: [meta-security][PATCH 2/4] dm-verity: don't make read-only-rootfs sound like a requirement Date: Wed, 10 May 2023 11:04:40 -0400 Message-ID: <20230510150442.2427548-3-paul.gortmaker@windriver.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230510150442.2427548-1-paul.gortmaker@windriver.com> References: <20230510150442.2427548-1-paul.gortmaker@windriver.com> MIME-Version: 1.0 X-Proofpoint-GUID: DvPbQVHwyXHcdz2mm1FI-gKdTh7Z-sjc X-Proofpoint-ORIG-GUID: DvPbQVHwyXHcdz2mm1FI-gKdTh7Z-sjc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-10_04,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 impostorscore=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=803 adultscore=0 spamscore=0 malwarescore=0 suspectscore=0 phishscore=0 priorityscore=1501 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305100121 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 10 May 2023 15:55:50 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto/message/59975 From: Paul Gortmaker Adding to your local.conf right out of the gate: EXTRA_IMAGE_FEATURES = "read-only-rootfs" while you are trying to sort out other things can be just another complication to an already steep learning curve. For example, I found simply enabling this with systemd caused: systemd[1]: Failed to fork off sandboxing environment for executing generators: Protocol error [!!!!!!] Failed to start up manager. systemd[1]: Freezing execution. While I'd like to get to the root cause of that, it doesn't change that things boot fine w/o adding to EXTRA_IMAGE_FEATURES, even though the rootfs is still read-only courtesy of dm-verity. Reword things so as to make it clear it isn't strictly a hard requirement and hence can be delayed as people work through their implementation. Signed-off-by: Paul Gortmaker --- docs/dm-verity.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/dm-verity.txt b/docs/dm-verity.txt index ce1839520982..c2dce739790d 100644 --- a/docs/dm-verity.txt +++ b/docs/dm-verity.txt @@ -53,11 +53,18 @@ conf/local.conf and conf/bblayers.conf from the oe-init-build-env Firstly, you need the meta-security layer to conf/bblayers.conf along with the dependencies it has -- see the top level meta-security README for that. -Next, assuming you'll be using dm-verity for validation of your rootfs, -you'll need to enable read-only rootfs support in your local.conf with: +Note that if you are using dm-verity for your rootfs, then it enforces a +read-only mount right at the kernel level, so be prepared for issues such +as failed creation of temporary files and similar. + +Yocto does support additional checks and changes via setting: EXTRA_IMAGE_FEATURES = "read-only-rootfs" +...but since read-only is enforced at the kernel level already, using +this feature isn't a hard requirement. It may be best to delay/defer +making use of this until after you've established basic booting. + For more details, see the associated documentation: https://docs.yoctoproject.org/dev/dev-manual/read-only-rootfs.html From patchwork Wed May 10 15:04:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Gortmaker X-Patchwork-Id: 23801 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A919C77B7C for ; Wed, 10 May 2023 15:55:50 +0000 (UTC) Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) by mx.groups.io with SMTP id smtpd.web11.19872.1683731086148950846 for ; Wed, 10 May 2023 08:04:46 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@windriver.com header.s=pps06212021 header.b=Ec+VAl+E; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: windriver.com, ip: 205.220.166.238, mailfrom: prvs=4494f4ed9d=paul.gortmaker@windriver.com) Received: from pps.filterd (m0250810.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34ACBxCx025302; Wed, 10 May 2023 08:04:45 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PPS06212021; bh=Ti5CxhzqiwTKvKGfiOnXNzeJI/BdZk6bOt+OHy6UTzo=; b=Ec+VAl+E2dL3r2TOOp+I+5L/yztRStJgXRL4ltknuSU044JhZgLxaQl7KeTGATAPeM9B /bWe0A3rp+J/c2wK7ZsrE41AD6RccmojazT+j90VBq3wUWqkakEBG/x4+cb8JTwJuTHj QagzcA41Y4SNNlXLRshima5GwQa2bMqjpOoaxpEq93fICpGO2b9HW/9m9VavDJ/Vr5WI uAFSoNnkD3pSSnLP4QJ0YnraUdk8X8apUTNkmgcgBwEHBq+ZpjCeYoo3rVv2mJ+kUhpI 7+sCyo6j+KW1eZtW2dAMKmgz8NSy4wcpPeLR3XtIbq06RFycjRiWhPN+jjywwy4YgEzg Eg== Received: from ala-exchng02.corp.ad.wrs.com (unknown-82-254.windriver.com [147.11.82.254]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3qf81jss5t-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 10 May 2023 08:04:45 -0700 Received: from ala-exchng01.corp.ad.wrs.com (147.11.82.252) by ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 10 May 2023 08:04:44 -0700 Received: from yow-lpggp3.wrs.com (128.224.137.13) by ala-exchng01.corp.ad.wrs.com (147.11.82.252) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Wed, 10 May 2023 08:04:44 -0700 From: "Paul Gortmaker" To: Armin Kuster CC: Subject: [meta-security][PATCH 3/4] dm-verity: document the meta-intel dependency in the systemd example Date: Wed, 10 May 2023 11:04:41 -0400 Message-ID: <20230510150442.2427548-4-paul.gortmaker@windriver.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230510150442.2427548-1-paul.gortmaker@windriver.com> References: <20230510150442.2427548-1-paul.gortmaker@windriver.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: laVWCNU9JUNNK-kuvxiZq8pWQ6beojY3 X-Proofpoint-GUID: laVWCNU9JUNNK-kuvxiZq8pWQ6beojY3 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-10_04,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 mlxscore=0 bulkscore=0 clxscore=1015 spamscore=0 mlxlogscore=884 lowpriorityscore=0 phishscore=0 suspectscore=0 priorityscore=1501 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305100121 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 10 May 2023 15:55:50 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto/message/59972 From: Paul Gortmaker The dependency might not be obvious to everyone, so leave a hint. Signed-off-by: Paul Gortmaker --- wic/systemd-bootdisk-dmverity.wks.in | 1 + 1 file changed, 1 insertion(+) diff --git a/wic/systemd-bootdisk-dmverity.wks.in b/wic/systemd-bootdisk-dmverity.wks.in index ef114cab03a1..a275a488912a 100644 --- a/wic/systemd-bootdisk-dmverity.wks.in +++ b/wic/systemd-bootdisk-dmverity.wks.in @@ -5,6 +5,7 @@ # Based on OE-core's systemd-bootdisk.wks and meta-security's beaglebone-yocto-verity.wks.in file # # This .wks only works with the dm-verity-img class. +# Also note that the use of microcode.cpio introduces a meta-intel layer dependency. part /boot --source bootimg-efi --sourceparams="loader=systemd-boot,initrd=microcode.cpio" --ondisk sda --label msdos --active --align 1024 --use-uuid From patchwork Wed May 10 15:04:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Gortmaker X-Patchwork-Id: 23803 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55AE4C77B7D for ; Wed, 10 May 2023 15:55:50 +0000 (UTC) Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) by mx.groups.io with SMTP id smtpd.web10.19997.1683731087889347377 for ; Wed, 10 May 2023 08:04:47 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@windriver.com header.s=pps06212021 header.b=EFkIilmM; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: windriver.com, ip: 205.220.166.238, mailfrom: prvs=4494f4ed9d=paul.gortmaker@windriver.com) Received: from pps.filterd (m0250810.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34AAKEqZ023775; Wed, 10 May 2023 08:04:46 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PPS06212021; bh=WC+wOA/Ylytve9tpLwaUwdCvWdhcavlLWFKnVtt9fjs=; b=EFkIilmMrUqNdcwzXKXrb3pxB1JGPIydacWoOrUxxGK+3JqcPYMLOLQh7WBrws0EgfHo 95CXCTrxgMZ8ftTU1/6AqNVzC8tiE39GwzA7fxJWT+pTW3urKARyoY3KV9FTpNTWdJjc b6GligN9K73NxF6dDG8e9Lo1QD8sTgoXcA7z6LSaTBuy8v0JOtfhsp/os2v+8rrXN9DC CPpyLoTul9tq/Hs7xoG4cbrn++2MXfLRpVVX9J1G7kflvwgRNCf6QII9YX3AT9yE6UWZ c5pR6b2ZDC4eFP5CxcuOCOrhhxhEEVkbZooEBVKMpghPBVLC7gULaE8KJaao3MZBxUVe BA== Received: from ala-exchng02.corp.ad.wrs.com (unknown-82-254.windriver.com [147.11.82.254]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3qf81jss5v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 10 May 2023 08:04:45 -0700 Received: from ala-exchng01.corp.ad.wrs.com (147.11.82.252) by ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 10 May 2023 08:04:45 -0700 Received: from yow-lpggp3.wrs.com (128.224.137.13) by ala-exchng01.corp.ad.wrs.com (147.11.82.252) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Wed, 10 May 2023 08:04:45 -0700 From: "Paul Gortmaker" To: Armin Kuster CC: Subject: [meta-security][PATCH 4/4] dm-verity: add x86-64 systemd based example instructions Date: Wed, 10 May 2023 11:04:42 -0400 Message-ID: <20230510150442.2427548-5-paul.gortmaker@windriver.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230510150442.2427548-1-paul.gortmaker@windriver.com> References: <20230510150442.2427548-1-paul.gortmaker@windriver.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: uOFYT_7xkDLcvb6LF7wzT_hdTPjv7zPA X-Proofpoint-GUID: uOFYT_7xkDLcvb6LF7wzT_hdTPjv7zPA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-10_04,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 mlxscore=0 bulkscore=0 clxscore=1015 spamscore=0 mlxlogscore=999 lowpriorityscore=0 phishscore=0 suspectscore=0 priorityscore=1501 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305100121 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 10 May 2023 15:55:50 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto/message/59976 From: Paul Gortmaker We have systemd-bootdisk-dmverity.wks.in as an example template but no mention of it in docs or config files. Similar to the beaglebone black insructions added earlier, we do the same for (qemu)x86-64. This hopefully walks through getting things configured for building a systemd based dm-verity image and booting it on qemux86-64 --filling in a lot of blanks and assumptions so that someone relatively new to the feature can get off the ground more quickly by using qemu as a stepping stone towards their final physical implementation. Finally, the full image is deployed and booted on real hardware. Signed-off-by: Paul Gortmaker --- docs/dm-verity-systemd-x86-64.txt | 77 +++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 docs/dm-verity-systemd-x86-64.txt diff --git a/docs/dm-verity-systemd-x86-64.txt b/docs/dm-verity-systemd-x86-64.txt new file mode 100644 index 000000000000..a47b02c853b9 --- /dev/null +++ b/docs/dm-verity-systemd-x86-64.txt @@ -0,0 +1,77 @@ +dm-verity and x86-64 and systemd +-------------------------------- +In this example, we'll target combining qemux86-64 with dm-verity and +also systemd - systemd has dm-verity bindings and is more likely to be +used on x86. + +While dm-verity in a qemu environment doesn't make practial sense as a +deployment - it can be a useful stepping stone for testing and getting to +a final physical deployment. + +Set/uncomment the MACHINE line for "qemux86-64" if you haven't yet. It +should be the default if unspecified, but check to be sure. As of this +writing (kernel v6.1) the resulting qemux86-64 build can also be booted +successfully on physical hardware, but if you don't intend to use qemu, +you might instead want to choose "genericx86-64" + +This will make use of wic/systemd-bootdisk-dmverity.wks.in -- note that it +contains a dependency on the meta-intel layer for microcode, so you'll need +to fetch and add that layer in addition to the meta-security related layers. + +In addition to the basic dm-verity settings, choose systemd in local.conf: + +DISTRO_FEATURES:append = " security systemd" +VIRTUAL-RUNTIME_init_manager = "systemd" +EFI_PROVIDER = "systemd-boot" +PACKAGECONFIG:append:pn-systemd = " cryptsetup" + +Note the last line - you won't typically see that in on-line instructions +for enabling systemd. It is important for dm-verity, since it triggers +the build and installation of components like this onto the rootfs: + + /lib/systemd/system-generators/systemd-veritysetup-generator + /lib/systemd/systemd-veritysetup + +Now build the components for the wic image: + + bitbake intel-microcode + bitbake core-image-minimal + +Assemble the image: + + ------------------------------ +build-qemu-x86_64$wic create systemd-bootdisk-dmverity -e core-image-minimal +INFO: Building wic-tools... + +[...] + +INFO: Creating image(s)... + +INFO: The new image(s) can be found here: + ./systemd-bootdisk-dmverity.wks-202304181413-sda.direct + +The following build artifacts were used to create the image(s): + BOOTIMG_DIR: /home/paul/poky/build-qemu-x86_64/tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0-r0/recipe-sysroot/usr/share + KERNEL_DIR: /home/paul/poky/build-qemu-x86_64/tmp/deploy/images/qemux86-64 + NATIVE_SYSROOT: /home/paul/poky/build-qemu-x86_64/tmp/work/core2-64-poky-linux/wic-tools/1.0-r0/recipe-sysroot-native + +INFO: The image(s) were created using OE kickstart file: + /home/paul/poky/meta-security/wic/systemd-bootdisk-dmverity.wks.in +build-qemu-x86_64$ + ------------------------------ + +The "runqemu" script defaults were acceptable for testing with only the +verity image needing to be specified, i.e. + + runqemu \ + nographic \ + qemux86-64 \ + tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64-*.rootfs.ext4.verity + +You will see the above "direct" image file and also similarly named +individual partition images. To boot on UEFI enabled physical hardware, +you need to simply write the "direct" image file to a USB stick with dd +and the partition images can largely be ignored. + +Further information on interacting with the systemd UEFI loader is here: +https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/