From b7d2111215f840f09985297d193fbc020850df55 Mon Sep 17 00:00:00 2001 From: Maria <105451387+mariaa144@users.noreply.github.com> Date: Fri, 15 Dec 2023 19:43:34 -0500 Subject: [PATCH] Add bash helper script for loading encryption password for LUKS I thought it would be nice if there was some check to make sure the password is correct because getting it wrong can be a real pain. --- docs/Getting Started/NixOS/Root on ZFS.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/Getting Started/NixOS/Root on ZFS.rst b/docs/Getting Started/NixOS/Root on ZFS.rst index fbdf8efb6..30640f006 100644 --- a/docs/Getting Started/NixOS/Root on ZFS.rst +++ b/docs/Getting Started/NixOS/Root on ZFS.rst @@ -207,10 +207,13 @@ System Installation #. **LUKS only**: Setup encrypted LUKS container for root pool:: + # Use this short bash script to load your password in a variable. + read -p "Password: " -rs P; echo; read -p "Password (repeat): " -rs Q; echo; if [ "$P" == "$Q" ]; then YOUR_PASSWD=$P; else echo "Try again. Passwords are not the same."; fi; unset P Q + for i in ${DISK}; do # see PASSPHRASE PROCESSING section in cryptsetup(8) - printf "YOUR_PASSWD" | cryptsetup luksFormat --type luks2 "${i}"-part3 - - printf "YOUR_PASSWD" | cryptsetup luksOpen "${i}"-part3 luks-rpool-"${i##*/}"-part3 - + printf "$YOUR_PASSWD" | cryptsetup luksFormat --type luks2 "${i}"-part3 - + printf "$YOUR_PASSWD" | cryptsetup luksOpen "${i}"-part3 luks-rpool-"${i##*/}"-part3 - done #. Create boot pool