openssh.spec 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. ##
  2. ## openssh.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2002 Cable & Wireless Deutschland GmbH
  4. ## Copyright (c) 2000-2002 The OpenPKG Project <http://www.openpkg.org/>
  5. ## Copyright (c) 2000-2002 Ralf S. Engelschall <rse@engelschall.com>
  6. ##
  7. ## Permission to use, copy, modify, and distribute this software for
  8. ## any purpose with or without fee is hereby granted, provided that
  9. ## the above copyright notice and this permission notice appear in all
  10. ## copies.
  11. ##
  12. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  13. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  15. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  16. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  18. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  19. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  20. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  21. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23. ## SUCH DAMAGE.
  24. ##
  25. %define with_pam yes
  26. %define with_pcre no
  27. %define with_skey no
  28. # package information
  29. Name: openssh
  30. Summary: Secure Shell (SSH)
  31. URL: http://www.openssh.com/
  32. Vendor: The OpenBSD Project
  33. Packager: The OpenPKG Project
  34. Distribution: OpenPKG [REL]
  35. Group: Cryptography
  36. License: BSD
  37. Version: 3.1p1
  38. Release: 20020311
  39. # list of sources
  40. Source0: ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-%{version}.tar.gz
  41. Source1: fakesyslog.tar.gz
  42. Source2: rc.openssh
  43. Source3: sshd_config
  44. Source4: ssh_config
  45. Source5: ssh-askpass
  46. # build information
  47. Prefix: %{l_prefix}
  48. BuildRoot: %{l_buildroot}
  49. BuildPreReq: OpenPKG, openpkg >= 20020206, perl, openssl, zlib
  50. %if "%{with_pam}" == "yes"
  51. BuildPreReq: PAM
  52. %endif
  53. %if "%{with_pcre}" == "yes"
  54. BuildPreReq: pcre
  55. %endif
  56. %if "%{with_skey}" == "yes"
  57. BuildPreReq: skey
  58. %endif
  59. PreReq: OpenPKG, openpkg >= 20020206
  60. AutoReq: no
  61. AutoReqProv: no
  62. %description
  63. Secure Shell (SSH) is a facility for logging into a remote machine
  64. and for remotely executing commands on a remote machine. It is
  65. intended to replace rlogin(1) and rsh(1), and provide secure
  66. encrypted communications between two untrusted hosts over an
  67. insecure network. X11 connections and arbitrary TCP/IP ports can
  68. also be forwarded over the secure channel. OpenSSH is OpenBSD's
  69. rework of the last free version of SSH, bringing it up to date in
  70. terms of security and features, as well as removing all patented
  71. algorithms to separate libraries (OpenSSL).
  72. Options: with_pam=%{with_pam}, with_pcre=%{with_pcre}, with_skey=%{with_skey}
  73. %prep
  74. %setup0 -q -c -a 0
  75. %setup1 -q -T -D -a 1
  76. %build
  77. # build faked syslog(3) library
  78. fakesyslogdir="`pwd`/fakesyslog"
  79. ( cd fakesyslog
  80. CC="%{l_cc}" \
  81. CFLAGS="%{l_cflags -O}" \
  82. ./configure \
  83. --with-logfile=%{l_prefix}/var/openssh/sshd.log
  84. %{l_make} %{l_mflags}
  85. )
  86. # build OpenSSH
  87. ( cd openssh-%{version}
  88. inc="-I%{l_prefix}/include"
  89. lib="-L%{l_prefix}/lib -L$fakesyslogdir"
  90. %if "%{with_pam}" == "yes"
  91. inc="$inc -I`%{l_prefix}/etc/rc --query pam_incdir`"
  92. lib="$lib -L`%{l_prefix}/etc/rc --query pam_libdir`"
  93. %endif
  94. CC="%{l_cc}" \
  95. CFLAGS="%{l_cflags -O} $inc" \
  96. CPPFLAGS="$inc" \
  97. LDFLAGS="$lib" \
  98. LIBS="-lcrypt -lfakesyslog" \
  99. ./configure \
  100. --prefix=%{l_prefix} \
  101. --sbindir=%{l_prefix}/bin \
  102. --mandir=%{l_prefix}/man \
  103. --infodir=%{l_prefix}/info \
  104. --sysconfdir=%{l_prefix}/etc/openssh \
  105. --libexecdir=%{l_prefix}/libexec/openssh \
  106. --localstatedir=%{l_prefix}/var/openssh \
  107. --with-pid-dir=%{l_prefix}/var/openssh \
  108. --with-ssl-dir=%{l_prefix} \
  109. %if "%{with_pcre}" == "yes"
  110. --with-pcre=%{l_prefix} \
  111. %endif
  112. %if "%{with_skey}" == "yes"
  113. --with-skey=%{l_prefix} \
  114. %endif
  115. %if "%{with_pam}" == "yes"
  116. --with-pam \
  117. %else
  118. --without-pam \
  119. %endif
  120. --with-md5-passwords \
  121. --with-zlib=%{l_prefix} \
  122. --with-ipv4-default \
  123. --without-smartcard \
  124. --without-kerberos4 \
  125. --disable-suid-ssh \
  126. --without-rsh \
  127. --with-mantype=man \
  128. --with-default-path=%{l_prefix}/bin:/bin:/usr/bin:/usr/local/bin
  129. # build package
  130. %{l_make} %{l_mflags -O}
  131. )
  132. %install
  133. rm -rf $RPM_BUILD_ROOT
  134. # perform standard installation procedure of OpenSSH
  135. ( cd openssh-%{version}
  136. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  137. )
  138. # strip down installation tree
  139. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share
  140. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/slogin
  141. rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/slogin.1
  142. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2> /dev/null || true
  143. strip $RPM_BUILD_ROOT%{l_prefix}/libexec/openssh/* 2> /dev/null || true
  144. # install ssh-askpass wrapper
  145. %{l_shtool} install -c -m 755 -e 's;@l_prefix@;%{l_prefix};g' \
  146. %{SOURCE ssh-askpass} $RPM_BUILD_ROOT%{l_prefix}/libexec/openssh/
  147. # make sure the state directory exists
  148. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/var/openssh
  149. # install run-command script
  150. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  151. %{l_shtool} install -c -m 755 -e 's;@l_prefix@;%{l_prefix};g' \
  152. -e 's;@l_musr@;%{l_musr};g' -e 's;@l_mgrp@;%{l_mgrp};g' \
  153. %{SOURCE rc.openssh} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  154. # install reasonable ssh server and client configuration files
  155. case "%{l_target}" in
  156. *-freebsd* ) uselogin=yes; printmotd=no ;;
  157. *-linux* ) uselogin=yes; printmotd=no ;;
  158. *-solaris* ) uselogin=no; printmotd=yes ;; # "uselogin" does not work on Solaris!
  159. esac
  160. %{l_shtool} install -c -m 644 \
  161. -e 's;@l_prefix@;%{l_prefix};g' \
  162. -e "s;@uselogin@;$uselogin;" \
  163. -e "s;@printmotd@;$printmotd;" \
  164. %{SOURCE sshd_config} $RPM_BUILD_ROOT%{l_prefix}/etc/openssh/
  165. %{l_shtool} install -c -m 644 -e 's;@l_prefix@;%{l_prefix};g' \
  166. %{SOURCE ssh_config} $RPM_BUILD_ROOT%{l_prefix}/etc/openssh/
  167. # determine installation files
  168. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  169. %{l_files_std} \
  170. '%config %{l_prefix}/etc/openssh/*'
  171. %files -f files
  172. %clean
  173. rm -rf $RPM_BUILD_ROOT
  174. %post
  175. # generate server RSA key
  176. if [ ! -f "$RPM_INSTALL_PREFIX/etc/openssh/ssh_host_key" -o \
  177. ! -s "$RPM_INSTALL_PREFIX/etc/openssh/ssh_host_key" ] ; then
  178. $RPM_INSTALL_PREFIX/bin/ssh-keygen -t rsa1 -b 1024 \
  179. -f $RPM_INSTALL_PREFIX/etc/openssh/ssh_host_key \
  180. -N '' -C `hostname` 1>&2
  181. fi
  182. # generate server DSA key
  183. if [ ! -f "$RPM_INSTALL_PREFIX/etc/openssh/ssh_host_dsa_key" -o \
  184. ! -s "$RPM_INSTALL_PREFIX/etc/openssh/ssh_host_dsa_key" ] ; then
  185. $RPM_INSTALL_PREFIX/bin/ssh-keygen -t dsa -d \
  186. -f $RPM_INSTALL_PREFIX/etc/openssh/ssh_host_dsa_key \
  187. -N '' -C `hostname` 1>&2
  188. fi
  189. # add PAM configuration entry
  190. $RPM_INSTALL_PREFIX/sbin/pamtool -a -s -n "openssh"
  191. %preun
  192. # remove PAM configuration entry
  193. $RPM_INSTALL_PREFIX/sbin/pamtool -r -s -n "openssh"