+18
-5
@@ -1,10 +1,23 @@
|
||||
#!/usr/bin/env ssm
|
||||
|
||||
service_respawn = always
|
||||
service_command = /usr/bin/sshd -D -f "/etc/ssh/sshd_config"
|
||||
# OpenSSH server.
|
||||
#
|
||||
# sshd is run in foreground (-D) so ssm can track the process directly.
|
||||
# Host keys are created if they're missing; sshd refuses to start
|
||||
# without them, so do it before service_command is spawned.
|
||||
|
||||
service_respawn = on-failure
|
||||
service_command = /usr/sbin/sshd -D -f /etc/ssh/sshd_config
|
||||
service_ready_timeout = 10
|
||||
|
||||
pre_start() {
|
||||
if ! [[ -e "/etc/ssh/ssh_host_key" ]]; then
|
||||
ssh-keygen -A
|
||||
fi
|
||||
if [[ ! -f /etc/ssh/ssh_host_rsa_key ]]; then
|
||||
ssh-keygen -A
|
||||
fi
|
||||
}
|
||||
|
||||
# Wait for sshd to answer on port 22, not just for the parent process
|
||||
# to return.
|
||||
ready() {
|
||||
(exec 3<>/dev/tcp/127.0.0.1/22) 2>/dev/null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user