openssh.spec 7.6 KB

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