Sophie

Sophie

distrib > Fedora > 13 > i386 > by-pkgid > 2b6d57de11205d1e4ec8b18312057c35 > files > 46

initng-ifiles-0.1.5-4.fc12.i686.rpm

#!/sbin/itype
# This is a i file, used by initng parsed by install_service

# NAME: Dropbear
# DESCRIPTION: SSH client with small memory footprint
# WWW: http://matt.ucc.asn.au/dropbear/dropbear.html

service daemon/dropbear/generate_keys {
	env KEYGEN=/usr/bin/ssh-keygen;
	env RSA1_KEY=/etc/dropbear/ssh_host_key;
	env RSA_KEY=/etc/dropbear/dropbear_rsa_host_key;
	env DSA_KEY=/etc/ssh/dropbear_dsa_host_key;
	script daemon = {
		[ ! -s ${RSA1_KEY} ] && \
			${KEYGEN} -q -t rsa1 -f ${RSA1_KEY} -C '' -N '' 2>&1 >/dev/null
		if [ ! -s ${RSA_KEY} ]
		then
			${KEYGEN} -q -t rsa -f ${RSA_KEY} -C '' -N '' 2>&1 >/dev/null
			chmod 600 ${RSA_KEY}
			chmod 644 ${RSA_KEY}.pub
		fi
		if [ ! -s ${DSA_KEY} ]
		then
			${KEYGEN} -q -t dsa -f ${DSA_KEY} -C '' -N '' 2>&1 >/dev/null
			chmod 600 ${DSA_KEY}
			chmod 644 ${DSA_KEY}.pub
		fi
	}
}

daemon daemon/dropbear {
	need = system/bootmisc virtual/net;
        conflict = daemon/sshd;
	use = daemon/dropbear/generate_keys;
        env DROPBEAR_PORT=22;
        env DROPBEAR_EXTRA_ARGS=;
        env NO_START=0;
        env_file = /etc/default/dropbear;
	pid_file = /var/run/dropbear.pid;
	forks;
	daemon_stops_badly;
        script daemon = {
		test -z "$DROPBEAR_BANNER" || \
		  DROPBEAR_EXTRA_ARGS="$DROPBEAR_EXTRA_ARGS -b $DROPBEAR_BANNER"
		test -n "$DROPBEAR_RSAKEY" || \
		  DROPBEAR_RSAKEY="/etc/dropbear/dropbear_rsa_host_key"
		test -n "$DROPBEAR_DSSKEY" || \
		  DROPBEAR_DSSKEY="/etc/dropbear/dropbear_dss_host_key"
	        test "$NO_START" = "0" || echo 'NO_START is not set to zero.' && exit 1
	       	exec /usr/sbin/dropbear -F -d "$DROPBEAR_DSSKEY" -r "$DROPBEAR_RSAKEY" \
		    -p "$DROPBEAR_PORT" $DROPBEAR_EXTRA_ARGS
        }

}