Imitate dropbear init.d-script and make sure we
don't end up with corrupt keys.
This can happen if we use a caching filesystem,
like 'ubifs', and the DUT is powered off during
boot-up.
Signed-off-by: Markus Gothe <markus.gothe@genexis.eu>
do
# check for keys
key=/etc/ssh/ssh_host_${type}_key
+ [ -f $key ] && {
+ [ -x /usr/bin/ssh-keygen ] && {
+ if ! /usr/bin/ssh-keygen -y -f $key > /dev/null 2>&1; then
+ rm -rf $key
+ fi
+ }
+ }
[ ! -f $key ] && {
# generate missing keys
[ -x /usr/bin/ssh-keygen ] && {