diff mbox

openssh: Move key generation to the start function of init script.

Message ID 20170224142623.yldyeed3aif3w6de@zenon.in.qult.net
State Accepted
Headers show

Commit Message

Ignacy Gawędzki Feb. 24, 2017, 2:26 p.m. UTC
Since there's not much point in generating missing host keys when the
init script is called with "stop", the call to ssh-keygen should not
be done inconditionally, but in the start function instead.

Signed-off-by: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr>
---
 package/openssh/S50sshd | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Yann E. MORIN Feb. 24, 2017, 2:32 p.m. UTC | #1
Ignacy, All,

On 2017-02-24 15:26 +0100, Ignacy Gawędzki spake thusly:
> Since there's not much point in generating missing host keys when the
> init script is called with "stop", the call to ssh-keygen should not
> be done inconditionally, but in the start function instead.
> 
> Signed-off-by: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr>

Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

To be noted: there is nothing to do in the systemd service file, as it
is already a ExecStartPre action (i.e. what this patch does for SyS-V).

Regards,
Yann E. MORIN.

> ---
>  package/openssh/S50sshd | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/package/openssh/S50sshd b/package/openssh/S50sshd
> index c151142..22da41d 100644
> --- a/package/openssh/S50sshd
> +++ b/package/openssh/S50sshd
> @@ -6,12 +6,12 @@
>  # Make sure the ssh-keygen progam exists
>  [ -f /usr/bin/ssh-keygen ] || exit 0
>  
> -# Create any missing keys
> -/usr/bin/ssh-keygen -A
> -
>  umask 077
>  
>  start() {
> +	# Create any missing keys
> +	/usr/bin/ssh-keygen -A
> +
>  	printf "Starting sshd: "
>  	/usr/sbin/sshd
>  	touch /var/lock/sshd
> -- 
> 2.9.3
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Thomas Petazzoni Feb. 26, 2017, 1:38 p.m. UTC | #2
Hello,

On Fri, 24 Feb 2017 15:26:24 +0100, Ignacy Gawędzki wrote:
> Since there's not much point in generating missing host keys when the
> init script is called with "stop", the call to ssh-keygen should not
> be done inconditionally, but in the start function instead.
> 
> Signed-off-by: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr>
> ---
>  package/openssh/S50sshd | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Applied to master, thanks.

Thomas
diff mbox

Patch

diff --git a/package/openssh/S50sshd b/package/openssh/S50sshd
index c151142..22da41d 100644
--- a/package/openssh/S50sshd
+++ b/package/openssh/S50sshd
@@ -6,12 +6,12 @@ 
 # Make sure the ssh-keygen progam exists
 [ -f /usr/bin/ssh-keygen ] || exit 0
 
-# Create any missing keys
-/usr/bin/ssh-keygen -A
-
 umask 077
 
 start() {
+	# Create any missing keys
+	/usr/bin/ssh-keygen -A
+
 	printf "Starting sshd: "
 	/usr/sbin/sshd
 	touch /var/lock/sshd