File:  [ELWIX - Embedded LightWeight unIX -] / elwix / config / etc / default / rc.d / 022.sshd.run
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Jul 5 23:43:00 2011 UTC (13 years ago) by misho
Branches: misho
CVS tags: start, elwix1_4
ELWIX project

#!/bin/sh

CONFDIR="/etc/ssh"
CONFIG="${CONFDIR}/sshd_config"

sshd_keygen()
{
	echo "Starting SSH ..."
	(
	umask 022
	if [ -f ${CONFDIR}/ssh_host_key ]; then
		echo "You already have an RSA host key in ${CONFDIR}/ssh_host_key"
		echo "Skipping protocol version 1 RSA Key Generation"
	else
		echo "Generating SSH version 1 RSA host key..."
		/usr/bin/ssh-keygen -t rsa1 -f ${CONFDIR}/ssh_host_key -N '' 1>/dev/null 2>&1
	fi

	if [ -f ${CONFDIR}/ssh_host_dsa_key ]; then
		echo "You already have a DSA host key in ${CONFDIR}/ssh_host_dsa_key"
		echo "Skipping protocol version 2 DSA Key Generation"
	else
		echo "Generating SSH DSA host key..."
		/usr/bin/ssh-keygen -t dsa -f ${CONFDIR}/ssh_host_dsa_key -N '' 1>/dev/null 2>&1
	fi

	if [ -f ${CONFDIR}/ssh_host_rsa_key ]; then
		echo "You already have a RSA host key in ${CONFDIR}/ssh_host_rsa_key"
		echo "Skipping protocol version 2 RSA Key Generation"
	else
		echo "Generating SSH version 2 RSA key ..." 
		/usr/bin/ssh-keygen -t rsa -f ${CONFDIR}/ssh_host_rsa_key -N '' 1>/dev/null 2>&1
	fi
	)
}

if [ ! -f /etc/ssh/ssh_host_key -o \
		! -f /etc/ssh/ssh_host_dsa_key -o \
		! -f /etc/ssh/ssh_host_rsa_key ]; then
	echo "Creating SSH Keys ..."
	sshd_keygen
fi

/usr/sbin/sshd -f $CONFIG

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>