| # Copyright (c) 2010 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 "chromium-os-dev@chromium.org" |
| |
| # This must start after the iptables job so that when we enable |
| # port 22 below, the change won't be overwritten. |
| # |
| # By default, this job is only configured to start automatically in |
| # test images. |
| #for_test start on stopped iptables |
| |
| respawn |
| expect fork |
| |
| pre-start script |
| SSH_DIR=/mnt/stateful_partition/etc/ssh |
| mkdir -p ${SSH_DIR} |
| |
| for KEY_TYPE in rsa dsa ; do |
| KEY_FILE=${SSH_DIR}/ssh_host_${KEY_TYPE}_key |
| if [ ! -f ${KEY_FILE} ] ; then |
| ssh-keygen -q -f ${KEY_FILE} -N '' -t ${KEY_TYPE} |
| fi |
| done |
| |
| iptables -A INPUT -p tcp --dport 22 -j ACCEPT |
| end script |
| |
| exec /usr/sbin/sshd |