From: Josselin Poiret via Bug reports for GNU Guix <bug-guix@gnu.org>
To: Mathieu Othacehe <othacehe@gnu.org>, Dan Finlay <dan@danfinlay.com>
Cc: Josselin Poiret <dev@jpoiret.xyz>, 57983@debbugs.gnu.org
Subject: bug#57983: [PATCH 1/4] installer: Move <secret> to utils and use it for crypt passwords.
Date: Thu, 22 Sep 2022 15:12:44 +0200 [thread overview]
Message-ID: <136dd86c030223934f2cadfc47c57bb2949ccfbd.1663852053.git.dev@jpoiret.xyz> (raw)
In-Reply-To: <cover.1663852053.git.dev@jpoiret.xyz>
* gnu/installer/user.scm (<secret>, secret?, make-secret, secret-content): Move
to utils.scm.
* gnu/installer/utils.scm (<secret>, secret?, make-secret, secret-content):
Moved from user.scm.
* gnu/installer/newt/partition.scm (prompt-luks-passwords): Make password a
<secret>.
* gnu/installer/parted.scm (luks-format-and-open): Unwrap secret.
---
gnu/installer/newt/partition.scm | 2 +-
gnu/installer/parted.scm | 4 ++--
gnu/installer/user.scm | 18 ++----------------
gnu/installer/utils.scm | 19 ++++++++++++++++++-
4 files changed, 23 insertions(+), 20 deletions(-)
diff --git a/gnu/installer/newt/partition.scm b/gnu/installer/newt/partition.scm
index e7a97810ac..eda34e0461 100644
--- a/gnu/installer/newt/partition.scm
+++ b/gnu/installer/newt/partition.scm
@@ -188,7 +188,7 @@ (define (prompt-luks-passwords user-partitions)
(if (string=? password confirmation)
(user-partition
(inherit user-part)
- (crypt-password password))
+ (crypt-password (make-secret password)))
(begin
(run-error-page
(G_ "Password mismatch, please try again.")
diff --git a/gnu/installer/parted.scm b/gnu/installer/parted.scm
index 84fdbe24fb..51ba2bebd6 100644
--- a/gnu/installer/parted.scm
+++ b/gnu/installer/parted.scm
@@ -148,7 +148,7 @@ (define-record-type* <user-partition>
(default #f))
(crypt-label user-partition-crypt-label
(default #f))
- (crypt-password user-partition-crypt-password
+ (crypt-password user-partition-crypt-password ; <secret>
(default #f))
(fs-type user-partition-fs-type
(default 'ext4))
@@ -1183,7 +1183,7 @@ (define (luks-format-and-open user-partition)
"Format and open the encrypted partition pointed by USER-PARTITION."
(let* ((file-name (user-partition-file-name user-partition))
(label (user-partition-crypt-label user-partition))
- (password (user-partition-crypt-password user-partition)))
+ (password (secret-content (user-partition-crypt-password user-partition))))
(call-with-luks-key-file
password
(lambda (key-file)
diff --git a/gnu/installer/user.scm b/gnu/installer/user.scm
index 224040530c..2866e4520f 100644
--- a/gnu/installer/user.scm
+++ b/gnu/installer/user.scm
@@ -17,17 +17,13 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu installer user)
+ #:use-module (gnu installer utils)
#:use-module (guix records)
#:use-module (guix read-print)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-9)
#:use-module (srfi srfi-9 gnu)
- #:export (<secret>
- secret?
- make-secret
- secret-content
-
- <user>
+ #:export (<user>
user
make-user
user-name
@@ -38,16 +34,6 @@ (define-module (gnu installer user)
users->configuration))
-(define-record-type <secret>
- (make-secret content)
- secret?
- (content secret-content))
-
-(set-record-type-printer!
- <secret>
- (lambda (secret port)
- (format port "<secret>")))
-
(define-record-type* <user>
user make-user
user?
diff --git a/gnu/installer/utils.scm b/gnu/installer/utils.scm
index fb62fb8896..5fd2e2d425 100644
--- a/gnu/installer/utils.scm
+++ b/gnu/installer/utils.scm
@@ -23,6 +23,8 @@ (define-module (gnu installer utils)
#:use-module (guix build utils)
#:use-module (guix i18n)
#:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-9)
+ #:use-module (srfi srfi-9 gnu)
#:use-module (srfi srfi-19)
#:use-module (srfi srfi-34)
#:use-module (srfi srfi-35)
@@ -33,7 +35,12 @@ (define-module (gnu installer utils)
#:use-module (ice-9 regex)
#:use-module (ice-9 format)
#:use-module (ice-9 textual-ports)
- #:export (read-lines
+ #:export (<secret>
+ secret?
+ make-secret
+ secret-content
+
+ read-lines
read-all
nearest-exact-integer
read-percentage
@@ -58,6 +65,16 @@ (define-module (gnu installer utils)
with-silent-shepherd))
+(define-record-type <secret>
+ (make-secret content)
+ secret?
+ (content secret-content))
+
+(set-record-type-printer!
+ <secret>
+ (lambda (secret port)
+ (format port "<secret>")))
+
(define* (read-lines #:optional (port (current-input-port)))
"Read lines from PORT and return them as a list."
(let loop ((line (read-line port))
--
2.37.2
next prev parent reply other threads:[~2022-09-22 13:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-21 15:36 bug#57983: Error installing on a Framework Laptop Dan Finlay
2022-09-22 6:50 ` Mathieu Othacehe
2022-09-22 13:12 ` bug#57983: [PATCH 0/4] Fix luks devices not being re-opened when restarting the final step Josselin Poiret via Bug reports for GNU Guix
2022-09-22 13:12 ` Josselin Poiret via Bug reports for GNU Guix [this message]
2022-09-22 13:12 ` bug#57983: [PATCH 2/4] installer: Return partitions with crypt password as step result Josselin Poiret via Bug reports for GNU Guix
2022-09-22 13:12 ` bug#57983: [PATCH 3/4] installer: Ensure luks devices are open when mounting partitions Josselin Poiret via Bug reports for GNU Guix
2022-09-22 13:12 ` bug#57983: [PATCH 4/4] installer: Exit console-services page with abort-to-prompt Josselin Poiret via Bug reports for GNU Guix
2022-09-22 14:34 ` bug#57983: Error installing on a Framework Laptop Mathieu Othacehe
2022-09-22 17:17 ` Dan Finlay
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=136dd86c030223934f2cadfc47c57bb2949ccfbd.1663852053.git.dev@jpoiret.xyz \
--to=bug-guix@gnu.org \
--cc=57983@debbugs.gnu.org \
--cc=dan@danfinlay.com \
--cc=dev@jpoiret.xyz \
--cc=othacehe@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.