summaryrefslogtreecommitdiff
path: root/contrib/solaris
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-10-12 20:30:52 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-10-12 20:30:52 +0000
commit8b5ba1c39acd9bdf64c55a1407021111969a4289 (patch)
tree70d01b6f6b8000a3310692331957840684a8ac29 /contrib/solaris
parent4a820ea750ce79be709ca8c4b11edf39e07b2676 (diff)
- (bal) First wave of contrib/solaris/ package upgrades. Still more
work needs to be done, but it is a 190% better then the stuff we had before!
Diffstat (limited to 'contrib/solaris')
-rw-r--r--contrib/solaris/README82
-rwxr-xr-xcontrib/solaris/build-pkg218
-rwxr-xr-xcontrib/solaris/buildpkg.sh82
-rw-r--r--contrib/solaris/checkinstall.in37
-rwxr-xr-xcontrib/solaris/opensshd.in88
-rw-r--r--contrib/solaris/pkginfo.in17
-rw-r--r--contrib/solaris/postinstall.in243
-rw-r--r--contrib/solaris/preremove2
-rw-r--r--contrib/solaris/prototype36
-rwxr-xr-xcontrib/solaris/sshd-initscript.in50
10 files changed, 170 insertions, 685 deletions
diff --git a/contrib/solaris/README b/contrib/solaris/README
deleted file mode 100644
index e5445c3ac..000000000
--- a/contrib/solaris/README
+++ /dev/null
@@ -1,82 +0,0 @@
1README for OpenSSH Solaris packaging scripts
2Rip Loomis <loomisg@saic.com> - 2000-08-02
3
4To use, simply expand this tarball under your main
5OpenSSH source directory--it will create a
6contrib/solaris subdirectory. Run configure and
7make in OpenSSH as before. Then, from either
8that directory or the main OpenSSH source directory,
9run the command "build-pkg" (specifying the
10appropriate path of course.) A subdirectory
11will be created as contrib/solaris/build-SSH-package,
12and after the build is done the package will be
13present in that build-SSH-package directory
14with a name of the form
15OPENssh-$SSHversion-$arch-$OSversion[-$installLocation]
16
17The build and install scripts should take into account
18most possible situations (existing SSH installation,
19differences in Solaris version between build and
20target systems, changes you have made to the default
21configuration, etc.) I would appreciate any feedback
22or comments.
23
24Copyright information is included below, followed by the known issue list.
25Both are taken verbatim from the "build-pkg" script.
26
27# OpenSSH solaris build script and supporting data files
28# Copyright (c) 2000 Rip Loomis and
29# Science Applications International Corporation (SAIC)
30# (http://www.cist-east.saic.com). All rights reserved.
31#
32# Redistribution and use in source and binary forms, with or without
33# modification, are permitted provided that the following conditions
34# are met:
35# 1. Redistributions of source code must retain the above copyright
36# notice, this list of conditions and the following disclaimer.
37# 2. Redistributions in binary form must reproduce the above copyright
38# notice, this list of conditions and the following disclaimer in the
39# documentation and/or other materials provided with the distribution.
40# 3. The name of the author may not be used to endorse or promote products
41# derived from this software without specific prior written permission.
42#
43# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
44# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
45# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
46# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
47# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
48# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
52# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53
54# Obviously, without all the hard work of the OpenBSD OpenSSH developers
55# and the OpenSSH Portability Team, these scripts would be pointless...
56# so thanks again folks!
57#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
58
59#### Known issues
60# These methods are generally based on a "default" compilation of
61# OpenSSH on Solaris--so the more things that you change from the default,
62# the greater the chance that something in the script won't be able to
63# handle the changes. In general, though, most things should be determined
64# from your compile environment--the architecture, SSH version, and
65# other related data should all get picked up by this script. The script
66# and data files were last updated to match OpenSSH 2.1.1p4.
67#
68# All building and packaging is done under a temporary directory that is
69# itself created under the contrib/solaris directory--so there shouldn't
70# be any special security issues (or need for root access during the
71# packaging process). The temporary directory is defined below as
72# ${BUILDDIR}.
73#
74# The permissions on the installed files are based on how we prefer to
75# do things here--so nothing is installed SetUID to root.
76#
77# The post-install script makes a good-faith attempt to install a
78# functional configuration on your system. I would be interested in hearing
79# of any failure modes that are found, as I tried to compensate for all
80# the ones that showed up here when we started replacing all the
81# different installed versions of SSH.
82
diff --git a/contrib/solaris/build-pkg b/contrib/solaris/build-pkg
deleted file mode 100755
index fe92d9dda..000000000
--- a/contrib/solaris/build-pkg
+++ /dev/null
@@ -1,218 +0,0 @@
1#!/bin/sh
2
3# OpenSSH solaris build script and supporting data files
4# Copyright (c) 2000 Rip Loomis and
5# Science Applications International Corporation (SAIC)
6# (http://www.cist-east.saic.com). All rights reserved.
7#
8# Redistribution and use in source and binary forms, with or without
9# modification, are permitted provided that the following conditions
10# are met:
11# 1. Redistributions of source code must retain the above copyright
12# notice, this list of conditions and the following disclaimer.
13# 2. Redistributions in binary form must reproduce the above copyright
14# notice, this list of conditions and the following disclaimer in the
15# documentation and/or other materials provided with the distribution.
16# 3. The name of the author may not be used to endorse or promote products
17# derived from this software without specific prior written permission.
18#
19# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30# Obviously, without all the hard work of the OpenBSD OpenSSH developers
31# and the OpenSSH Portability Team, these scripts would be pointless...
32# so thanks again folks!
33#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
34
35#### Known issues
36# These methods are generally based on a "default" compilation of
37# OpenSSH on Solaris--so the more things that you change from the default,
38# the greater the chance that something in the script won't be able to
39# handle the changes. In general, though, most things should be determined
40# from your compile environment--the architecture, SSH version, and
41# other related data should all get picked up by this script. The script
42# and data files were last updated to match OpenSSH 2.1.1p4.
43#
44# All building and packaging is done under a temporary directory that is
45# itself created under the contrib/solaris directory--so there shouldn't
46# be any special security issues (or need for root access during the
47# packaging process). The temporary directory is defined below as
48# ${BUILDDIR}.
49#
50# The permissions on the installed files are based on how we prefer to
51# do things here--so nothing is installed SetUID to root.
52#
53# The post-install script makes a good-faith attempt to install a
54# functional configuration on your system. I would be interested in hearing
55# of any failure modes that are found, as I tried to compensate for all
56# the ones that showed up here when we started replacing all the
57# different installed versions of SSH.
58
59#### Body of the script (finally!)
60# We expect to be building the solaris package under the contrib/solaris
61# directory--but the build-package script might be run with a relative
62# path by a user in the main SSH directory...so we try to handle this
63# case. Note that this is still a quick and dirty solution, not robust.
64
65if [ -f sshd.c ]; then
66 cd contrib/solaris >/dev/null
67fi
68
69# Locations of standard binaries
70UNAME=/usr/bin/uname
71SED=/usr/bin/sed
72PWD=/usr/bin/pwd
73CUT=/usr/bin/cut
74STRIP=/usr/ccs/bin/strip
75PKGMK=/usr/bin/pkgmk
76PKGTRANS=/usr/bin/pkgtrans
77GREP=/usr/bin/grep
78DATE=/usr/bin/date
79
80CURRDIR=`${PWD}`
81BUILDDIR=${CURRDIR}/build-SSH-package
82# If you really want to name the package "ssh" then go ahead, but the
83# Sun convention is that the first 2-4 characters are supposed to be
84# uppercase representing the company or organization that produced the
85# software, and the next 3-5 characters are supposed to be lowercase
86# identifying the specific software. The best package names I could
87# come up with were "OBSDssh" or "OPENssh", given those constraints.
88PKGNAME="OPENssh"
89# PSTAMP is a standard setting in the 'pkginfo' file that helps to identify
90# the time and location that the packaging was done.
91PSTAMP="`${UNAME} -n`-`${DATE} +%Y-%m-%d-%H%M`"
92# The several lines below are designed to pull the relevant information
93# out of the Makefile. It may be simpler to hard-code this if you have
94# made changes and these lines don't find them.
95prefix=`${GREP} "^prefix=" ../../Makefile | ${CUT} -d = -f 2`
96execprefix=`${GREP} "^execprefix=" ../../Makefile | ${CUT} -d = -f 2`
97INSTROOT=${prefix:=/usr/local}
98ETCDIR=`${GREP} "^ETCDIR=" ../../Makefile | ${CUT} -d = -f 2`
99PIDDIR=`${GREP} "^piddir=" ../../Makefile | ${CUT} -d = -f 2`
100
101if [ ! -f ../../sshd ]; then
102 echo "Unable to locate sshd binary where I expected, and can't continue."
103 echo "Verify that the SSH configure/make has been completed, and that"
104 echo " this script is being run from within the SSH source tree."
105 exit 1
106fi
107
108
109VERSION=`${GREP} "SSH_VERSION" ../../version.h | ${CUT} -f 2 | sed -e 's/"//g' -e 's/OpenSSH_//g'`
110# Extra shenanigans to compensate for Sun marketeer tricks with Solaris
111# version numbering...
112OSMINOR=`${UNAME} -r | ${CUT} -f 2 -d .`
113if [ $OSMINOR -gt 6 ]; then
114 OSVERSION=$OSMINOR
115else
116 OSVERSION=`${UNAME} -r | ${SED} 's/5/2/'`
117fi
118ARCH=`$UNAME -p`
119SHORTINSTROOT=""
120if [ "$INSTROOT" = "/usr/local" ]; then
121 SHORTINSTROOT="-local"
122else
123 if [ "$INSTROOT" = "/opt" ]; then
124 SHORTINSTROOT="-opt"
125 fi
126fi
127
128DESTFILE="${PKGNAME}-${VERSION}-sol${OSVERSION}-${ARCH}${SHORTINSTROOT}"
129
130echo "Building Solaris package of OpenSSH ${VERSION} in\n\t${BUILDDIR}."
131echo "Binaries were compiled for Solaris ${OSVERSION} (${ARCH})"
132echo "The installable package will be named ${DESTFILE}."
133echo "When installed, the package will be located under ${INSTROOT}."
134echo ""
135
136echo "Cleaning up old build files..."
137rm -rf $BUILDDIR
138mkdir $BUILDDIR
139cd $BUILDDIR
140
141echo "Setting up build directories..."
142mkdir -p ${BUILDDIR}/man/man1
143# Need manpages for sshd_config(5) and ssh_config(5), but we don't yet have.
144#mkdir -p ${BUILDDIR}/man/man5
145mkdir -p ${BUILDDIR}/man/man8
146mkdir -p ${BUILDDIR}/etc
147mkdir -p ${BUILDDIR}/bin
148mkdir -p ${BUILDDIR}/libexec
149mkdir -p ${BUILDDIR}/sbin
150
151echo "Populating build directories..."
152cp -p ../../../sshd sbin
153cp -p ../../../ssh-keygen bin
154cp -p ../../../ssh-keyscan bin
155cp -p ../../../ssh bin
156cp -p ../../../ssh-add bin
157cp -p ../../../ssh-agent bin
158cp -p ../../../scp bin
159cp -p ../../../scp.1.out man/man1/scp.1
160cp -p ../../../sftp bin
161cp -p ../../../sftp.1.out man/man1/sftp.1
162cp -p ../../../sftp-server libexec/sftp-server
163cp -p ../../../sftp-server.8.out man/man8/sftp-server.8
164cp -p ../../../ssh-add.1.out man/man1/ssh-add.1
165cp -p ../../../ssh-agent.1.out man/man1/ssh-agent.1
166cp -p ../../../ssh-keygen.1.out man/man1/ssh-keygen.1
167cp -p ../../../ssh-keyscan.1.out man/man1/ssh-keyscan.1
168cp -p ../../../ssh.1.out man/man1/ssh.1
169cp -p ../../../sshd.8.out man/man8/sshd.8
170cp -p ../../../sshd_config.out etc/sshd_config.default
171cp -p ../../../ssh_config.out etc/ssh_config.default
172cp -p ../../../ssh_prng_cmds etc/ssh_prng_cmds.default
173cp -p ../../../primes etc/primes.default
174
175# One of the annoying things about the Solaris packaging process is that
176# there's no simple way to prototype on the fly--so make sure you edit
177# the prototype file if you add/subtract files from the mix.
178cp -p ../prototype .
179cp -p ../preremove .
180
181echo "Creating compile-dependent files from their prototypes"
182$SED -e "s/%%PKGNAME%%/${PKGNAME}/g" -e "s|%%BASEDIR%%|${INSTROOT}|g" -e "s/%%VERSION%%/${VERSION}/g" -e "s/%%ARCH%%/${ARCH}/g" -e "s/%%OSVERSION%%/${OSVERSION}/g" <../pkginfo.in >./pkginfo
183$SED -e "s/%%PKGNAME%%/${PKGNAME}/g" -e "s/%%OSMINOR%%/${OSMINOR}/g" -e "s/%%OSVERSION%%/${OSVERSION}/g" <../checkinstall.in >./checkinstall
184$SED -e "s|%%PIDDIR%%|${PIDDIR}|g" <../postinstall.in >./postinstall
185$SED -e "s|%%PIDDIR%%|${PIDDIR}|g" <../sshd-initscript.in > etc/sshd-initscript
186
187echo "Stripping binaries"
188${STRIP} bin/ssh
189${STRIP} bin/ssh-add
190${STRIP} bin/ssh-agent
191${STRIP} bin/ssh-keygen
192${STRIP} bin/ssh-keyscan
193${STRIP} sbin/sshd
194${STRIP} bin/scp
195${STRIP} bin/sftp
196${STRIP} libexec/sftp-server
197
198echo ""
199echo "Building Package"
200
201cd ${BUILDDIR}
202$PKGMK -o -r . -p ${PSTAMP} -d ${BUILDDIR}
203
204if [ $? -gt 0 ]; then
205 echo "Error performing pkgmk--cannot continue."
206 exit 1
207fi
208
209echo ""
210echo "Translating Package Tree into Installable Image"
211$PKGTRANS -s ${BUILDDIR} ${BUILDDIR}/${DESTFILE} OPENssh
212
213if [ $? -gt 0 ]; then
214 echo "Error performing pkgtrans--cannot continue."
215 exit 1
216fi
217
218echo "Done. Package is in ${BUILDDIR}/${DESTFILE} !"
diff --git a/contrib/solaris/buildpkg.sh b/contrib/solaris/buildpkg.sh
new file mode 100755
index 000000000..a71417075
--- /dev/null
+++ b/contrib/solaris/buildpkg.sh
@@ -0,0 +1,82 @@
1#!/bin/sh
2#
3# Fake Root Solaris Build System - Prototype
4#
5# The following code has been provide under Public Domain License. I really
6# don't care what you use it for. Just as long as you don't complain to me
7# nor my employer if you break it. - Ben Lindstrom (mouring@eviladmin.org)
8#
9umask 022
10PKGNAME=OpenSSH
11
12## Extract common info requires for the 'info' part of the package.
13VERSION=`tail -1 ../../version.h | sed -e 's/.*_\([0-9]\)/\1/g' | sed 's/\"$//'`
14ARCH=`uname -p`
15
16## Start by faking root install
17echo "Faking root install..."
18START=`pwd`
19FAKE_ROOT=$START/package
20mkdir $FAKE_ROOT
21cd ../..
22make install-nokeys DESTDIR=$FAKE_ROOT
23
24## Fill in some details, like prefix and sysconfdir
25ETCDIR=`grep "^sysconfdir=" Makefile | sed 's/sysconfdir=//'`
26PREFIX=`grep "^prefix=" Makefile | cut -d = -f 2`
27cd $FAKE_ROOT
28
29## Setup our run level stuff while we are at it.
30mkdir -p $FAKE_ROOT/etc/init.d
31mkdir -p $FAKE_ROOT/etc/rcS.d
32mkdir -p $FAKE_ROOT/etc/rc0.d
33mkdir -p $FAKE_ROOT/etc/rc1.d
34mkdir -p $FAKE_ROOT/etc/rc2.d
35
36
37## setup our initscript correctly
38sed -e "s#%%configDir%%#$ETCDIR#g" \
39 -e "s#%%openSSHDir%%#$PREFIX#g" \
40 ../opensshd.in > $FAKE_ROOT/etc/init.d/opensshd
41chmod 711 $FAKE_ROOT/etc/init.d/opensshd
42
43ln -s $FAKE_ROOT/etc/init.d/opensshd $FAKE_ROOT/etc/rcS.d/K30opensshd
44ln -s $FAKE_ROOT/etc/init.d/opensshd $FAKE_ROOT/etc/rc1.d/K30opensshd
45ln -s $FAKE_ROOT/etc/init.d/opensshd $FAKE_ROOT/etc/rc2.d/S98opensshd
46
47
48## Ok, this is outright wrong, but it will work. I'm tired of pkgmk
49## whining.
50for i in *; do
51 PROTO_ARGS="$PROTO_ARGS $i=/$i";
52done
53
54## Build info file
55echo "Building pkginfo file..."
56cat > pkginfo << _EOF
57PKG=$PKGNAME
58NAME=OpenSSH Portable for Solaris
59DESC="Secure Shell remote access utility; replaces telnet and rlogin/rsh."
60VENDOR="OpenSSH Portable Team - http://www.openssh.com/portable.html"
61BASEDIR=$FAKE_ROOT
62ARCH=$ARCH
63VERSION=$VERSION
64CATEGORY=Security
65BASEDIR=/
66_EOF
67
68## Next Build our prototype
69echo "Building prototype file..."
70find . | egrep -v "prototype|pkginfo" | sort | pkgproto $PROTO_ARGS | \
71 awk '
72 BEGIN { print "i pkginfo" }
73 { $5="root"; $6="sys"; }
74 { print; }' > prototype
75
76## Step back a directory and now build the package.
77echo "Building package.."
78cd ..
79pkgmk -d . -f $FAKE_ROOT/prototype -o
80rm -rf $FAKE_ROOT
81echo | pkgtrans -os . $PKGNAME-$ARCH-$VERSION.pkg
82rm -rf $PKGNAME
diff --git a/contrib/solaris/checkinstall.in b/contrib/solaris/checkinstall.in
deleted file mode 100644
index 37571936a..000000000
--- a/contrib/solaris/checkinstall.in
+++ /dev/null
@@ -1,37 +0,0 @@
1#!/bin/sh
2echo "Checking SunOS revision..."
3MINOR=`/bin/uname -r | /bin/cut -d "." -f 2`
4if [ ${MINOR} -lt %%OSMINOR%% ]; then
5 echo "This package was created on Solaris %%OSVERSION%%, and will probably"
6 echo " not function correctly on older versions of Solaris."
7 echo "** Unable to continue. **"
8 exit 3
9fi
10echo "\t...revision okay."
11
12echo "Checking for existing SSH installation..."
13if [ -f /etc/sshd_config -o -f /usr/local/etc/sshd_config ]; then
14 UPDATE=1
15fi
16if [ -f /etc/ssh_host_key -o -f /usr/local/etc/ssh_host_key ]; then
17 UPDATE=1
18fi
19
20if [ ${UPDATE} -eq 1 ]; then
21 echo "Performing an \"update\" installation of %%PKGNAME%%"
22else
23 echo "Performing a \"fresh\" installation of %%PKGNAME%%"
24fi
25echo ""
26
27# We derive these at install time in case the package is relocated.
28CONFDIR="${BASEDIR}/etc"
29DESTBIN="${BASEDIR}/bin"
30
31# make parameters available to installation service, and
32# so to any other packaging scripts
33cat >$1 <<!
34CONFDIR='$CONFDIR'
35DESTBIN='$DESTBIN'
36UPDATE='$UPDATE'
37!
diff --git a/contrib/solaris/opensshd.in b/contrib/solaris/opensshd.in
new file mode 100755
index 000000000..057459b17
--- /dev/null
+++ b/contrib/solaris/opensshd.in
@@ -0,0 +1,88 @@
1#!/sbin/sh
2# Donated code that was put under PD license.
3#
4# Stripped PRNGd out of it for the time being.
5
6AWK=/usr/bin/awk
7CAT=/usr/bin/cat
8EGREP=/usr/bin/egrep
9KILL=/usr/bin/kill
10PS=/usr/bin/ps
11
12PREFIX=%%openSSHDir%%
13ETCDIR=%%configDir%%
14
15SSHD=$PREFIX/sbin/sshd
16SSH_KEYGEN=$PREFIX/bin/ssh-keygen
17HOST_KEY_RSA1=$ETCDIR/ssh_host_key
18HOST_KEY_DSA=$ETCDIR/ssh_host_dsa_key
19HOST_KEY_RSA=$ETCDIR/ssh_host_rsa_key
20
21killproc() {
22 _procname=$1
23 _signal=$2
24 ${PGREP} ${_procname} | ${HEAD} -1 | ${XARGS} -t -I {} ${KILL} -${_signal} {}
25}
26
27
28checkkeys() {
29 if [ ! -f $HOST_KEY_RSA1 ]; then
30 $SSH_KEYGEN -t rsa1 -f $HOST_KEY_RSA1 -N ""
31 fi
32 if [ ! -f $HOST_KEY_DSA ]; then
33 $SSH_KEYGEN -t dsa -f $HOST_KEY_DSA -N ""
34 fi
35 if [ ! -f $HOST_KEY_RSA ]; then
36 $SSH_KEYGEN -t rsa -f $HOST_KEY_RSA -N ""
37 fi
38}
39
40stop_service() {
41 if [ -r $PIDFILE -a ! -z ${PIDFILE} ]; then
42 PID=`cat ${PIDFILE}`
43 fi
44 if [ ${PID:=0} -gt 1 -a ! "X$PID" = "X " ]; then
45 $KILL $PID
46 else
47 echo "Unable to read PID file, killing using alternate method"
48 killproc sshd TERM
49 fi
50}
51
52start_service() {
53 # XXX We really should check if the service is already going, but
54 # XXX we will opt out at this time. - Bal
55
56 # Check to see if we have keys that need to be made
57 checkkeys
58
59 # Start SSHD
60 echo "starting $SSHD... \c" ; $SSHD
61
62 sshd_rc=$?
63 if [ $sshd_rc -ne 0 ]; then
64 echo "$0: Error ${sshd_rc} starting ${SSHD}... bailing."
65 exit $sshd_rc
66 fi
67 echo done.
68}
69
70case $1 in
71
72'start')
73 start_service
74 ;;
75
76'stop')
77 stop_service
78 ;;
79
80'restart')
81 stop_service
82 start_service
83 ;;
84
85*)
86 echo "$0: usage: $0 {start|stop|restart}"
87 ;;
88esac
diff --git a/contrib/solaris/pkginfo.in b/contrib/solaris/pkginfo.in
deleted file mode 100644
index 4953d7d8e..000000000
--- a/contrib/solaris/pkginfo.in
+++ /dev/null
@@ -1,17 +0,0 @@
1CLASSES=none
2BASEDIR="%%BASEDIR%%"
3PATH=/sbin:/usr/sbin:/usr/bin:/usr/sadm/install/bin
4OAMBASE=/usr/sadm/sysadm
5PKG=%%PKGNAME%%
6NAME="OpenSSH %%VERSION%% %%ARCH%%"
7DESC="Secure Shell remote access utility; replaces telnet and rlogin/rsh. OpenBSD version ported to Solaris. Compiled on Solaris %%OSVERSION%%"
8ARCH="%%ARCH%%"
9VERSION="%%VERSION%%"
10CATEGORY=utility,application
11VENDOR="Software produced by OpenSSH Portability Team, http://www.openssh.com/portable.html"
12EMAIL="OpenSSH Development List <openssh-unix-dev@mindrot.org>"
13PKGINST=%%PKGNAME%%
14PKGSAV=/var/sadm/pkg/%%PKGNAME%%/save
15ISTATES="S s 1 2 3"
16RSTATES="S s 1 2 3"
17UPDATE=0
diff --git a/contrib/solaris/postinstall.in b/contrib/solaris/postinstall.in
deleted file mode 100644
index 3ce3bf13d..000000000
--- a/contrib/solaris/postinstall.in
+++ /dev/null
@@ -1,243 +0,0 @@
1# PostInstall script for OPENssh
2INSTALLF="/usr/sbin/installf"
3
4instbackup() {
5 _DIRECTORY=$1
6 _FILEBASE=$2
7 $INSTALLF $PKGINST ${_DIRECTORY}/${_FILEBASE}
8 _SUFFIX=`/usr/bin/date +%Y-%m-%d-%H%M`
9 if [ -f ${_DIRECTORY}/${_FILEBASE} ]; then
10 echo " Backing up file ${_FILEBASE}..."
11 if [ -f ${_DIRECTORY}/${_FILEBASE}.orig ]; then
12 $INSTALLF $PKGINST ${_DIRECTORY}/${_FILEBASE}.orig.${_SUFFIX}
13 cp -p ${_DIRECTORY}/${_FILEBASE} ${_DIRECTORY}/${_FILEBASE}.orig.${_SUFFIX}
14 echo " Saved as ${_DIRECTORY}/${_FILEBASE}.orig.${_SUFFIX}."
15 else
16 $INSTALLF $PKGINST ${_DIRECTORY}/${_FILEBASE}.orig
17 cp -p ${_DIRECTORY}/${_FILEBASE} ${_DIRECTORY}/${_FILEBASE}.orig
18 echo " Saved as ${_DIRECTORY}/${_FILEBASE}.orig."
19 fi
20 fi
21 cp -p ${_DIRECTORY}/${_FILEBASE}.default ${_DIRECTORY}/${_FILEBASE}
22 echo "Installed new ${_DIRECTORY}/${_FILEBASE} configuration file."
23}
24
25### Main body of script
26
27echo ""
28echo "Beginning postinstall script--this script should leave you with a"
29echo "functional and operational configuration of OpenSSH."
30echo ""
31
32if [ ! "${UPDATE}" = "1" ]; then
33 echo "Performing a \"fresh\" installation of OpenSSH."
34 ### Install init script and create symlinks
35 $INSTALLF $PKGINST ${PKG_INSTALL_ROOT}/etc/init.d/sshd f 0500 root sys || exit 2
36 cp -p ${CONFDIR}/sshd-initscript ${PKG_INSTALL_ROOT}/etc/init.d/sshd
37 $INSTALLF $PKGINST ${PKG_INSTALL_ROOT}/etc/rc2.d/S72local_sshd=/etc/init.d/sshd s || exit 2
38 $INSTALLF $PKGINST ${PKG_INSTALL_ROOT}/etc/rc1.d/K30local_sshd=/etc/init.d/sshd s || exit 2
39 $INSTALLF $PKGINST ${PKG_INSTALL_ROOT}/etc/rc0.d/K30local_sshd=/etc/init.d/sshd s || exit 2
40
41 ### The initial package installation leaves default versions of
42 ### ssh_prng_cmds, ssh_config, and sshd_config in ${CONFDIR}. Now
43 ### we need to decide whether to install them. Since this is *not*
44 ### an update install, we don't ask, but simply back up the old ones
45 ### and put the new ones in their place.
46 instbackup ${CONFDIR} ssh_prng_cmds
47 instbackup ${CONFDIR} ssh_config
48 instbackup ${CONFDIR} sshd_config
49 instbackup ${CONFDIR} primes
50
51 ### If no existing sshd_config and host key, then create
52 if [ ! -f "${CONFDIR}/ssh_host_key" ]; then
53 echo "Creating new RSA public/private host key pair for SSH-1."
54 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_key
55 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_key.pub
56 ### If there is *anything* there then leave it, otherwise look
57 ### in some reasonable alternate locations before giving up.
58 ### It's worth spending some extra time looking for the old one
59 ### to avoid a bunch of "host identification has changed" warnings.
60 ### Note that some old keys from the commercial SSH might not
61 ### be compatible, but we don't test for that.
62 if [ -f "${PKG_INSTALL_ROOT}/etc/ssh_host_key" ]; then
63 mv ${PKG_INSTALL_ROOT}/etc/ssh_host_key ${CONFDIR}
64 elif [ -f "${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_key" ]; then
65 mv ${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_key ${CONFDIR}
66 else
67 ${DESTBIN}/ssh-keygen -b 1024 -f ${CONFDIR}/ssh_host_key -N ''
68 fi
69 else
70 echo "Using existing RSA public/private host key pair for SSH-1."
71 fi
72 if [ ! -f "${CONFDIR}/ssh_host_dsa_key" ]; then
73 echo "Creating new DSA public/private host key pair for SSH-2."
74 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_dsa_key
75 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_dsa_key.pub
76 ### If there is *anything* there then leave it, otherwise look
77 ### in some reasonable alternate locations before giving up.
78 ### It's worth spending some extra time looking for the old one
79 ### to avoid a bunch of "host identification has changed" warnings.
80 ### Note that some old keys from the commercial SSH2 might not
81 ### be compatible, but we don't test for that.
82 if [ -f "${PKG_INSTALL_ROOT}/etc/ssh_host_dsa_key" ]; then
83 mv ${PKG_INSTALL_ROOT}/etc/ssh_host_dsa_key ${CONFDIR}
84 elif [ -f "${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_dsa_key" ]; then
85 mv ${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_dsa_key ${CONFDIR}
86 else
87 ${DESTBIN}/ssh-keygen -d -f ${CONFDIR}/ssh_host_dsa_key -N ''
88 fi
89 else
90 echo "Using existing DSA public/private host key pair for SSH-2."
91 fi
92 if [ ! -f "${CONFDIR}/ssh_host_rsa_key" ]; then
93 echo "Creating new RSA public/private host key pair for SSH-2."
94 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_rsa_key
95 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_rsa_key.pub
96 ### If there is *anything* there then leave it, otherwise look
97 ### in some reasonable alternate locations before giving up.
98 ### It's worth spending some extra time looking for the old one
99 ### to avoid a bunch of "host identification has changed" warnings.
100 ### Note that some old keys from the commercial SSH2 might not
101 ### be compatible, but we don't test for that.
102 if [ -f "${PKG_INSTALL_ROOT}/etc/ssh_host_rsa_key" ]; then
103 mv ${PKG_INSTALL_ROOT}/etc/ssh_host_rsa_key ${CONFDIR}
104 elif [ -f "${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_rsa_key" ]; then
105 mv ${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_rsa_key ${CONFDIR}
106 else
107 ${DESTBIN}/ssh-keygen -t rsa -f ${CONFDIR}/ssh_host_rsa_key -N ''
108 fi
109 else
110 echo "Using existing RSA public/private host key pair for SSH-2."
111 fi
112else
113 echo "Performing an \"update\" installation of OpenSSH."
114 ### Okay, this part *is* an update install...so we need to ensure
115 ### we don't overwrite any of the existing files.
116
117 ### Install init script and create symlinks
118 if [ ! -f ${PKG_INSTALL_ROOT}/etc/init.d/sshd ]; then
119 echo "Installing init script in ${PKG_INSTALL_ROOT}/etc/init.d/sshd"
120 $INSTALLF $PKGINST ${PKG_INSTALL_ROOT}/etc/init.d/sshd || exit 2
121 cp -p ${CONFDIR}/sshd-initscript ${PKG_INSTALL_ROOT}/etc/init.d/sshd
122 chown root:root ${PKG_INSTALL_ROOT}/etc/init.d/sshd
123 chmod 500 ${PKG_INSTALL_ROOT}/etc/init.d/sshd
124 fi
125 if [ ! -r ${PKG_INSTALL_ROOT}/etc/rc2.d/S72local_sshd ]; then
126 $INSTALLF $PKGINST ${PKG_INSTALL_ROOT}/etc/rc2.d/S72local_sshd=/etc/init.d/sshd s || exit 2
127 fi
128 if [ ! -r ${PKG_INSTALL_ROOT}/etc/rc2.d/K30local_sshd ]; then
129 $INSTALLF $PKGINST /etc/rc0.d/K30local_sshd=/etc/init.d/sshd s || exit 2
130 fi
131
132 ### The initial package installation leaves default versions of
133 ### ssh_prng_cmds, ssh_config, and sshd_config in ${CONFDIR}. Now
134 ### we need to decide whether to install them. Since this is
135 ### an update install, we only install the new files if the old
136 ### files somehow don't exist.
137 NEWCONF=0
138 if [ ! -r "${CONFDIR}/ssh_prng_cmds" ]; then
139 instbackup ${CONFDIR} ssh_prng_cmds
140 NEWCONF=1
141 fi
142 if [ ! -r "${CONFDIR}/ssh_config" ]; then
143 instbackup ${CONFDIR} ssh_config
144 NEWCONF=1
145 fi
146 if [ ! -r "${CONFDIR}/sshd_config" ]; then
147 instbackup ${CONFDIR} sshd_config
148 NEWCONF=1
149 fi
150 if [ ! -r "${CONFDIR}/primes" ]; then
151 instbackup ${CONFDIR} primes
152 NEWCONF=1
153 fi
154 if [ $NEWCONF -eq 0 ]; then
155 echo "Your existing SSH configuration files have not been altered."
156 else
157 echo "Your other existing SSH configuration files have not been altered."
158 fi
159
160 ### If no existing sshd_config and host key, then create
161 if [ ! -f "${CONFDIR}/ssh_host_key" ]; then
162 echo "Creating new RSA public/private host key pair for SSH-1."
163 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_key
164 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_key.pub
165 ### If there is *anything* there then leave it, otherwise look
166 ### in some reasonable alternate locations before giving up.
167 ### It's worth spending some extra time looking for the old one
168 ### to avoid a bunch of "host identification has changed" warnings.
169 ### Note that some old keys from the commercial SSH might not
170 ### be compatible, but we don't test for that.
171 if [ -f "${PKG_INSTALL_ROOT}/etc/ssh_host_key" ]; then
172 mv ${PKG_INSTALL_ROOT}/etc/ssh_host_key ${CONFDIR}
173 elif [ -f "${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_key" ]; then
174 mv ${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_key ${CONFDIR}
175 else
176 ${DESTBIN}/ssh-keygen -b 1024 -f ${CONFDIR}/ssh_host_key -N ''
177 fi
178 else
179 echo "Using existing RSA public/private host key pair for SSH-1."
180 fi
181 if [ ! -f "${CONFDIR}/ssh_host_dsa_key" ]; then
182 echo "Creating new DSA public/private host key pair for SSH-2."
183 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_dsa_key
184 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_dsa_key.pub
185 ### If there is *anything* there then leave it, otherwise look
186 ### in some reasonable alternate locations before giving up.
187 ### It's worth spending some extra time looking for the old one
188 ### to avoid a bunch of "host identification has changed" warnings.
189 ### Note that some old keys from the commercial SSH2 might not
190 ### be compatible, but we don't test for that.
191 if [ -f "${PKG_INSTALL_ROOT}/etc/ssh_host_dsa_key" ]; then
192 mv ${PKG_INSTALL_ROOT}/etc/ssh_host_dsa_key ${CONFDIR}
193 elif [ -f "${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_dsa_key" ]; then
194 mv ${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_dsa_key ${CONFDIR}
195 else
196 ${DESTBIN}/ssh-keygen -d -f ${CONFDIR}/ssh_host_dsa_key -N ''
197 fi
198 else
199 echo "Using existing DSA public/private host key pair for SSH-2."
200 fi
201 if [ ! -f "${CONFDIR}/ssh_host_rsa_key" ]; then
202 echo "Creating new RSA public/private host key pair for SSH-2."
203 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_rsa_key
204 $INSTALLF $PKGINST ${CONFDIR}/ssh_host_rsa_key.pub
205 ### If there is *anything* there then leave it, otherwise look
206 ### in some reasonable alternate locations before giving up.
207 ### It's worth spending some extra time looking for the old one
208 ### to avoid a bunch of "host identification has changed" warnings.
209 ### Note that some old keys from the commercial SSH2 might not
210 ### be compatible, but we don't test for that.
211 if [ -f "${PKG_INSTALL_ROOT}/etc/ssh_host_rsa_key" ]; then
212 mv ${PKG_INSTALL_ROOT}/etc/ssh_host_rsa_key ${CONFDIR}
213 elif [ -f "${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_rsa_key" ]; then
214 mv ${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_rsa_key ${CONFDIR}
215 else
216 ${DESTBIN}/ssh-keygen -d -f ${CONFDIR}/ssh_host_rsa_key -N ''
217 fi
218 else
219 echo "Using existing RSA public/private host key pair for SSH-2."
220 fi
221fi
222
223if [ ! -d %%PIDDIR%% ]; then
224 $INSTALLF $PKGINST %%PIDDIR%%
225 mkdir -p %%PIDDIR%%
226 chown root:sys %%PIDDIR%%
227 chmod 755 %%PIDDIR%%
228fi
229
230$INSTALLF -f $PKGINST || exit 2
231
232if [ "X${PKG_INSTALL_ROOT}" = "X" ]; then
233 ### We're doing a local install, rather than an install for
234 ### old-style diskless clients.
235 echo "Stopping any current sshd process, and then starting the new sshd."
236 /etc/init.d/sshd stop
237 /etc/init.d/sshd start
238else
239 echo "Not restarting sshd, since this appears to be a remote install"
240 echo "for support of diskless clients."
241fi
242
243exit 0
diff --git a/contrib/solaris/preremove b/contrib/solaris/preremove
deleted file mode 100644
index 701c8c55b..000000000
--- a/contrib/solaris/preremove
+++ /dev/null
@@ -1,2 +0,0 @@
1# pre-removal script for OPENssh
2/etc/init.d/sshd stop
diff --git a/contrib/solaris/prototype b/contrib/solaris/prototype
deleted file mode 100644
index 3c93f2c1a..000000000
--- a/contrib/solaris/prototype
+++ /dev/null
@@ -1,36 +0,0 @@
1i pkginfo
2i checkinstall
3i postinstall
4i preremove
5d none man 0755 root sys
6d none man/man1 0755 root sys
7f none man/man1/scp.1 0644 root sys
8f none man/man1/sftp.1 0644 root sys
9f none man/man1/ssh-add.1 0644 root sys
10f none man/man1/ssh-agent.1 0644 root sys
11f none man/man1/ssh-keygen.1 0644 root sys
12f none man/man1/ssh-keyscan.1 0644 root sys
13f none man/man1/ssh.1 0644 root sys
14s none man/man1/slogin.1=ssh.1
15d none man/man8 0755 root sys
16f none man/man8/sftp-server.8 0644 root sys
17f none man/man8/sshd.8 0644 root sys
18d none etc 0755 root sys
19f none etc/sshd_config.default 0644 root sys
20f none etc/ssh_config.default 0644 root sys
21f none etc/ssh_prng_cmds.default 0644 root sys
22f none etc/primes.default 0644 root sys
23f none etc/sshd-initscript 0755 root sys
24d none bin 0755 root sys
25f none bin/ssh-keygen 0755 root sys
26f none bin/ssh 0755 root sys
27s none bin/slogin=ssh 0755 root sys
28f none bin/ssh-add 0755 root sys
29f none bin/ssh-agent 0755 root sys
30f none bin/ssh-keyscan 0755 root sys
31f none bin/scp 0755 root sys
32f none bin/sftp 0755 root sys
33d none libexec 0755 root sys
34f none libexec/sftp-server 0755 root sys
35d none sbin 0755 root sys
36f none sbin/sshd 0755 root sys
diff --git a/contrib/solaris/sshd-initscript.in b/contrib/solaris/sshd-initscript.in
deleted file mode 100755
index 886a51fba..000000000
--- a/contrib/solaris/sshd-initscript.in
+++ /dev/null
@@ -1,50 +0,0 @@
1#! /sbin/sh
2
3# SSHd startup/shutdown script, based on uucp script.
4
5PIDFILE="%%PIDDIR%%/sshd.pid"
6PGREP="/usr/bin/pgrep"
7HEAD="/usr/bin/head"
8XARGS="/usr/bin/xargs"
9KILL="/usr/bin/kill"
10
11killproc() {
12 _procname=$1
13 _signal=$2
14 ${PGREP} ${_procname} | ${HEAD} -1 | ${XARGS} -t -I {} ${KILL} -${_signal} {}
15}
16
17case $1 in
18'start')
19 /usr/local/sbin/sshd
20 ;;
21
22'stop')
23 if [ -r $PIDFILE -a ! -z ${PIDFILE} ]; then
24 PID=`cat ${PIDFILE}`
25 fi
26 if [ ${PID:=0} -gt 1 -a ! "X$PID" = "X " ]; then
27 /usr/bin/kill $PID
28 else
29 echo "Unable to read PID file, killing using alternate method"
30 killproc sshd TERM
31 fi
32 ;;
33
34'restart')
35 if [ -r $PIDFILE -a ! -z ${PIDFILE} ]; then
36 PID=`cat ${PIDFILE}`
37 fi
38 if [ ${PID:=0} -gt 1 -a ! "X$PID" = "X " ]; then
39 /usr/bin/kill -HUP $PID
40 else
41 echo "Unable to read PID file, trying alternate method"
42 killproc sshd HUP
43 /usr/local/sbin/sshd
44 fi
45 ;;
46
47*)
48 echo "usage: /etc/init.d/sshd {start|stop|restart}"
49 ;;
50esac