From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 75D539D11A for ; Thu, 23 Nov 2023 10:46:04 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 5057A35351 for ; Thu, 23 Nov 2023 10:45:34 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Thu, 23 Nov 2023 10:45:33 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 2E9E84314A for ; Thu, 23 Nov 2023 10:45:33 +0100 (CET) From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= To: pve-devel@lists.proxmox.com Date: Thu, 23 Nov 2023 10:45:23 +0100 Message-Id: <20231123094523.280775-1-f.gruenbichler@proxmox.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.065 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox.com, mok.pub] Subject: [pve-devel] [PATCH docs] secure boot: add subsection for DKMS/MOK X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Nov 2023 09:46:04 -0000 similar, but a bit more beginner friendly compared to the wiki article. Signed-off-by: Fabian Grünbichler --- system-booting.adoc | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/system-booting.adoc b/system-booting.adoc index 0cc9c13..511eddf 100644 --- a/system-booting.adoc +++ b/system-booting.adoc @@ -492,3 +492,46 @@ disk as a boot option in the UEFI firmware setup utility and run TIP: To enroll custom keys, see the accompanying https://pve.proxmox.com/wiki/Secure_Boot_Setup#Setup_instructions_for_db_key_variant[Secure Boot wiki page]. + +Using DKMS/third party modules with Secure Boot +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +On systems with Secure Boot enabled, the kernel will refuse to load modules +which are not signed by a trusted key. The default set of modules shipped with +the kernel packages is signed with an ephemeral key embedded in the kernel +image which is trusted by that specific version of the kernel image. + +In order to load other modules, such as those built with DKMS or manually, they +need to be signed with a key trusted by the Secure Boot stack. The easiest way +to achieve this is to enroll them as Machine Owner Key (`MOK`) with `mokutil`. + +The `dkms` tool will automatically generate a keypair and certificate in +`/var/lib/dkms/mok.key` and `/var/lib/dkms/mok.pub` and use it for signing +the kernel modules it builds and installs. + +You can view the certificate contents with + +---- +# openssl x509 -in /var/lib/dkms/mok.pub -noout -text +---- + +and enroll it on your system using the following command: + +---- +# mokutil --import /var/lib/dkms/mok.pub +input password: +input password again: +---- + +The `mokutil` command will ask for a (temporary) password twice, this password +needs to be entered one more time in the next step of the process! Rebooting +the system should automatically boot into the `MOKManager` EFI binary, which +allows you to verify the key/certificate and confirm the enrollment using the +password selected when starting the enrollment using `mokutil`. Afterwards, the +kernel should allow loading modules built with DKMS (which are signed with the +enrolled `MOK`). The `MOK` can also be used to sign custom EFI binaries and +kernel images if desired. + +The same procedure can also be used for custom/third-party modules not managed +with DKMS, but the key/certificate generation and signing steps need to be done +manually in that case. -- 2.39.2