dropbear: Make sure the dropbear key is generated on first boot
The previous patch made sure a truncated key would be re-generated but it broke the case that there is no key at all. This code is handling both cases now. Use quotes as code outside this method is using them too. Use the -a and not the && operator to work with the busybox version of [ and ].
This commit is contained in:
parent
be7111d6c6
commit
b92f71e94b
|
@ -58,13 +58,13 @@ gen_keys() {
|
|||
for t in $DROPBEAR_KEYTYPES; do
|
||||
case $t in
|
||||
rsa)
|
||||
if [ ! -s $DROPBEAR_RSAKEY ]; then
|
||||
if [ -f "$DROPBEAR_RSAKEY" -a ! -s "$DROPBEAR_RSAKEY" ]; then
|
||||
rm $DROPBEAR_RSAKEY
|
||||
fi
|
||||
test -f $DROPBEAR_RSAKEY || dropbearkey -t rsa -f $DROPBEAR_RSAKEY
|
||||
;;
|
||||
dsa)
|
||||
if [ ! -s $DROPBEAR_DSSKEY ]; then
|
||||
if [ -f "$DROPBEAR_DSSKEY" -a ! -s "$DROPBEAR_DSSKEY" ]; then
|
||||
rm $DROPBEAR_DSSKEY
|
||||
fi
|
||||
test -f $DROPBEAR_DSSKEY || dropbearkey -t dss -f $DROPBEAR_DSSKEY
|
||||
|
|
Loading…
Reference in New Issue