mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] openssh/rc-once: fix minor bug and cleanup
@ 2020-08-17 14:08 Christian Hermann
  2020-08-17 14:33 ` Alexander Dahl
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Hermann @ 2020-08-17 14:08 UTC (permalink / raw)
  To: ptxdist

* `$_type` does not exist, resulting in empty variable.
  Fixup of 0a4f1ee4d.
* apply issues reported by shellcheck and shfmt
* drop command concatenation for key creation, because why would you want
  to miss out on ed25519 keys if the previous keys couldn't be
  generated?

Signed-off-by: Christian Hermann <christian.hermann@hytera.de>
---
 projectroot/etc/rc.once.d/openssh | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/projectroot/etc/rc.once.d/openssh b/projectroot/etc/rc.once.d/openssh
index 66cfa06df..4a8dd26b0 100644
--- a/projectroot/etc/rc.once.d/openssh
+++ b/projectroot/etc/rc.once.d/openssh
@@ -19,7 +19,7 @@ host_keys_required() {
 
 create_key() {
 	keytype="$1"
-	prettykeytype="$(echo $_type | tr a-z A-Z)"
+	prettykeytype="$(echo "$keytype" | tr '[:lower:]' '[:upper:]')"
 	shift
 	hostkeys="$1"
 	shift
@@ -28,8 +28,8 @@ create_key() {
 
 	if echo "$hostkeys" | grep -x -F "$file" >/dev/null; then
 		echo "Create $prettykeytype key; this may take some time ..."
-		rm -f $file &&
-		ssh-keygen -q -f "$file" -N '' -t "$keytype" "$@" || return
+		rm -f "$file" &&
+			ssh-keygen -q -f "$file" -N '' -t "$keytype" "$@" || return
 		echo "Created $prettykeytype key."
 	fi
 }
@@ -37,9 +37,9 @@ create_key() {
 create_keys() {
 	hostkeys="$(host_keys_required)"
 
-	create_key "dsa" "$hostkeys" &&
-	create_key "ecdsa" "$hostkeys" &&
-	create_key "ed25519" "$hostkeys" &&
+	create_key "dsa" "$hostkeys"
+	create_key "ecdsa" "$hostkeys"
+	create_key "ed25519" "$hostkeys"
 	create_key "rsa" "$hostkeys" -b 4096
 }
 
-- 
2.28.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ptxdist] [PATCH] openssh/rc-once: fix minor bug and cleanup
  2020-08-17 14:08 [ptxdist] [PATCH] openssh/rc-once: fix minor bug and cleanup Christian Hermann
@ 2020-08-17 14:33 ` Alexander Dahl
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Dahl @ 2020-08-17 14:33 UTC (permalink / raw)
  To: ptxdist; +Cc: Christian Hermann


[-- Attachment #1.1: Type: text/plain, Size: 2617 bytes --]

Hello Christian,

On Mon, Aug 17, 2020 at 04:08:02PM +0200, Christian Hermann wrote:
> * `$_type` does not exist, resulting in empty variable.
>   Fixup of 0a4f1ee4d.

There's no such changeset in public ptxdist master.

There is however 0a4f1ee4ed231a4e95dad545ba52ed2679e122ec and could
you please add a proper fixes line, if you already did the research to
find out that hash? e.g.

Fixes: 0a4f1ee4ed23 ("openssh/rc-once: deduplicate some data")

Greets
Alex

> * apply issues reported by shellcheck and shfmt
> * drop command concatenation for key creation, because why would you want
>   to miss out on ed25519 keys if the previous keys couldn't be
>   generated?
> 
> Signed-off-by: Christian Hermann <christian.hermann@hytera.de>
> ---
>  projectroot/etc/rc.once.d/openssh | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/projectroot/etc/rc.once.d/openssh b/projectroot/etc/rc.once.d/openssh
> index 66cfa06df..4a8dd26b0 100644
> --- a/projectroot/etc/rc.once.d/openssh
> +++ b/projectroot/etc/rc.once.d/openssh
> @@ -19,7 +19,7 @@ host_keys_required() {
>  
>  create_key() {
>  	keytype="$1"
> -	prettykeytype="$(echo $_type | tr a-z A-Z)"
> +	prettykeytype="$(echo "$keytype" | tr '[:lower:]' '[:upper:]')"
>  	shift
>  	hostkeys="$1"
>  	shift
> @@ -28,8 +28,8 @@ create_key() {
>  
>  	if echo "$hostkeys" | grep -x -F "$file" >/dev/null; then
>  		echo "Create $prettykeytype key; this may take some time ..."
> -		rm -f $file &&
> -		ssh-keygen -q -f "$file" -N '' -t "$keytype" "$@" || return
> +		rm -f "$file" &&
> +			ssh-keygen -q -f "$file" -N '' -t "$keytype" "$@" || return
>  		echo "Created $prettykeytype key."
>  	fi
>  }
> @@ -37,9 +37,9 @@ create_key() {
>  create_keys() {
>  	hostkeys="$(host_keys_required)"
>  
> -	create_key "dsa" "$hostkeys" &&
> -	create_key "ecdsa" "$hostkeys" &&
> -	create_key "ed25519" "$hostkeys" &&
> +	create_key "dsa" "$hostkeys"
> +	create_key "ecdsa" "$hostkeys"
> +	create_key "ed25519" "$hostkeys"
>  	create_key "rsa" "$hostkeys" -b 4096
>  }
>  
> -- 
> 2.28.0
> 
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

-- 
/"\ ASCII RIBBON | »With the first link, the chain is forged. The first
\ / CAMPAIGN     | speech censured, the first thought forbidden, the
 X  AGAINST      | first freedom denied, chains us all irrevocably.«
/ \ HTML MAIL    | (Jean-Luc Picard, quoting Judge Aaron Satie)

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 181 bytes --]

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-17 14:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-17 14:08 [ptxdist] [PATCH] openssh/rc-once: fix minor bug and cleanup Christian Hermann
2020-08-17 14:33 ` Alexander Dahl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox