Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bash helper script for loading encryption password for LUKS #482

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions docs/Getting Started/NixOS/Root on ZFS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading