[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: timeout function in cryptsetup init script



> hello,
> 
> i'dd like to implement a timeout function into cryptdisks, an init
> script for cryptsetup.
> 
> cryptsetup is run for every entry in /etc/crypttab. It unlocks a
> encrypted partition with either a keyfile or a passphrase.
> 
> the passphrase prompt should have a timeout, as otherwise boot of
> headless machines would hang forever.
> 
> i've already implemented a simple solution with /usr/bin/timeout from
> the timeout package, but it requires the timeout package to be
> installed, and the binary is in /usr/bin. cryptsetup is run before local
> filesystems are mounted, thus both /usr and /var may not be available.
> 
> so what i really need, is a POSIX shell timeout function, that kills
> cryptsetup after X seconds if cryptsetup is not already finished. it
> mustn't depend on any binary in /usr, and it needs to allow interactive
> password typing.
> 
> i've absolutely no idea about how to implement that, thus i mailed to
> this list.

Hi Jonas,

without looking at the initscript in question... how does that sound?

] (excerpt from bash manpage, unnecessary details stripped)
] read [-ers] [-u fd] [-t timeout] [-p prompt] [-n nchars] [-d delim] [name ...]
]   One line is read from the standard input, or from the file descriptor fd
]   supplied as an argument to the -u option [...]
]   -s
]    Silent mode. If input is coming from a terminal, characters are not echoed.
]   -t timeout
]    Cause read to time out and return failure if a complete line of input
]    is not read within timeout seconds.

I don't know how cryptdisks currently obtains its passphrases from the
user, but I'd go this way.


HTH,

Jan

-- 
Jan C. Nordholz
<jckn At gmx net>

Attachment: signature.asc
Description: Digital signature


Reply to: