ssh.service: avoid indirection via /bin/sh + do not run test mode in ExecStartPre
authorMichael Prokop <mika@grml.org>
Mon, 29 Aug 2022 15:56:38 +0000 (17:56 +0200)
committerMichael Prokop <mika@grml.org>
Mon, 29 Aug 2022 15:56:38 +0000 (17:56 +0200)
There's no point in running ssh-keygen under /bin/sh, so let's drop this
unnecessary indirection.

Furthermore there shouldn't be any need to run `sshd -t` before starting
the ssh daemon on the live system, as we definitely would like to get
sshd started if it was requested to so, even if there might be a
(possibly intermittent) problem with it. The test run makes sense for
reloading an already running ssh daemon, and we keep this in place.

Thanks to AndrĂ¡s Korn for spotting this

etc/grml/fai/config/files/etc/systemd/system/ssh.service/GRMLBASE

index e41b058..7b2c141 100644 (file)
@@ -7,8 +7,7 @@ ConditionPathExists=!/etc/ssh/sshd_not_to_be_run
 
 [Service]
 EnvironmentFile=-/etc/default/ssh
-ExecStartPre=-/bin/sh -c "/usr/bin/ssh-keygen -A"
-ExecStartPre=/usr/sbin/sshd -t
+ExecStartPre=-"/usr/bin/ssh-keygen -A"
 ExecStart=/usr/sbin/sshd -D $SSHD_OPTS
 ExecReload=/usr/sbin/sshd -t
 ExecReload=/bin/kill -HUP $MAINPID