The return of gen_keys() never threw an error, so last block was useless
so far. Script worked because gen_key() exited instead of returning.
Messages are done like in the openssh rc-once script now.
Fixes: cf0424f8ba23 ("dropbear: Refactor rc-once and init to use KEYTYPES")
Signed-off-by: Alexander Dahl <[email protected]>
---
projectroot/etc/rc.once.d/dropbear | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/projectroot/etc/rc.once.d/dropbear
b/projectroot/etc/rc.once.d/dropbear
index 8a0440624..a8725616a 100644
--- a/projectroot/etc/rc.once.d/dropbear
+++ b/projectroot/etc/rc.once.d/dropbear
@@ -13,15 +13,9 @@ gen_key() {
rm -f $key_file > /dev/null 2>&1
- echo -n "generating $key_type key..."
- dropbearkey -t $key_type -f $key_file > /dev/null 2>&1
-
- if [ "$?" = "0" ]; then
- echo "done"
- else
- echo "failed"
- exit 1
- fi
+ echo "Create $key_type key; this may take some time ..."
+ dropbearkey -t $key_type -f $key_file > /dev/null 2>&1 || return
+ echo "Created $key_type key."
}
gen_keys() {
@@ -29,10 +23,10 @@ gen_keys() {
do
case "$keytype" in
rsa)
- gen_key rsa "$DROPBEAR_RSAKEY"
+ gen_key rsa "$DROPBEAR_RSAKEY" || return
;;
ecdsa)
- gen_key ecdsa "$DROPBEAR_ECDSAKEY"
+ gen_key ecdsa "$DROPBEAR_ECDSAKEY" || return
;;
*)
echo "Key type '$keytype' not supported"
base-commit: 70205d7cc77ff2bd36860291bf767f91bb4bc989
--
2.20.1
_______________________________________________
ptxdist mailing list
[email protected]
To unsubscribe, send a mail with subject "unsubscribe" to
[email protected]