dracut: 90zfs: zfs-load-key: wait for key to appear for up to 10 seconds
Also reduce password retries to 3 to match i-t Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #12065 Closes #12108
This commit is contained in:
parent
9cbc2ed20f
commit
f9baf968b8
|
@ -42,16 +42,32 @@ if [ "$(zpool list -H -o feature@encryption "${BOOTFS%%/*}")" = 'active' ]; then
|
||||||
[ "$KEYSTATUS" = "unavailable" ] || exit 0
|
[ "$KEYSTATUS" = "unavailable" ] || exit 0
|
||||||
|
|
||||||
KEYLOCATION="$(zfs get -H -o value keylocation "${ENCRYPTIONROOT}")"
|
KEYLOCATION="$(zfs get -H -o value keylocation "${ENCRYPTIONROOT}")"
|
||||||
if ! [ "${KEYLOCATION}" = "prompt" ]; then
|
case "${KEYLOCATION%%://*}" in
|
||||||
if ! [ "${KEYLOCATION#http}" = "${KEYLOCATION}" ]; then
|
prompt)
|
||||||
|
for _ in 1 2 3; do
|
||||||
|
systemd-ask-password "Encrypted ZFS password for ${BOOTFS}" --no-tty | zfs load-key "${ENCRYPTIONROOT}" && break
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
http*)
|
||||||
systemctl start network-online.target
|
systemctl start network-online.target
|
||||||
fi
|
zfs load-key "${ENCRYPTIONROOT}"
|
||||||
zfs load-key "${ENCRYPTIONROOT}"
|
;;
|
||||||
else
|
file)
|
||||||
# decrypt them
|
KEYFILE="${KEYLOCATION#file://}"
|
||||||
for _ in 1 2 3 4 5; do
|
[ -r "${KEYFILE}" ] || udevadm settle
|
||||||
systemd-ask-password "Encrypted ZFS password for ${BOOTFS}" --no-tty | zfs load-key "${ENCRYPTIONROOT}" && break
|
[ -r "${KEYFILE}" ] || {
|
||||||
done
|
info "Waiting for key ${KEYFILE} for ${ENCRYPTIONROOT}..."
|
||||||
fi
|
for _ in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
|
||||||
|
sleep 0.5s
|
||||||
|
[ -r "${KEYFILE}" ] && break
|
||||||
|
done
|
||||||
|
}
|
||||||
|
[ -r "${KEYFILE}" ] || warn "Key ${KEYFILE} for ${ENCRYPTIONROOT} hasn't appeared. Trying anyway."
|
||||||
|
zfs load-key "${ENCRYPTIONROOT}"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
zfs load-key "${ENCRYPTIONROOT}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue