summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2023-05-26 10:44:59 +0000
committerriastradh <riastradh@NetBSD.org>2023-05-26 10:44:59 +0000
commit8518818a30d4ca162fa307f6dbac0939c0d7a6fd (patch)
tree04d9aecb0aca0aaaf8e656e8f11bab14e5448350 /etc
parent3bb41dfb57fbac7f36ef2fe768e052726c8f0fc5 (diff)
/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
Diffstat (limited to 'etc')
-rwxr-xr-xetc/rc.d/sshd16
1 files changed, 14 insertions, 2 deletions
diff --git a/etc/rc.d/sshd b/etc/rc.d/sshd
index f01d505bd67..a8e6c9156b1 100755
--- a/etc/rc.d/sshd
+++ b/etc/rc.d/sshd
@@ -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