summaryrefslogtreecommitdiff
path: root/security/openssh/INSTALL.SunOS
blob: d06d4ccf81885d1d04205cacb0eeb4a0b31f5c60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
#
# $NetBSD: INSTALL.SunOS,v 1.2 2002/01/11 13:32:50 seb Exp $

PKGNAME=$1
STAGE=$2

case ${STAGE} in
PRE-INSTALL)
	;;
POST-INSTALL)
	SSH_CONF_DIR=@SSH_CONF_DIR@
	SSH_EXAMPLE_DIR=${PKG_PREFIX}/share/examples/openssh
	INSTALL_DATA="@INSTALL_DATA@"

	if [ ! -d ${SSH_CONF_DIR} ]
	then
		echo "Creating directory ${SSH_CONF_DIR} for ssh config files.."
		@MKDIR@ ${SSH_CONF_DIR}
	fi
	cd ${SSH_EXAMPLE_DIR}
	for file in ssh_config ssh_prng_cmds sshd_config
	do
		if [ -f ${file} ] && [ ! -f ${SSH_CONF_DIR}/${file} ]
		then
			echo "Installing example ${file} in ${SSH_CONF_DIR}.."
			${INSTALL_DATA} ${file} \
				${SSH_CONF_DIR}/${file}
		fi
	done
	if [ ! -f ${SSH_CONF_DIR}/ssh_host_key ]
	then
		echo "Generating an RSA1 secret host key in ${SSH_CONF_DIR}.."
		${PKG_PREFIX}/bin/ssh-keygen -t rsa1 -N "" \
			-f ${SSH_CONF_DIR}/ssh_host_key
	fi
	if [ ! -f ${SSH_CONF_DIR}/ssh_host_rsa_key ]
	then
		echo "Generating a RSA secret host key in ${SSH_CONF_DIR}.."
		${PKG_PREFIX}/bin/ssh-keygen -t rsa -N "" \
			-f ${SSH_CONF_DIR}/ssh_host_rsa_key
	fi
	if [ ! -f ${SSH_CONF_DIR}/ssh_host_dsa_key ]
	then
		echo "Generating a DSA secret host key in ${SSH_CONF_DIR}.."
		${PKG_PREFIX}/bin/ssh-keygen -t dsa -N "" \
			-f ${SSH_CONF_DIR}/ssh_host_dsa_key
	fi
	;;
*)
	echo "Unexpected argument: ${STAGE}"
	exit 1
	;;
esac
exit 0