Browse Source

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 ].
hfreyther/master-next
Holger Hans Peter Freyther 9 years ago
committed by Harald Welte
parent
commit
b92f71e94b
  1. 4
      recipes-fixes/dropbear/files/init

4
recipes-fixes/dropbear/files/init

@ -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…
Cancel
Save