From 04ea9b0f24fc29edb9646b9a6aaea651ec109e6d Mon Sep 17 00:00:00 2001 From: Illia Chub Date: Tue, 20 Apr 2021 16:09:38 +0300 Subject: [PATCH 1/2] Added salt to the password --- nixos-infect | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos-infect b/nixos-infect index 39742a5..a90a9eb 100755 --- a/nixos-infect +++ b/nixos-infect @@ -118,7 +118,7 @@ makeConf() { users.users = { "$LUSER" = { isNormalUser = true; - hashedPassword = "$HASHED_PASSWORD"; + hashedPassword = "\$6\$$SALT\$$HASHED_PASSWORD"; }; }; } From 5e7fd4869ba9b549bfa03d6a97badad2872c0631 Mon Sep 17 00:00:00 2001 From: Illia Chub Date: Wed, 21 Apr 2021 12:53:35 +0300 Subject: [PATCH 2/2] Moved hash generation engine to the backend --- nixos-infect | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nixos-infect b/nixos-infect index a90a9eb..d37d700 100755 --- a/nixos-infect +++ b/nixos-infect @@ -5,6 +5,7 @@ set -e -o pipefail makeConf() { + export HASHED_PASSWORD=$( mkpasswd -m sha-512 "$PASSWORD" ) # Skip everything if main config already present [[ -e /etc/nixos/configuration.nix ]] && return 0 # NB <<"EOF" quotes / $ ` in heredocs, <