Add timeout option to crypt module

master
Nicolas Porcel 2018-05-18 10:49:01 +02:00 committed by Harald Hoyer
parent 4cdee66c8e
commit c1688560ad
2 changed files with 9 additions and 1 deletions

View File

@ -311,6 +311,11 @@ crypto LUKS
**rd.luks.crypttab=0**::
do not check, if LUKS partition is in _/etc/crypttab_

**rd.luks.timeout=**__<seconds>__::
specify how long dracut should wait when waiting for the user to enter the
password. This avoid blocking the boot if no password is entered. It does
not apply to luks key. The default is '0', which means 'forever'.

crypto LUKS - key on removable device support
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**rd.luks.key=**__<keypath>__:__<keydev>__:__<luksdev>__::

View File

@ -165,12 +165,15 @@ fi

if [ $ask_passphrase -ne 0 ]; then
luks_open="$(command -v cryptsetup) $cryptsetupopts luksOpen"
_timeout=$(getargs "rd.luks.timeout")
_timeout=${_timeout:-0}
ask_for_password --ply-tries 5 \
--ply-cmd "$luks_open -T1 $device $luksname" \
--ply-prompt "Password ($device)" \
--tty-tries 1 \
--tty-cmd "$luks_open -T5 $device $luksname"
--tty-cmd "$luks_open -T5 -t $_timeout $device $luksname"
unset luks_open
unset _timeout
fi

unset device luksname luksfile