1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-28 05:29:48 +00:00
freebsd-ports/security/ssh2/files/sshd2.sh.in
Marius Strobl ef8176da90 - Switch to a rc.d startup script.
- Move the generation of the host key (if not present) from the package/
  port installation to the startup script in order to be in line with
  what the base OpenSSH and the OpenSSH-portable port do.
- Flush stdout when updating the transfer progress bar of sftp2 and scp2
  so the info displayed is up to date. [1]
- Remove obsolete USE_REINPLACE, remove trailing white space in Makefile.

PR:		91262 [1]
Approved by:	netchild
2006-02-19 22:56:35 +00:00

65 lines
1.2 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: sshd2
# REQUIRE: LOGIN
#
# Available configuration variables for sshd2 are:
#
# sshd2_enable (bool): Set to "YES" to enable sshd2. Defaults to "NO".
# sshd2_flags (flags): Extra flags to sshd2 (see sshd2(8)). Defaults to "".
# sshd2_port (port): Listening port of sshd2. Defaults to "22".
#
# Add at least the following line to /etc/rc.conf or /etc/rc.conf.local to
# enable sshd2:
#
# sshd2_enable="YES"
#
. %%RC_SUBR%%
name="sshd2"
rcvar=${name}_enable
command=%%PREFIX%%/sbin/${name}
command_args="2> /dev/null"
required_files=/usr/local/etc/ssh2/${name}_config
keygen_cmd="sshd2_keygen"
start_precmd="sshd2_precmd"
extra_commands="keygen reload"
sshd2_keygen()
{
(
umask 022
if [ -f %%PREFIX%%/etc/ssh2/hostkey ]; then
echo "You already have a host key in" \
"%%PREFIX%%/etc/ssh2/hostkey."
echo "Skipping key generation."
else
%%PREFIX%%/bin/ssh-keygen2 -P -t dsa -c "DSA hostkey" \
%%PREFIX%%/etc/ssh2/hostkey
fi
)
}
sshd2_precmd()
{
if [ ! -f %%PREFIX%%/etc/ssh2/hostkey ]; then
run_rc_command keygen
fi
rc_flags="${rc_flags} -p ${sshd2_port}"
}
load_rc_config $name
: ${sshd2_enable="NO"}
: ${sshd2_port="22"}
pidfile=/var/run/${name}_${sshd2_port}.pid
run_rc_command "$1"