blob: 3930074daa5fa3b14cce61a06ea7ea29513c5f3e [file] [edit]
# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
description "Startup of sshd on miniOS"
author "chromeos-core-services@google.com"
start on stopped iptables and stopped ip6tables
respawn
oom score never
env SSH_DIR=/etc/ssh
pre-start script
if ! crossystem "debug_build?1"; then
stop
exit 0
fi
if ! sshd -t -q ; then
for KEY_TYPE in rsa ed25519 ; do
KEY_FILE="${SSH_DIR}/ssh_host_${KEY_TYPE}_key"
rm -f "${KEY_FILE}" "${KEY_FILE}.pub"
ssh-keygen -q -f "${KEY_FILE}" -N '' -t "${KEY_TYPE}"
done
fi
for cmd in iptables ip6tables ; do
$cmd -A INPUT -p tcp --dport 22 -j ACCEPT -w
done
end script
exec /usr/sbin/sshd