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

Request ZFS/LUKS passwords via Plymouth #88789

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
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
Prev Previous commit
Next Next commit
nixos/zfs: use stage-1 hooks for requesting passphrases
  • Loading branch information
puckipedia committed May 24, 2020
commit ef0867ec6503a8dd580d84ba276f3db9fe220278
25 changes: 23 additions & 2 deletions nixos/modules/tasks/filesystems/zfs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,29 @@ in
fi
poolImported "${pool}" || poolImport "${pool}" # Try one last time, e.g. to import a degraded pool.
fi
${lib.optionalString cfgZfs.requestEncryptionCredentials ''
zfs load-key -a
${optionalString cfgZfs.requestEncryptionCredentials ''
zfs list -r -H -o encryptionroot,keystatus,keylocation "${pool}" | sort | uniq | while IFS=" " read encryptionroot keystatus keylocation; do
if [ "$keystatus" != "unavailable" -o "$keylocation" == "none" ]; then
continue
fi

if [ "$keylocation" != "prompt" ]; then
"${packages.zfsUser}/bin/zfs" load-key "$encryptionroot" || die "Failed to load key for $encryptionroot"
continue
fi

success=
for i in $(seq 1 3); do
if askPassword "Enter key for $encryptionroot: " | zfs load-key "$encryptionroot"; then
success=1
break
fi
done

if [ -z "$success" ]; then
die "Failed to load key for $encryptionroot"
fi
done
''}
'') rootPools));
};
Expand Down