blob: 0035290bc0aab2412ed79323a2c1f6f65e09a5cc [file] [log] [blame]
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
description "Start sshd to allow remote network login"
author ""
# This must start after the iptables job so that when we enable
# port 22 below, the change won't be overwritten.
start on stopped iptables and stopped ip6tables and starting failsafe
stop on stopping failsafe
# Allow boards to pass a few extra command line options. Like custom ports.
pre-start exec /usr/share/chromeos-ssh-config/sshd-pre
# sshd refuses to execute unless invoked with a full path. Go figure.
# For cros_embedded, sshd is in dev image so its in /usr/local/sbin.
if [ ! -f "${path}" ]; then
# We pass -D to keep sshd in the foreground. Upstart already provides
# the same features for us:
# - It dropped a controlling tty (std{in,err,out} are /dev/null).
# - It calls setsid() for every job.
# - It forked for us.
# This is also required for newer versions of openssh which probes to see
# "am I already daemonized", and Upstart triggers that code.
exec "${path}" -D ${SSHD_ARGS}
end script
post-stop exec /usr/share/chromeos-ssh-config/sshd-post