From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id +NcsIVZUymSeNwEASxT56A (envelope-from ) for ; Wed, 02 Aug 2023 15:04:22 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id AIUJIVZUymQaaAEA9RJhRA (envelope-from ) for ; Wed, 02 Aug 2023 15:04:22 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 12BAF498CE for ; Wed, 2 Aug 2023 15:04:22 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=wolfsden.cz header.s=mail header.b=xozZ9ZRW; dkim=fail ("headers rsa verify failed") header.d=wolfsden.cz header.s=mail header.b=INBcvWng; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=wolfsden.cz (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1690981462; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=7V/4XA59GNQ7LW0qmeBH4Ogu+Gqe6GqcH0MX1geZNdE=; b=fug+X5bv3ygW5EDj5j5F4V9pLBdyzm+WX4p/QUfOtoANnSr8fy84jjcCn7gzjdd45x0SEL X32l7V0hRr37zBVWlWSURwK2EACmSP7ij95QMvkTCT+XdrSrE95IQD/o557jeLBYqjDjHs fdC75viJNo0RRQQ7D4KgBpIpfpYPpAAKujzAADzLeDqooZpXbGH2JCx8oO9V9bzyKdXUF/ rl/FJbr0N1DVLUGy34goj5ybgu5KS8KFbf9uUjBW9/p3KQRZLXPpMPT3dNX6UrD8Jt27K6 Ns8ddpbv9hq9Z46s/b8e5nO17ubPI0m+yMNUH9aVTskkRAdjQDkWBpuTICSkjQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=wolfsden.cz header.s=mail header.b=xozZ9ZRW; dkim=fail ("headers rsa verify failed") header.d=wolfsden.cz header.s=mail header.b=INBcvWng; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=wolfsden.cz (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1690981462; a=rsa-sha256; cv=none; b=FG1xo/QRZoiaF54fzD6zkltuwuaJL1n0CXL23hQ5to67DePewWoeTND3fJbZcJLZT3jOOw DjS2yNuFP2CjN4j4If52go4iCPIoFDXf2hCp0IVO2fZR37Z7iH9sKUUJ3Yy4CWOsP/c17w DWyWApTEQGMgs/mjXivWy5tH1zv1XgQzycWOsBwVLYJhPY6r8XSHDn5u2soNDUV4dDykNJ PEym/CLozycT5+W4+HVaT6bPM8Q3kxZBREuRzNrXQEpvsmFLzFGiX/tzXXJsX9NgJ2prjG KVIg2zzmG/YVD5Kh2z9hxumJ5Rk2bByjykzz8hjDvFzcqIZVl2/jO2BhbL7pnQ== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qRBWF-0005fM-9Y; Wed, 02 Aug 2023 09:04:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qRBWE-0005ey-EU for guix-patches@gnu.org; Wed, 02 Aug 2023 09:04:02 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qRBWE-0004qZ-6b for guix-patches@gnu.org; Wed, 02 Aug 2023 09:04:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qRBWE-0004vt-2W for guix-patches@gnu.org; Wed, 02 Aug 2023 09:04:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65002] [PATCH v2 2/2] gnu: bootloader: grub: Add support for loading an additional initrd Resent-From: Tomas Volf Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 02 Aug 2023 13:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65002 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 65002@debbugs.gnu.org Cc: Tomas Volf Received: via spool by 65002-submit@debbugs.gnu.org id=B65002.169098141518916 (code B ref 65002); Wed, 02 Aug 2023 13:04:02 +0000 Received: (at 65002) by debbugs.gnu.org; 2 Aug 2023 13:03:35 +0000 Received: from localhost ([127.0.0.1]:49128 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qRBVm-0004uw-K1 for submit@debbugs.gnu.org; Wed, 02 Aug 2023 09:03:34 -0400 Received: from wolfsden.cz ([37.205.8.62]:34570) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qRBVi-0004uf-QT for 65002@debbugs.gnu.org; Wed, 02 Aug 2023 09:03:32 -0400 Received: by wolfsden.cz (Postfix, from userid 104) id 003CF269A5A; Wed, 2 Aug 2023 13:03:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1690981410; bh=H3o4VWBJFRBDCTPIn9sdJRunY6hUg3BcfyGOtH+x/B0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=xozZ9ZRWo1NeYLCK8oBGBYn+bfnkIEW3FfoySN2bnlUXlI/4Gn9o4ml+9zHaS6zoE B407apQeXawUfDDjoaU+UOoHTVJa0OKKrGtjpQr0BoGQ9erYIr1qnMA4IpS2ssZt/H +2eoSjS0jlZkS6BMG1JLlVdmcziyzjJaRQerLd7iWCHxlfybP1imepzH/Mn62hXsAy cYi+BhayzGYEpQN4CvyQfvip1Oh1GW/DVrqtAwLm5UXiHgfKaHxZsAsLYeyUmd/KsD wDDsJv/PwG93C83EpDGEBvR88PiaFpiFQPy1xT4ahEICq/RY99PasToBk8JQnbtY/v Jq5iz1iLPLnRh0+qWW71BcDak4hTx0C+IDaR/b3Kq4yG+AnXuOGD2ams4U4G5/USAm cF+oDBaBdLgFI8UozW04HQ7xDBwMBAzETVyHLZJgzvKdJet2HqBeHUM47ylOJmydQh 89xxdaHAsQl8dZGMYNkQXN6ccxoO8qp/ViA64xgNfkT8tId0NWHxEVjePao2gUyDw3 7XLwbWDuVjSk7UZj1AgRDB67Og92hNDIxse05nctZxWu0XGiIgl1YXJ6FExokK6H1q rcNrLQ2v7Viti2im5r+bkdu0ZOfoXBmphfofU5ISmRAfU6w3Y148rgtf7GNIBovblx 4YYs+7Zszdmkd+EDX6JuFE2M= Received: from localhost (unknown [128.0.188.242]) by wolfsden.cz (Postfix) with ESMTPSA id 8DE9C267476; Wed, 2 Aug 2023 13:03:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1690981409; bh=H3o4VWBJFRBDCTPIn9sdJRunY6hUg3BcfyGOtH+x/B0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=INBcvWng31lJLuilz/eRkn4Xd0o4fG2qo+VjVFVVWaaO9wEXeiKsyq/1zolUKjm6B f66u0fCPufWIWJoIYHRtBvxxg5qss5+seqbqw2/4sLBjYJtRnjPZdgGBGtjqad/Qjv +w2/+cMerYnGrF20Fk4Z9pjVi55Ume33e3pam+nP9eennaHrP0rnFwQDonbWZ5blyI 1AubyZsiSOxdVdoxOSA3KxyqYhlqiUPUd0yQh67Ovh4lssS55QkR/x6LZefNFJkBPS s1vKKCfJI1pvxDVSmRpu2+Ao51uu5tZTsm5XOMllvYXzJTJ0b+1bdVwLIpUuTD7pjk c61tbVjYCFm6jgFyElay1Sp41iq2linAYYkJtdFmc9ExeAA8mXgt7UdPa5TuJ4hp6x XEIdAVSn22Sb7EHcU29Cy2UK1DpKvSxTk2GG3Of/Mt6u5Df6X6Mr8xB01sxxFE0lMp ly/EkYt1YeUIf2j4sVEgzYLJyBnxKVq7caEDnOvAbg590+4Ugbi3OZA0GsYe4TRUcI hL6yG6T9tFa3iSmCOEhKtdi+Dq5c/0wOQhcLBN4CaMtE+Dg5Kef1SMrYq6eowckwxz U6sc8gA2tzOFEp/O5C89FYqFDuh2WJFoeDUoOwJ9skiefwfSHMmlezZyLgYzRlmYzd AgoH6Pdir7UOzJXGasGZLecY= Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 14f588b7; Wed, 2 Aug 2023 13:03:28 +0000 (UTC) From: Tomas Volf Date: Wed, 2 Aug 2023 15:02:45 +0200 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: <058b41c5060e1811048fe44c20278c64fdfc3ece.1690981365.git.wolf@wolfsden.cz> References: <058b41c5060e1811048fe44c20278c64fdfc3ece.1690981365.git.wolf@wolfsden.cz> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -2.05 X-Spam-Score: -2.05 X-Migadu-Queue-Id: 12BAF498CE X-Migadu-Scanner: mx1.migadu.com X-TUID: vhRMdRywCh+U In order to be able to provide decryption keys for the LUKS device, they need to be available in the initial ram disk. However they cannot be stored inside the usual initrd, since it is stored in the store and being a world-readable (as files in the store are) is not a desired property for a initrd containing decryption keys. This commit adds an option to load additional initrd during the boot, one that is not stored inside the store and therefore can contain secrets. Since only grub supports encrypted /boot, only grub is modified to use the extra-initrd. There is no use case for the other bootloaders. * doc/guix.texi (Bootloader Configuration): Describe the new extra-initrd field. * gnu/bootloader.scm: Add extra-initrd field to bootloader-configuration * gnu/bootloader/grub.scm: Use the new extra-initrd field --- doc/guix.texi | 20 ++++++++++++++++++++ gnu/bootloader.scm | 6 +++++- gnu/bootloader/grub.scm | 6 ++++-- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index a857654191..c63f28786e 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -40078,6 +40078,26 @@ Bootloader Configuration @code{u-boot} bootloader, where the device tree has already been loaded in RAM, it can be handy to disable the option by setting it to @code{#f}. + +@item @code{extra-initrd} (default: @code{#f}) +Path to an additional initrd to load. Should not point to a file in the +store. Typical use case is making keys to unlock LUKS device available +during the boot process. For any use case not involving secrets, you +should use regular initrd (@pxref{operating-system Reference, +@code{initrd}}) instead. + +Suitable image can be created for example like this: + +@example +echo /key-file.bin | cpio -oH newc >/key-file.cpio +chmod 0000 /key-file.cpio +@end example + +Be careful when using this option, since pointing to a file that is not +readable by the grub while booting will cause the boot to fail and +require a manual edit of the initrd line in the grub menu. + +Currently only supported by grub. @end table @end deftp diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index 2c36d8c6cf..8cebcf8965 100644 --- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm @@ -77,6 +77,7 @@ (define-module (gnu bootloader) bootloader-configuration-serial-unit bootloader-configuration-serial-speed bootloader-configuration-device-tree-support? + bootloader-configuration-extra-initrd %bootloaders lookup-bootloader-by-name @@ -279,7 +280,10 @@ (define-record-type* (serial-speed bootloader-configuration-serial-speed (default #f)) ;integer | #f (device-tree-support? bootloader-configuration-device-tree-support? - (default #t))) ;boolean + (default #t)) ;boolean + (extra-initrd bootloader-configuration-extra-initrd + (default #f)) ;string | #f + ) (define-deprecated (bootloader-configuration-target config) bootloader-configuration-targets diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index 5f3fcd7074..49cb3f7725 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -386,7 +386,8 @@ (define* (make-grub-configuration grub config entries store-directory-prefix)) (initrd (normalize-file (menu-entry-initrd entry) device-mount-point - store-directory-prefix))) + store-directory-prefix)) + (extra-initrd (bootloader-configuration-extra-initrd config))) ;; Here DEVICE is the store and DEVICE-MOUNT-POINT is its mount point. ;; Use the right file names for LINUX and INITRD in case ;; DEVICE-MOUNT-POINT is not "/", meaning that the store is on a @@ -397,11 +398,12 @@ (define* (make-grub-configuration grub config entries #~(format port "menuentry ~s { ~a linux ~a ~a - initrd ~a + initrd ~a ~a }~%" #$label #$(grub-root-search device linux) #$linux (string-join (list #$@arguments)) + (or #$extra-initrd "") #$initrd))) (multiboot-kernel (let* ((kernel (menu-entry-multiboot-kernel entry)) -- 2.41.0