From: Nicolas Porcel Date: Fri, 18 May 2018 08:49:01 +0000 (+0200) Subject: Add timeout option to crypt module X-Git-Tag: 048~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c1688560adb276a2e6c7d140aa9bef9a16e07f58;p=thirdparty%2Fdracut.git Add timeout option to crypt module --- diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc index ada15e9fd..2e7f5f23a 100644 --- a/dracut.cmdline.7.asc +++ b/dracut.cmdline.7.asc @@ -311,6 +311,11 @@ crypto LUKS **rd.luks.crypttab=0**:: do not check, if LUKS partition is in _/etc/crypttab_ +**rd.luks.timeout=**____:: + 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=**____:____:____:: diff --git a/modules.d/90crypt/cryptroot-ask.sh b/modules.d/90crypt/cryptroot-ask.sh index 9f635eb30..5d63d6871 100755 --- a/modules.d/90crypt/cryptroot-ask.sh +++ b/modules.d/90crypt/cryptroot-ask.sh @@ -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