Skip to contentSkip to conversation

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

PATCH New Ignacy Gawędzki 3 participants 3 messages Feb 24, 2017 – Feb 26, 2017

lore
Share & tools
lore
#0 lore raw

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

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.

---
 package/openssh/S50sshd | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
package/openssh/S50sshd +3 -3
index c151142..22da41d 100644
@@ -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
Signature · 1 line
2.9.3
#1 lore raw

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

Ignacy, All,

On 2017-02-24 15:26 +0100, Ignacy Gaw?dzki spake thusly:

Quoted 5 lines

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.

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.

Quoted 30 lines
---
 package/openssh/S50sshd | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
package/openssh/S50sshd +3 -3
index c151142..22da41d 100644
@@ -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
Signature · 5 lines
2.9.3
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

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

In reply to Ignacy Gawędzki

Hello,

Quoted 8 lines · Ignacy Gaw?dzki

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.

---
 package/openssh/S50sshd | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com