From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Fri, 26 Nov 2021 15:35:17 +0100 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by lore.white.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1mqcJp-00049g-Vd for lore@lore.pengutronix.de; Fri, 26 Nov 2021 15:35:17 +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 1mqcJp-0005e0-0q; Fri, 26 Nov 2021 15:35:17 +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 1mqcJc-00052x-Gz; Fri, 26 Nov 2021 15:35:04 +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 1mqcJc-001Bum-Dk; Fri, 26 Nov 2021 15:35:03 +0100 Received: from mol by dude03.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1mqcJb-0053Wt-12; Fri, 26 Nov 2021 15:35:03 +0100 From: Michael Olbrich To: ptxdist@pengutronix.de Date: Fri, 26 Nov 2021 15:35:03 +0100 Message-Id: <20211126143503.1205134-1-m.olbrich@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211105154734.19983-6-ada@thorsis.com> References: <20211105154734.19983-6-ada@thorsis.com> MIME-Version: 1.0 Subject: Re: [ptxdist] [APPLIED] dropbear: Refactor rc-once and init to use KEYTYPES 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 cf0424f8ba234645b8706edc2e9105eb7f421b2e. Michael [sent from post-receive hook] On Fri, 26 Nov 2021 15:35:02 +0100, Alexander Dahl wrote: > Previously DSS and RSA keys were always generated, regardless if > dropbear was built with support for that host key or not, which somehow > contradicts what commit message of 01ac7cc409b5 ("dropbear: Remove > deprecated options") promised. > > No other things changed here, just considering that KEYTYPES list for > 'rsa' for now. > > Signed-off-by: Alexander Dahl > Message-Id: <20211105154734.19983-6-ada@thorsis.com> > Signed-off-by: Michael Olbrich > > diff --git a/projectroot/etc/init.d/dropbear b/projectroot/etc/init.d/dropbear > index 15671c9d8a22..4dda9aaf7d64 100644 > --- a/projectroot/etc/init.d/dropbear > +++ b/projectroot/etc/init.d/dropbear > @@ -15,9 +15,18 @@ test -z "$DROPBEAR_BANNER" || \ > DROPBEAR_EXTRA_ARGS="$DROPBEAR_EXTRA_ARGS -b $DROPBEAR_BANNER" > > dropbear_start() { > - > KEY_ARGS="" > - test -f $DROPBEAR_RSAKEY && KEY_ARGS="$KEY_ARGS -r $DROPBEAR_RSAKEY" > + for keytype in $DROPBEAR_KEYTYPES > + do > + case "$keytype" in > + rsa) > + test -f "$DROPBEAR_RSAKEY" && KEY_ARGS="$KEY_ARGS -r $DROPBEAR_RSAKEY" > + ;; > + *) > + echo "Key type '$keytype' not supported" > + ;; > + esac > + done > > echo -n "starting dropbear..." > > diff --git a/projectroot/etc/rc.once.d/dropbear b/projectroot/etc/rc.once.d/dropbear > index b70f5f22e997..0735fed38818 100644 > --- a/projectroot/etc/rc.once.d/dropbear > +++ b/projectroot/etc/rc.once.d/dropbear > @@ -5,10 +5,11 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin > . /usr/lib/init/dropbear.sh > > gen_key() { > - > key_type=$1 > key_file=$2 > > + [ -e "$key_file" ] && return > + > rm -f $key_file > /dev/null 2>&1 > > echo -n "generating $key_type key..." > @@ -22,4 +23,22 @@ gen_key() { > fi > } > > -[ -e "$DROPBEAR_RSAKEY" ] || gen_key rsa "$DROPBEAR_RSAKEY" > +gen_keys() { > + for keytype in $DROPBEAR_KEYTYPES > + do > + case "$keytype" in > + rsa) > + gen_key rsa "$DROPBEAR_RSAKEY" > + ;; > + *) > + echo "Key type '$keytype' not supported" > + ;; > + esac > + done > +} > + > +if ! gen_keys > +then > + echo "Generating SSH keys failed!" > + exit 1 > +fi _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de