diff options
author | seb <seb> | 2002-08-06 00:48:09 +0000 |
---|---|---|
committer | seb <seb> | 2002-08-06 00:48:09 +0000 |
commit | 3c1859c732f984da792f728754dae043e93c3c75 (patch) | |
tree | 34e3a477de4aab4902ee269f6eed200e48745134 /security/ssh2/files | |
parent | b97dc36c6797bf51b7a859dd279ce8a680c7d02b (diff) | |
download | pkgsrc-3c1859c732f984da792f728754dae043e93c3c75.tar.gz |
Initial import of ssh version 2.3.0 into the NetBSD Packages Collection.
This package provides Secure Shell client and server for V.2 SSH protocol
from SSH Communications Security.
Based on PR 15358 from Greg A. Woods <woods@planix.com>.
Diffstat (limited to 'security/ssh2/files')
-rw-r--r-- | security/ssh2/files/ssh2_secure_shell.sh | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/security/ssh2/files/ssh2_secure_shell.sh b/security/ssh2/files/ssh2_secure_shell.sh new file mode 100644 index 00000000000..21f1db631da --- /dev/null +++ b/security/ssh2/files/ssh2_secure_shell.sh @@ -0,0 +1,84 @@ +#!/bin/sh +# +# $NetBSD: ssh2_secure_shell.sh,v 1.1.1.1 2002/08/06 00:48:14 seb Exp $ +# +# PROVIDE: ssh2_secure_shell +# REQUIRE: DAEMON LOGIN + +if [ -f /etc/rc.subr ] +then + . /etc/rc.subr +fi + +name="ssh2_secure_shell" +rcvar=$name +command="@PREFIX@/sbin/sshd2" +keygen_command="@PREFIX@/bin/ssh-keygen2" +pidfile="@SSH_PID_DIR@/sshd2_22.pid" +required_files="@PKG_SYSCONFDIR@/sshd2_config" +extra_commands="keygen reload" + +ssh2_secure_shell_keygen() +{ + ( + umask 022 + if [ -f @PKG_SYSCONFDIR@/hostkey ]; then + @ECHO@ "You already have an DSA host key in @PKG_SYSCONFDIR@/hostkey" + @ECHO@ "Skipping Key Generation" + else + ${keygen_command} -P -b 1024 -t dsa -c "1024-bit dsa hostkey" @PKG_SYSCONFDIR@/hostkey + fi + ) +} + +ssh2_secure_shell_precmd() +{ + if [ ! -f @PKG_SYSCONFDIR@/hostkey ]; then + $0 keygen + fi +} + +keygen_cmd=ssh2_secure_shell_keygen +start_precmd=ssh2_secure_shell_precmd + +if [ -f /etc/rc.subr ] +then + load_rc_config $name + run_rc_command "$1" +else + case ${1:-start} in + start) + if [ -x ${command} -a -f ${required_files} ] + then + @ECHO@ "Starting ${name}." + eval ${start_precmd} + eval ${command} ${sshd_flags} ${command_args} + fi + ;; + stop) + if [ -f ${pidfile} ]; then + pid=`@HEAD@ -1 ${pidfile}` + @ECHO@ "Stopping ${name}." + kill -TERM ${pid} + else + @ECHO@ "${name} not running?" + fi + ;; + restart) + ( $0 stop ) + sleep 1 + $0 start + ;; + status) + if [ -f ${pidfile} ]; then + pid=`@HEAD@ -1 ${pidfile}` + @ECHO@ "${name} is running as pid ${pid}." + else + @ECHO@ "${name} is not running." + fi + ;; + keygen) + eval ${keygen_cmd} + ;; + esac +fi |