From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id CBe9MtNoLGPlmgAAbAwnHQ (envelope-from ) for ; Thu, 22 Sep 2022 15:53:23 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id uFO8MtNoLGMjhQEA9RJhRA (envelope-from ) for ; Thu, 22 Sep 2022 15:53:23 +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 8E59647BE3 for ; Thu, 22 Sep 2022 15:53:23 +0200 (CEST) Received: from localhost ([::1]:45250 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obMdm-0007en-Gu for larch@yhetil.org; Thu, 22 Sep 2022 09:53:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60428) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obM1k-0004ea-9f for bug-guix@gnu.org; Thu, 22 Sep 2022 09:14:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37595) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1obM1j-0001Ek-B8 for bug-guix@gnu.org; Thu, 22 Sep 2022 09:14:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1obM1j-0003zW-4k for bug-guix@gnu.org; Thu, 22 Sep 2022 09:14:03 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#57983: [PATCH 3/4] installer: Ensure luks devices are open when mounting partitions. Resent-From: Josselin Poiret Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Thu, 22 Sep 2022 13:14:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57983 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Mathieu Othacehe , Dan Finlay Cc: Josselin Poiret , 57983@debbugs.gnu.org Received: via spool by 57983-submit@debbugs.gnu.org id=B57983.166385241015265 (code B ref 57983); Thu, 22 Sep 2022 13:14:03 +0000 Received: (at 57983) by debbugs.gnu.org; 22 Sep 2022 13:13:30 +0000 Received: from localhost ([127.0.0.1]:36667 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1obM1B-0003y3-Hn for submit@debbugs.gnu.org; Thu, 22 Sep 2022 09:13:29 -0400 Received: from jpoiret.xyz ([206.189.101.64]:47320) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1obM17-0003xJ-VJ for 57983@debbugs.gnu.org; Thu, 22 Sep 2022 09:13:27 -0400 Received: from authenticated-user (jpoiret.xyz [206.189.101.64]) by jpoiret.xyz (Postfix) with ESMTPA id 0972E185312; Thu, 22 Sep 2022 13:13:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpoiret.xyz; s=dkim; t=1663852405; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=H7VsofWqHl+6JRTsvFRj4MfMCKLZInyJLLZuVp5IbTo=; b=A7RjhVOpZKobXBkUJ5uWDzR9rUXvu7y0k4vnpKyiwAwjLqbEpoxd/zOjXERsV/TkHmZRKw iwt2bBPDc+lWNSJzaCgaEUSGPjz35NTk9eGGPm0NIjwunKJO9qB/gIvWVomfUOGV4QQYy4 JahQ6+MqraJRVbYRy5tpDHsduQ89miScqXg+bUGDjoUv9LCEJeF2nVCzAHrH7/Q0VNIwsl xVkCMTPXNw9kuA8eJZNgA8wFzrfS74iLEvW+nDH8vnV/AWj03To5Ie/PEfjhAYQlaITnP6 i93umvwY/uAV6pdn4/Hphw3ZDhuakSgY8o0d8NVfW2xPUAe+fiA3S+DG1KHY3A== Date: Thu, 22 Sep 2022 15:12:46 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spamd-Bar: / X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" Reply-to: Josselin Poiret From: Josselin Poiret via Bug reports for GNU Guix X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1663854803; h=from:from:sender:sender:reply-to: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=H7VsofWqHl+6JRTsvFRj4MfMCKLZInyJLLZuVp5IbTo=; b=mbtaPBs62b0prLLH5i6xNFzm5a4Z2KqtiL4fPaCTqPlsyR+BKem9ZBArLJm68Os5sTCNGm Fz5VtBhyAvrdvQkwqBJD95Q+cnpZVbsXsWaRCyPX7JiGtzhsKPhOdWN6OZDPX+4792V2qN o4xgCMBwyjpmWHwdODOW2a8F9PoimBMbZfG4lGVmU0EcYSiwkLKujkmNyhknA+gnJomJWM bEvfi7gjp1oCvm1yxQXVwQLLKIi+McyyK3L7YaF4G1V/HWB+ybKnCAl9/n1w0WThv0tksu 1opOnsH5KZHzojXPCEkxUhipAnoZvlNNrrqnfSSEUt57qyYKKLp3T581R4gjRA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1663854803; a=rsa-sha256; cv=none; b=IxP78dayM/xt1T8VstXNLdbRZDnpTj5NdrXebd/vlRzdxPuS3Uj0CeCHPoSEY/Wa5ETOII XunHYcNLudq34Lx7bon5YyHnkhQlHbeqSlmBAZZcshFE/egJ7h8aQXaNytXGOm4EjY2ab1 LKrkbrmJ5UW9tbUXGBsU9Ky9/jAFPfKs9vie5SB8b5KTcYl2BT3jTRIL4LVharVUE2wtZk 1W4aZbrxsl8iGXFBf9GNwvIfHRDbF0e0Fz1bIjFFRA1ncaIwe7sRyVQ5hLL+rnQEYwn9OI Je6M3qivKG9IX4wTr2zggk8a0m7sQTTofO8edIyGWF6WEZtuyJT7Fh06pBRPhg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=jpoiret.xyz header.s=dkim header.b=A7RjhVOp; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.85 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=jpoiret.xyz header.s=dkim header.b=A7RjhVOp; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 8E59647BE3 X-Spam-Score: -2.85 X-Migadu-Scanner: scn1.migadu.com X-TUID: Qf2G3E9R7K+o * gnu/installer/parted.scm (luks-ensure-open): New procedure. (unmount-user-partitions): Ensure luks devices are open. --- gnu/installer/parted.scm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gnu/installer/parted.scm b/gnu/installer/parted.scm index 51ba2bebd6..fcc936a391 100644 --- a/gnu/installer/parted.scm +++ b/gnu/installer/parted.scm @@ -1194,6 +1194,20 @@ (define (luks-format-and-open user-partition) ((run-command-in-installer) "cryptsetup" "open" "--type" "luks" "--key-file" key-file file-name label))))) +(define (luks-ensure-open user-partition) + "Ensure partition pointed by USER-PARTITION is opened." + (unless (file-exists? (user-partition-upper-file-name user-partition)) + (let* ((file-name (user-partition-file-name user-partition)) + (label (user-partition-crypt-label user-partition)) + (password (secret-content (user-partition-crypt-password user-partition)))) + (call-with-luks-key-file + password + (lambda (key-file) + (installer-log-line "opening LUKS entry ~s at ~s" + label file-name) + ((run-command-in-installer) "cryptsetup" "open" "--type" "luks" + "--key-file" key-file file-name label)))))) + (define (luks-close user-partition) "Close the encrypted partition pointed by USER-PARTITION." (let ((label (user-partition-crypt-label user-partition))) @@ -1278,6 +1292,8 @@ (define (mount-user-partitions user-partitions) (user-fs-type->mount-type fs-type)) (file-name (user-partition-upper-file-name user-partition))) + (when crypt-label + (luks-ensure-open user-partition)) (mkdir-p target) (installer-log-line "mounting ~s on ~s" file-name target) (mount file-name target mount-type))) -- 2.37.2