From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Fri, 10 Dec 2021 14:09:25 +0100 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mvfeP-002589-3T for lore@lore.pengutronix.de; Fri, 10 Dec 2021 14:09:25 +0100 Received: from localhost ([127.0.0.1] helo=metis.ext.pengutronix.de) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1mvfeO-00087E-D1; Fri, 10 Dec 2021 14:09:24 +0100 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mvfcU-0005cp-M5; Fri, 10 Dec 2021 14:07:26 +0100 Received: from [2a0a:edc0:0:1101:1d::39] (helo=dude03.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1mvfcU-003mPC-Lu; Fri, 10 Dec 2021 14:07:25 +0100 Received: from mol by dude03.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1mvfcS-00GNZI-VQ; Fri, 10 Dec 2021 14:07:25 +0100 From: Michael Olbrich To: ptxdist@pengutronix.de Date: Fri, 10 Dec 2021 14:07:24 +0100 Message-Id: <20211210130724.3903757-1-m.olbrich@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211209105127.120588-1-ada@thorsis.com> References: <20211209105127.120588-1-ada@thorsis.com> MIME-Version: 1.0 Subject: Re: [ptxdist] [APPLIED] dropbear: rc-once: Fix error handling X-BeenThere: ptxdist@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Cc: Alexander Dahl Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "ptxdist" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: ptxdist-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false Thanks, applied as a467e398aeed82d2a96e5e72a86aa9ac09f3e261. Michael [sent from post-receive hook] On Fri, 10 Dec 2021 14:07:24 +0100, Alexander Dahl wrote: > 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 > Message-Id: <20211209105127.120588-1-ada@thorsis.com> > Signed-off-by: Michael Olbrich > > diff --git a/projectroot/etc/rc.once.d/dropbear b/projectroot/etc/rc.once.d/dropbear > index 8a04406242e4..a8725616a7f2 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" _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de