diff options
Diffstat (limited to 'contrib/solaris')
-rw-r--r-- | contrib/solaris/README | 82 | ||||
-rwxr-xr-x | contrib/solaris/build-pkg | 207 | ||||
-rw-r--r-- | contrib/solaris/checkinstall.in | 37 | ||||
-rw-r--r-- | contrib/solaris/pkginfo.in | 17 | ||||
-rw-r--r-- | contrib/solaris/postinstall.in | 198 | ||||
-rw-r--r-- | contrib/solaris/preremove | 2 | ||||
-rw-r--r-- | contrib/solaris/prototype | 26 | ||||
-rwxr-xr-x | contrib/solaris/sshd-initscript.in | 50 |
8 files changed, 619 insertions, 0 deletions
diff --git a/contrib/solaris/README b/contrib/solaris/README new file mode 100644 index 000000000..e5445c3ac --- /dev/null +++ b/contrib/solaris/README | |||
@@ -0,0 +1,82 @@ | |||
1 | README for OpenSSH Solaris packaging scripts | ||
2 | Rip Loomis <loomisg@saic.com> - 2000-08-02 | ||
3 | |||
4 | To use, simply expand this tarball under your main | ||
5 | OpenSSH source directory--it will create a | ||
6 | contrib/solaris subdirectory. Run configure and | ||
7 | make in OpenSSH as before. Then, from either | ||
8 | that directory or the main OpenSSH source directory, | ||
9 | run the command "build-pkg" (specifying the | ||
10 | appropriate path of course.) A subdirectory | ||
11 | will be created as contrib/solaris/build-SSH-package, | ||
12 | and after the build is done the package will be | ||
13 | present in that build-SSH-package directory | ||
14 | with a name of the form | ||
15 | OPENssh-$SSHversion-$arch-$OSversion[-$installLocation] | ||
16 | |||
17 | The build and install scripts should take into account | ||
18 | most possible situations (existing SSH installation, | ||
19 | differences in Solaris version between build and | ||
20 | target systems, changes you have made to the default | ||
21 | configuration, etc.) I would appreciate any feedback | ||
22 | or comments. | ||
23 | |||
24 | Copyright information is included below, followed by the known issue list. | ||
25 | Both 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 new file mode 100755 index 000000000..5f2e3addd --- /dev/null +++ b/contrib/solaris/build-pkg | |||
@@ -0,0 +1,207 @@ | |||
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 | |||
65 | if [ -f sshd.c ]; then | ||
66 | cd contrib/solaris >/dev/null | ||
67 | fi | ||
68 | |||
69 | # Locations of standard binaries | ||
70 | UNAME=/usr/bin/uname | ||
71 | SED=/usr/bin/sed | ||
72 | PWD=/usr/bin/pwd | ||
73 | CUT=/usr/bin/cut | ||
74 | STRIP=/usr/ccs/bin/strip | ||
75 | PKGMK=/usr/bin/pkgmk | ||
76 | PKGTRANS=/usr/bin/pkgtrans | ||
77 | GREP=/usr/bin/grep | ||
78 | DATE=/usr/bin/date | ||
79 | |||
80 | CURRDIR=`${PWD}` | ||
81 | BUILDDIR=${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. | ||
88 | PKGNAME="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. | ||
91 | PSTAMP="`${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. | ||
95 | prefix=`${GREP} "^prefix=" ../../Makefile | ${CUT} -d = -f 2` | ||
96 | execprefix=`${GREP} "^execprefix=" ../../Makefile | ${CUT} -d = -f 2` | ||
97 | INSTROOT=${prefix:=/usr/local} | ||
98 | ETCDIR=`${GREP} "^ETCDIR=" ../../Makefile | ${CUT} -d = -f 2` | ||
99 | PIDDIR=`${GREP} "^piddir=" ../../Makefile | ${CUT} -d = -f 2` | ||
100 | |||
101 | if [ ! -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 | ||
106 | fi | ||
107 | |||
108 | |||
109 | VERSION=`${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... | ||
112 | OSMINOR=`${UNAME} -r | ${CUT} -f 2 -d .` | ||
113 | if [ $OSMINOR -gt 6 ]; then | ||
114 | OSVERSION=$OSMINOR | ||
115 | else | ||
116 | OSVERSION=`${UNAME} -r | ${SED} 's/5/2/'` | ||
117 | fi | ||
118 | ARCH=`$UNAME -p` | ||
119 | SHORTINSTROOT="" | ||
120 | if [ "$INSTROOT" = "/usr/local" ]; then | ||
121 | SHORTINSTROOT="-local" | ||
122 | else | ||
123 | if [ "$INSTROOT" = "/opt" ]; then | ||
124 | SHORTINSTROOT="-opt" | ||
125 | fi | ||
126 | fi | ||
127 | |||
128 | DESTFILE="${PKGNAME}-${VERSION}-sol${OSVERSION}-${ARCH}${SHORTINSTROOT}" | ||
129 | |||
130 | echo "Building Solaris package of OpenSSH ${VERSION} in\n\t${BUILDDIR}." | ||
131 | echo "Binaries were compiled for Solaris ${OSVERSION} (${ARCH})" | ||
132 | echo "The installable package will be named ${DESTFILE}." | ||
133 | echo "When installed, the package will be located under ${INSTROOT}." | ||
134 | echo "" | ||
135 | |||
136 | echo "Cleaning up old build files..." | ||
137 | rm -rf $BUILDDIR | ||
138 | mkdir $BUILDDIR | ||
139 | cd $BUILDDIR | ||
140 | |||
141 | echo "Setting up build directories..." | ||
142 | mkdir -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 | ||
145 | mkdir -p ${BUILDDIR}/man/man8 | ||
146 | mkdir -p ${BUILDDIR}/etc | ||
147 | mkdir -p ${BUILDDIR}/bin | ||
148 | mkdir -p ${BUILDDIR}/sbin | ||
149 | |||
150 | echo "Populating build directories..." | ||
151 | cp -p ../../../sshd sbin | ||
152 | cp -p ../../../ssh-keygen bin | ||
153 | cp -p ../../../ssh bin | ||
154 | cp -p ../../../ssh-add bin | ||
155 | cp -p ../../../ssh-agent bin | ||
156 | cp -p ../../../scp bin | ||
157 | cp -p ../../../scp.1 man/man1/scp.1 | ||
158 | cp -p ../../../ssh-add.1 man/man1/ssh-add.1 | ||
159 | cp -p ../../../ssh-agent.1 man/man1/ssh-agent.1 | ||
160 | cp -p ../../../ssh-keygen.1 man/man1/ssh-keygen.1 | ||
161 | cp -p ../../../ssh.1 man/man1/ssh.1 | ||
162 | cp -p ../../../sshd.8 man/man8/sshd.8 | ||
163 | cp -p ../../../sshd_config.out etc/sshd_config.default | ||
164 | cp -p ../../../ssh_config.out etc/ssh_config.default | ||
165 | cp -p ../../../ssh_prng_cmds etc/ssh_prng_cmds.default | ||
166 | |||
167 | # One of the annoying things about the Solaris packaging process is that | ||
168 | # there's no simple way to prototype on the fly--so make sure you edit | ||
169 | # the prototype file if you add/subtract files from the mix. | ||
170 | cp -p ../prototype . | ||
171 | cp -p ../preremove . | ||
172 | |||
173 | echo "Creating compile-dependent files from their prototypes" | ||
174 | $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 | ||
175 | $SED -e "s/%%PKGNAME%%/${PKGNAME}/g" -e "s/%%OSMINOR%%/${OSMINOR}/g" -e "s/%%OSVERSION%%/${OSVERSION}/g" <../checkinstall.in >./checkinstall | ||
176 | $SED -e "s|%%PIDDIR%%|${PIDDIR}|g" <../postinstall.in >./postinstall | ||
177 | $SED -e "s|%%PIDDIR%%|${PIDDIR}|g" <../sshd-initscript.in > etc/sshd-initscript | ||
178 | |||
179 | echo "Stripping binaries" | ||
180 | ${STRIP} bin/ssh | ||
181 | ${STRIP} bin/ssh-add | ||
182 | ${STRIP} bin/ssh-agent | ||
183 | ${STRIP} bin/ssh-keygen | ||
184 | ${STRIP} sbin/sshd | ||
185 | ${STRIP} bin/scp | ||
186 | |||
187 | echo "" | ||
188 | echo "Building Package" | ||
189 | |||
190 | cd ${BUILDDIR} | ||
191 | $PKGMK -o -r . -p ${PSTAMP} -d ${BUILDDIR} | ||
192 | |||
193 | if [ $? -gt 0 ]; then | ||
194 | echo "Error performing pkgmk--cannot continue." | ||
195 | exit 1 | ||
196 | fi | ||
197 | |||
198 | echo "" | ||
199 | echo "Translating Package Tree into Installable Image" | ||
200 | $PKGTRANS -s ${BUILDDIR} ${BUILDDIR}/${DESTFILE} OPENssh | ||
201 | |||
202 | if [ $? -gt 0 ]; then | ||
203 | echo "Error performing pkgtrans--cannot continue." | ||
204 | exit 1 | ||
205 | fi | ||
206 | |||
207 | echo "Done. Package is in ${BUILDDIR}/${DESTFILE} !" | ||
diff --git a/contrib/solaris/checkinstall.in b/contrib/solaris/checkinstall.in new file mode 100644 index 000000000..37571936a --- /dev/null +++ b/contrib/solaris/checkinstall.in | |||
@@ -0,0 +1,37 @@ | |||
1 | #!/bin/sh | ||
2 | echo "Checking SunOS revision..." | ||
3 | MINOR=`/bin/uname -r | /bin/cut -d "." -f 2` | ||
4 | if [ ${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 | ||
9 | fi | ||
10 | echo "\t...revision okay." | ||
11 | |||
12 | echo "Checking for existing SSH installation..." | ||
13 | if [ -f /etc/sshd_config -o -f /usr/local/etc/sshd_config ]; then | ||
14 | UPDATE=1 | ||
15 | fi | ||
16 | if [ -f /etc/ssh_host_key -o -f /usr/local/etc/ssh_host_key ]; then | ||
17 | UPDATE=1 | ||
18 | fi | ||
19 | |||
20 | if [ ${UPDATE} -eq 1 ]; then | ||
21 | echo "Performing an \"update\" installation of %%PKGNAME%%" | ||
22 | else | ||
23 | echo "Performing a \"fresh\" installation of %%PKGNAME%%" | ||
24 | fi | ||
25 | echo "" | ||
26 | |||
27 | # We derive these at install time in case the package is relocated. | ||
28 | CONFDIR="${BASEDIR}/etc" | ||
29 | DESTBIN="${BASEDIR}/bin" | ||
30 | |||
31 | # make parameters available to installation service, and | ||
32 | # so to any other packaging scripts | ||
33 | cat >$1 <<! | ||
34 | CONFDIR='$CONFDIR' | ||
35 | DESTBIN='$DESTBIN' | ||
36 | UPDATE='$UPDATE' | ||
37 | ! | ||
diff --git a/contrib/solaris/pkginfo.in b/contrib/solaris/pkginfo.in new file mode 100644 index 000000000..4953d7d8e --- /dev/null +++ b/contrib/solaris/pkginfo.in | |||
@@ -0,0 +1,17 @@ | |||
1 | CLASSES=none | ||
2 | BASEDIR="%%BASEDIR%%" | ||
3 | PATH=/sbin:/usr/sbin:/usr/bin:/usr/sadm/install/bin | ||
4 | OAMBASE=/usr/sadm/sysadm | ||
5 | PKG=%%PKGNAME%% | ||
6 | NAME="OpenSSH %%VERSION%% %%ARCH%%" | ||
7 | DESC="Secure Shell remote access utility; replaces telnet and rlogin/rsh. OpenBSD version ported to Solaris. Compiled on Solaris %%OSVERSION%%" | ||
8 | ARCH="%%ARCH%%" | ||
9 | VERSION="%%VERSION%%" | ||
10 | CATEGORY=utility,application | ||
11 | VENDOR="Software produced by OpenSSH Portability Team, http://www.openssh.com/portable.html" | ||
12 | EMAIL="OpenSSH Development List <openssh-unix-dev@mindrot.org>" | ||
13 | PKGINST=%%PKGNAME%% | ||
14 | PKGSAV=/var/sadm/pkg/%%PKGNAME%%/save | ||
15 | ISTATES="S s 1 2 3" | ||
16 | RSTATES="S s 1 2 3" | ||
17 | UPDATE=0 | ||
diff --git a/contrib/solaris/postinstall.in b/contrib/solaris/postinstall.in new file mode 100644 index 000000000..58d773f87 --- /dev/null +++ b/contrib/solaris/postinstall.in | |||
@@ -0,0 +1,198 @@ | |||
1 | # PostInstall script for OPENssh | ||
2 | INSTALLF="/usr/sbin/installf" | ||
3 | |||
4 | instbackup() { | ||
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 | |||
27 | echo "" | ||
28 | echo "Beginning postinstall script--this script should leave you with a" | ||
29 | echo "functional and operational configuration of OpenSSH." | ||
30 | echo "" | ||
31 | |||
32 | if [ ! "${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 | |||
50 | ### If no existing sshd_config and host key, then create | ||
51 | if [ ! -f "${CONFDIR}/ssh_host_key" ]; then | ||
52 | echo "Creating new RSA public/private host key pair for SSH-1." | ||
53 | $INSTALLF $PKGINST ${CONFDIR}/ssh_host_key | ||
54 | $INSTALLF $PKGINST ${CONFDIR}/ssh_host_key.pub | ||
55 | ### If there is *anything* there then leave it, otherwise look | ||
56 | ### in some reasonable alternate locations before giving up. | ||
57 | ### It's worth spending some extra time looking for the old one | ||
58 | ### to avoid a bunch of "host identification has changed" warnings. | ||
59 | ### Note that some old keys from the commercial SSH might not | ||
60 | ### be compatible, but we don't test for that. | ||
61 | if [ -f "${PKG_INSTALL_ROOT}/etc/ssh_host_key" ]; then | ||
62 | mv ${PKG_INSTALL_ROOT}/etc/ssh_host_key ${CONFDIR} | ||
63 | elif [ -f "${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_key" ]; then | ||
64 | mv ${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_key ${CONFDIR} | ||
65 | else | ||
66 | ${DESTBIN}/ssh-keygen -b 1024 -f ${CONFDIR}/ssh_host_key -N '' | ||
67 | fi | ||
68 | else | ||
69 | echo "Using existing RSA public/private host key pair for SSH-1." | ||
70 | fi | ||
71 | if [ ! -f "${CONFDIR}/ssh_host_dsa_key" ]; then | ||
72 | echo "Creating new DSA public/private host key pair for SSH-2." | ||
73 | $INSTALLF $PKGINST ${CONFDIR}/ssh_host_dsa_key | ||
74 | $INSTALLF $PKGINST ${CONFDIR}/ssh_host_dsa_key.pub | ||
75 | ### If there is *anything* there then leave it, otherwise look | ||
76 | ### in some reasonable alternate locations before giving up. | ||
77 | ### It's worth spending some extra time looking for the old one | ||
78 | ### to avoid a bunch of "host identification has changed" warnings. | ||
79 | ### Note that some old keys from the commercial SSH2 might not | ||
80 | ### be compatible, but we don't test for that. | ||
81 | if [ -f "${PKG_INSTALL_ROOT}/etc/ssh_host_dsa_key" ]; then | ||
82 | mv ${PKG_INSTALL_ROOT}/etc/ssh_host_dsa_key ${CONFDIR} | ||
83 | elif [ -f "${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_dsa_key" ]; then | ||
84 | mv ${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_dsa_key ${CONFDIR} | ||
85 | else | ||
86 | ${DESTBIN}/ssh-keygen -d -f ${CONFDIR}/ssh_host_dsa_key -N '' | ||
87 | fi | ||
88 | else | ||
89 | echo "Using existing DSA public/private host key pair for SSH-2." | ||
90 | fi | ||
91 | else | ||
92 | echo "Performing an \"update\" installation of OpenSSH." | ||
93 | ### Okay, this part *is* an update install...so we need to ensure | ||
94 | ### we don't overwrite any of the existing files. | ||
95 | |||
96 | ### Install init script and create symlinks | ||
97 | if [ ! -f ${PKG_INSTALL_ROOT}/etc/init.d/sshd ]; then | ||
98 | echo "Installing init script in ${PKG_INSTALL_ROOT}/etc/init.d/sshd" | ||
99 | $INSTALLF $PKGINST ${PKG_INSTALL_ROOT}/etc/init.d/sshd || exit 2 | ||
100 | cp -p ${CONFDIR}/sshd-initscript ${PKG_INSTALL_ROOT}/etc/init.d/sshd | ||
101 | chown root:root ${PKG_INSTALL_ROOT}/etc/init.d/sshd | ||
102 | chmod 500 ${PKG_INSTALL_ROOT}/etc/init.d/sshd | ||
103 | fi | ||
104 | if [ ! -r ${PKG_INSTALL_ROOT}/etc/rc2.d/S72local_sshd ]; then | ||
105 | $INSTALLF $PKGINST ${PKG_INSTALL_ROOT}/etc/rc2.d/S72local_sshd=/etc/init.d/sshd s || exit 2 | ||
106 | fi | ||
107 | if [ ! -r ${PKG_INSTALL_ROOT}/etc/rc2.d/K30local_sshd ]; then | ||
108 | $INSTALLF $PKGINST /etc/rc0.d/K30local_sshd=/etc/init.d/sshd s || exit 2 | ||
109 | fi | ||
110 | |||
111 | ### The initial package installation leaves default versions of | ||
112 | ### ssh_prng_cmds, ssh_config, and sshd_config in ${CONFDIR}. Now | ||
113 | ### we need to decide whether to install them. Since this is | ||
114 | ### an update install, we only install the new files if the old | ||
115 | ### files somehow don't exist. | ||
116 | NEWCONF=0 | ||
117 | if [ ! -r "${CONFDIR}/ssh_prng_cmds" ]; then | ||
118 | instbackup ${CONFDIR} ssh_prng_cmds | ||
119 | NEWCONF=1 | ||
120 | fi | ||
121 | if [ ! -r "${CONFDIR}/ssh_config" ]; then | ||
122 | instbackup ${CONFDIR} ssh_config | ||
123 | NEWCONF=1 | ||
124 | fi | ||
125 | if [ ! -r "${CONFDIR}/ssh_config" ]; then | ||
126 | instbackup ${CONFDIR} sshd_config | ||
127 | NEWCONF=1 | ||
128 | fi | ||
129 | if [ $NEWCONF -eq 0 ]; then | ||
130 | echo "Your existing SSH configuration files have not been altered." | ||
131 | else | ||
132 | echo "Your other existing SSH configuration files have not been altered." | ||
133 | fi | ||
134 | |||
135 | ### If no existing sshd_config and host key, then create | ||
136 | if [ ! -f "${CONFDIR}/ssh_host_key" ]; then | ||
137 | echo "Creating new RSA public/private host key pair for SSH-1." | ||
138 | $INSTALLF $PKGINST ${CONFDIR}/ssh_host_key | ||
139 | $INSTALLF $PKGINST ${CONFDIR}/ssh_host_key.pub | ||
140 | ### If there is *anything* there then leave it, otherwise look | ||
141 | ### in some reasonable alternate locations before giving up. | ||
142 | ### It's worth spending some extra time looking for the old one | ||
143 | ### to avoid a bunch of "host identification has changed" warnings. | ||
144 | ### Note that some old keys from the commercial SSH might not | ||
145 | ### be compatible, but we don't test for that. | ||
146 | if [ -f "${PKG_INSTALL_ROOT}/etc/ssh_host_key" ]; then | ||
147 | mv ${PKG_INSTALL_ROOT}/etc/ssh_host_key ${CONFDIR} | ||
148 | elif [ -f "${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_key" ]; then | ||
149 | mv ${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_key ${CONFDIR} | ||
150 | else | ||
151 | ${DESTBIN}/ssh-keygen -b 1024 -f ${CONFDIR}/ssh_host_key -N '' | ||
152 | fi | ||
153 | else | ||
154 | echo "Using existing RSA public/private host key pair for SSH-1." | ||
155 | fi | ||
156 | if [ ! -f "${CONFDIR}/ssh_host_dsa_key" ]; then | ||
157 | echo "Creating new DSA public/private host key pair for SSH-2." | ||
158 | $INSTALLF $PKGINST ${CONFDIR}/ssh_host_dsa_key | ||
159 | $INSTALLF $PKGINST ${CONFDIR}/ssh_host_dsa_key.pub | ||
160 | ### If there is *anything* there then leave it, otherwise look | ||
161 | ### in some reasonable alternate locations before giving up. | ||
162 | ### It's worth spending some extra time looking for the old one | ||
163 | ### to avoid a bunch of "host identification has changed" warnings. | ||
164 | ### Note that some old keys from the commercial SSH2 might not | ||
165 | ### be compatible, but we don't test for that. | ||
166 | if [ -f "${PKG_INSTALL_ROOT}/etc/ssh_host_dsa_key" ]; then | ||
167 | mv ${PKG_INSTALL_ROOT}/etc/ssh_host_dsa_key ${CONFDIR} | ||
168 | elif [ -f "${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_dsa_key" ]; then | ||
169 | mv ${PKG_INSTALL_ROOT}/usr/local/etc/ssh_host_dsa_key ${CONFDIR} | ||
170 | else | ||
171 | ${DESTBIN}/ssh-keygen -d -f ${CONFDIR}/ssh_host_dsa_key -N '' | ||
172 | fi | ||
173 | else | ||
174 | echo "Using existing DSA public/private host key pair for SSH-2." | ||
175 | fi | ||
176 | fi | ||
177 | |||
178 | if [ ! -d %%PIDDIR%% ]; then | ||
179 | $INSTALLF $PKGINST %%PIDDIR%% | ||
180 | mkdir -p %%PIDDIR%% | ||
181 | chown root:sys %%PIDDIR%% | ||
182 | chmod 755 %%PIDDIR%% | ||
183 | fi | ||
184 | |||
185 | $INSTALLF -f $PKGINST || exit 2 | ||
186 | |||
187 | if [ "X${PKG_INSTALL_ROOT}" = "X" ]; then | ||
188 | ### We're doing a local install, rather than an install for | ||
189 | ### old-style diskless clients. | ||
190 | echo "Stopping any current sshd process, and then starting the new sshd." | ||
191 | /etc/init.d/sshd stop | ||
192 | /etc/init.d/sshd start | ||
193 | else | ||
194 | echo "Not restarting sshd, since this appears to be a remote install" | ||
195 | echo "for support of diskless clients." | ||
196 | fi | ||
197 | |||
198 | exit 0 | ||
diff --git a/contrib/solaris/preremove b/contrib/solaris/preremove new file mode 100644 index 000000000..701c8c55b --- /dev/null +++ b/contrib/solaris/preremove | |||
@@ -0,0 +1,2 @@ | |||
1 | # pre-removal script for OPENssh | ||
2 | /etc/init.d/sshd stop | ||
diff --git a/contrib/solaris/prototype b/contrib/solaris/prototype new file mode 100644 index 000000000..02c4823de --- /dev/null +++ b/contrib/solaris/prototype | |||
@@ -0,0 +1,26 @@ | |||
1 | i pkginfo | ||
2 | i checkinstall | ||
3 | i postinstall | ||
4 | i preremove | ||
5 | d none man 0755 root sys | ||
6 | d none man/man1 0755 root sys | ||
7 | f none man/man1/scp.1 0644 root sys | ||
8 | f none man/man1/ssh-add.1 0644 root sys | ||
9 | f none man/man1/ssh-agent.1 0644 root sys | ||
10 | f none man/man1/ssh-keygen.1 0644 root sys | ||
11 | f none man/man1/ssh.1 0644 root sys | ||
12 | d none man/man8 0755 root sys | ||
13 | f none man/man8/sshd.8 0644 root sys | ||
14 | d none etc 0755 root sys | ||
15 | f none etc/sshd_config.default 0644 root sys | ||
16 | f none etc/ssh_config.default 0644 root sys | ||
17 | f none etc/ssh_prng_cmds.default 0644 root sys | ||
18 | f none etc/sshd-initscript 0755 root sys | ||
19 | d none bin 0755 root sys | ||
20 | f none bin/ssh-keygen 0755 root sys | ||
21 | f none bin/ssh 0755 root sys | ||
22 | f none bin/ssh-add 0755 root sys | ||
23 | f none bin/ssh-agent 0755 root sys | ||
24 | f none bin/scp 0755 root sys | ||
25 | d none sbin 0755 root sys | ||
26 | f none sbin/sshd 0755 root sys | ||
diff --git a/contrib/solaris/sshd-initscript.in b/contrib/solaris/sshd-initscript.in new file mode 100755 index 000000000..886a51fba --- /dev/null +++ b/contrib/solaris/sshd-initscript.in | |||
@@ -0,0 +1,50 @@ | |||
1 | #! /sbin/sh | ||
2 | |||
3 | # SSHd startup/shutdown script, based on uucp script. | ||
4 | |||
5 | PIDFILE="%%PIDDIR%%/sshd.pid" | ||
6 | PGREP="/usr/bin/pgrep" | ||
7 | HEAD="/usr/bin/head" | ||
8 | XARGS="/usr/bin/xargs" | ||
9 | KILL="/usr/bin/kill" | ||
10 | |||
11 | killproc() { | ||
12 | _procname=$1 | ||
13 | _signal=$2 | ||
14 | ${PGREP} ${_procname} | ${HEAD} -1 | ${XARGS} -t -I {} ${KILL} -${_signal} {} | ||
15 | } | ||
16 | |||
17 | case $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 | ;; | ||
50 | esac | ||