Module Name: src
Committed By: riastradh
Date: Fri May 26 10:44:59 UTC 2023
Modified Files:
src/etc/rc.d: sshd
Log Message:
/etc/rc.d/sshd: New check cmd and reload precmd.
- check cmd: run `sshd -t' to check sshd_config file
- reload precmd: run check cmd before reloading so we don't nuke sshd
if there's an error in the sshd_config file
(It is still possible to effectively nuke sshd by changing the
configuration tosomething that won't work on your network, but at
least we avoid making sshd just exit on reload when you make a typo
in a config option.)
XXX pullup-9
XXX pullup-10
To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/etc/rc.d/sshd
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/etc/rc.d/sshd
diff -u src/etc/rc.d/sshd:1.32 src/etc/rc.d/sshd:1.33
--- src/etc/rc.d/sshd:1.32 Sun May 15 11:47:42 2022
+++ src/etc/rc.d/sshd Fri May 26 10:44:59 2023
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: sshd,v 1.32 2022/05/15 11:47:42 martin Exp $
+# $NetBSD: sshd,v 1.33 2023/05/26 10:44:59 riastradh Exp $
#
# PROVIDE: sshd
@@ -13,7 +13,7 @@ rcvar=$name
command="/usr/sbin/${name}"
pidfile="/var/run/${name}.pid"
required_files="/etc/ssh/sshd_config"
-extra_commands="keygen keyregen reload"
+extra_commands="check keygen keyregen reload"
sshd_motd_unsafe_keys_warning()
{
@@ -77,8 +77,20 @@ sshd_precmd()
run_rc_command keygen
}
+sshd_check()
+{
+ sshd -t
+}
+
+sshd_reload_precmd()
+{
+ run_rc_command check
+}
+
+check_cmd=sshd_check
keygen_cmd=sshd_keygen
keyregen_cmd="sshd_keygen force"
+reload_precmd=sshd_reload_precmd
start_precmd=sshd_precmd
load_rc_config $name