[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#53063] [PATCH v2 wip-harden-installer 17/18] installer: Turn passwo
From: |
Josselin Poiret |
Subject: |
[bug#53063] [PATCH v2 wip-harden-installer 17/18] installer: Turn passwords into opaque records. |
Date: |
Sat, 15 Jan 2022 14:50:10 +0100 |
* gnu/installer/user.scm (<secret>, secret?, make-secret,
secret-content): Add opaque <secret> record that boxes its contents,
with a custom printer that doesn't display anything.
* gnu/installer/newt/user.scm (run-user-add-page, run-user-page): Box
it.
* gnu/installer/final.scm (create-user-database): Unbox it.
---
gnu/installer/final.scm | 5 +++--
gnu/installer/newt/user.scm | 6 +++---
gnu/installer/user.scm | 18 +++++++++++++++++-
3 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/gnu/installer/final.scm b/gnu/installer/final.scm
index 63e5073ff4..2087536502 100644
--- a/gnu/installer/final.scm
+++ b/gnu/installer/final.scm
@@ -85,8 +85,9 @@ (define root?
(uid (if root? 0 #f))
(home-directory
(user-home-directory user))
- (password (crypt (user-password user)
- (salt)))
+ (password (crypt
+ (secret-content (user-password user))
+ (salt)))
;; We need a string here, not a file-like, hence
;; this choice.
diff --git a/gnu/installer/newt/user.scm b/gnu/installer/newt/user.scm
index 97141cfe64..7c1cc2249d 100644
--- a/gnu/installer/newt/user.scm
+++ b/gnu/installer/newt/user.scm
@@ -143,7 +143,7 @@ (define (pad-label label)
(name name)
(real-name real-name)
(home-directory home-directory)
- (password password))
+ (password (make-secret password)))
(run-user-add-page #:name name
#:real-name real-name
#:home-directory
@@ -266,7 +266,7 @@ (define (run users)
(map (lambda (name real-name home password)
(user (name name) (real-name real-name)
(home-directory home)
- (password password)))
+ (password (make-secret password))))
names real-names homes passwords))))))
(lambda ()
(destroy-form-and-pop form))))))
@@ -274,5 +274,5 @@ (define (run users)
;; Add a "root" user simply to convey the root password.
(cons (user (name "root")
(home-directory "/root")
- (password (run-root-password-page)))
+ (password (make-secret (run-root-password-page))))
(run '())))
diff --git a/gnu/installer/user.scm b/gnu/installer/user.scm
index 4e701e64ce..13114e9832 100644
--- a/gnu/installer/user.scm
+++ b/gnu/installer/user.scm
@@ -19,7 +19,14 @@
(define-module (gnu installer user)
#:use-module (guix records)
#:use-module (srfi srfi-1)
- #:export (<user>
+ #:use-module (srfi srfi-9)
+ #:use-module (srfi srfi-9 gnu)
+ #:export (<secret>
+ secret?
+ make-secret
+ secret-content
+
+ <user>
user
make-user
user-name
@@ -30,6 +37,15 @@ (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?
--
2.34.0
- [bug#53063] [PATCH v2 wip-harden-installer 02/18] installer: Generalize logging facility., (continued)
- [bug#53063] [PATCH v2 wip-harden-installer 02/18] installer: Generalize logging facility., Josselin Poiret, 2022/01/15
- [bug#53063] [PATCH v2 wip-harden-installer 07/18] installer: Capture external commands output., Josselin Poiret, 2022/01/15
- [bug#53063] [PATCH v2 wip-harden-installer 05/18] installer: Keep PATH inside the install container., Josselin Poiret, 2022/01/15
- [bug#53063] [PATCH v2 wip-harden-installer 10/18] installer: Raise condition when mklabel fails., Josselin Poiret, 2022/01/15
- [bug#53063] [PATCH v2 wip-harden-installer 11/18] installer: Fix run-file-textbox-page when edit-button is #f., Josselin Poiret, 2022/01/15
- [bug#53063] [PATCH v2 wip-harden-installer 14/18] installer: Use named prompt to abort or break installer steps., Josselin Poiret, 2022/01/15
- [bug#53063] [PATCH v2 wip-harden-installer 15/18] installer: Add error page when running external commands., Josselin Poiret, 2022/01/15
- [bug#53063] [PATCH v2 wip-harden-installer 18/18] installer: Make dump archive creation optional and selective., Josselin Poiret, 2022/01/15
- [bug#53063] [PATCH v2 wip-harden-installer 01/18] installer: Use define instead of let at top-level., Josselin Poiret, 2022/01/15
- [bug#53063] [PATCH v2 wip-harden-installer 16/18] installer: Use dynamic-wind to setup installer., Josselin Poiret, 2022/01/15
- [bug#53063] [PATCH v2 wip-harden-installer 17/18] installer: Turn passwords into opaque records.,
Josselin Poiret <=
- [bug#53063] [PATCH wip-harden-installer 00/14] General improvements to the installer, Mathieu Othacehe, 2022/01/17
- [bug#53063] [PATCH] installer: Use system-wide guix for system init., Josselin Poiret, 2022/01/31
[bug#53063] [PATCH wip-harden-installer 10/14] installer: Raise condition when mklabel fails., Josselin Poiret, 2022/01/06
[bug#53063] [PATCH wip-harden-installer 09/14] installer: Use the command capturing facility for guix init., Josselin Poiret, 2022/01/06
[bug#53063] [PATCH wip-harden-installer 12/14] installer: Replace run-command by invoke in newt/page.scm., Josselin Poiret, 2022/01/06
[bug#53063] [PATCH wip-harden-installer 11/14] installer: Fix run-file-textbox-page when edit-button is #f., Josselin Poiret, 2022/01/06
[bug#53063] [PATCH wip-harden-installer 14/14] installer: Add confirmation page when running external commands., Josselin Poiret, 2022/01/06
[bug#53063] [PATCH wip-harden-installer 13/14] installer: Use named prompt to abort or break installer steps., Josselin Poiret, 2022/01/06