source: spec/trunk/SPECS/openssh.spec@ 1330

Last change on this file since 1330 was 203, checked in by Yuri Dario, 14 years ago

spec: added openssh build.

File size: 12.7 KB
Line 
1# Do we want SELinux & Audit
2%define WITH_SELINUX 0
3
4# OpenSSH privilege separation requires a user & group ID
5%define sshd_uid 74
6%define sshd_gid 74
7
8# Do we want to disable building of gnome-askpass? (1=yes 0=no)
9%define no_gnome_askpass 1
10
11# Do we want to link against a static libcrypto? (1=yes 0=no)
12%define static_libcrypto 0
13
14# Do we want smartcard support (1=yes 0=no)
15#Smartcard support is broken from 5.4p1
16%define scard 0
17
18# Use GTK2 instead of GNOME in gnome-ssh-askpass
19%define gtk2 0
20
21# Build position-independent executables (requires toolchain support)?
22%define pie 0
23
24# Do we want kerberos5 support (1=yes 0=no)
25%define kerberos5 0
26
27# Do we want libedit support
28%define libedit 0
29
30# Do we want NSS tokens support
31#NSS support is broken from 5.4p1
32%define nss 0
33
34# Whether or not /sbin/nologin exists.
35%define nologin 1
36
37# Whether to build pam_ssh_agent_auth
38%define pam_ssh_agent 0
39
40# Reserve options to override askpass settings with:
41# rpm -ba|--rebuild --define 'skip_xxx 1'
42%{?skip_gnome_askpass:%global no_gnome_askpass 1}
43
44# Add option to build without GTK2 for older platforms with only GTK+.
45# Red Hat Linux <= 7.2 and Red Hat Advanced Server 2.1 are examples.
46# rpm -ba|--rebuild --define 'no_gtk2 1'
47%{?no_gtk2:%global gtk2 0}
48
49# Options for static OpenSSL link:
50# rpm -ba|--rebuild --define "static_openssl 1"
51%{?static_openssl:%global static_libcrypto 1}
52
53# Options for Smartcard support: (needs libsectok and openssl-engine)
54# rpm -ba|--rebuild --define "smartcard 1"
55%{?smartcard:%global scard 1}
56
57# Is this a build for the rescue CD (without PAM, with MD5)? (1=yes 0=no)
58%define rescue 0
59%{?build_rescue:%global rescue 1}
60%{?build_rescue:%global rescue_rel rescue}
61
62# Turn off some stuff for resuce builds
63%if %{rescue}
64%define kerberos5 0
65%define libedit 0
66%define pam_ssh_agent 0
67%endif
68
69# Do not forget to bump pam_ssh_agent_auth release if you rewind the main package release to 1
70%define openssh_rel 1
71%define pam_ssh_agent_rel 24
72%define pam_ssh_agent_ver 0.9.2
73
74Summary: An open source implementation of SSH protocol versions 1 and 2
75Name: openssh
76Version: 5.9p1
77Release: %{openssh_rel}%{?dist}%{?rescue_rel}
78URL: http://www.openssh.com/portable.html
79
80Source0: ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-%{version}.tar.gz
81
82Patch1: openssh-os2.diff
83
84License: BSD
85Group: Applications/Internet
86BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
87%if %{nologin}
88#Requires: /sbin/nologin
89%endif
90
91#Requires: initscripts >= 5.20
92
93%if ! %{no_gnome_askpass}
94%if %{gtk2}
95BuildRequires: gtk2-devel
96BuildRequires: libX11-devel
97%else
98BuildRequires: gnome-libs-devel
99%endif
100%endif
101
102%if %{scard}
103BuildRequires: sharutils
104%endif
105BuildRequires: perl, zlib-devel
106#BuildRequires: audit-libs-devel
107#BuildRequires: util-linux, groff, man
108#BuildRequires: pam-devel
109#BuildRequires: tcp_wrappers-devel
110#BuildRequires: fipscheck-devel
111BuildRequires: openssl-devel >= 0.9.8j
112
113%if %{kerberos5}
114BuildRequires: krb5-devel
115%endif
116
117%if %{libedit}
118BuildRequires: libedit-devel ncurses-devel
119%endif
120
121%if %{nss}
122BuildRequires: nss-devel
123%endif
124
125%if %{WITH_SELINUX}
126Requires: libselinux >= 1.27.7
127BuildRequires: libselinux-devel >= 1.27.7
128Requires: audit-libs >= 1.0.8
129BuildRequires: audit-libs >= 1.0.8
130%endif
131
132#BuildRequires: xauth
133BuildRequires: curl-devel ncurses-devel
134
135%package clients
136Summary: An open source SSH client applications
137Requires: openssh = %{version}-%{release}
138Group: Applications/Internet
139
140%package server
141Summary: An open source SSH server daemon
142Group: System Environment/Daemons
143Requires: openssh = %{version}-%{release}
144Requires(post): chkconfig >= 0.9, /sbin/service
145Requires(pre): /usr/sbin/useradd
146Requires: pam >= 1.0.1-3
147
148%package askpass
149Summary: A passphrase dialog for OpenSSH and X
150Group: Applications/Internet
151Requires: openssh = %{version}-%{release}
152Obsoletes: openssh-askpass-gnome
153Provides: openssh-askpass-gnome
154
155%package -n pam_ssh_agent_auth
156Summary: PAM module for authentication with ssh-agent
157Group: System Environment/Base
158Version: %{pam_ssh_agent_ver}
159Release: %{pam_ssh_agent_rel}.%{openssh_rel}%{?dist}%{?rescue_rel}
160License: BSD
161
162%description
163SSH (Secure SHell) is a program for logging into and executing
164commands on a remote machine. SSH is intended to replace rlogin and
165rsh, and to provide secure encrypted communications between two
166untrusted hosts over an insecure network. X11 connections and
167arbitrary TCP/IP ports can also be forwarded over the secure channel.
168
169OpenSSH is OpenBSD's version of the last free version of SSH, bringing
170it up to date in terms of security and features.
171
172This package includes the core files necessary for both the OpenSSH
173client and server. To make this package useful, you should also
174install openssh-clients, openssh-server, or both.
175
176%description clients
177OpenSSH is a free version of SSH (Secure SHell), a program for logging
178into and executing commands on a remote machine. This package includes
179the clients necessary to make encrypted connections to SSH servers.
180
181%description server
182OpenSSH is a free version of SSH (Secure SHell), a program for logging
183into and executing commands on a remote machine. This package contains
184the secure shell daemon (sshd). The sshd daemon allows SSH clients to
185securely connect to your SSH server.
186
187%description askpass
188OpenSSH is a free version of SSH (Secure SHell), a program for logging
189into and executing commands on a remote machine. This package contains
190an X11 passphrase dialog for OpenSSH.
191
192%description -n pam_ssh_agent_auth
193This package contains a PAM module which can be used to authenticate
194users using ssh keys stored in a ssh-agent. Through the use of the
195forwarding of ssh-agent connection it also allows to authenticate with
196remote ssh-agent instance.
197
198The module is most useful for su and sudo service stacks.
199
200%prep
201%setup -q
202%patch1 -p1 -b .os2~
203
204
205%build
206export CONFIG_SHELL="/bin/sh"
207export LIBS="-lurpo -lpthread"
208
209%configure \
210 --sysconfdir=%{_sysconfdir}/ssh \
211 --libexecdir=%{_libexecdir}/openssh \
212 --datadir=%{_datadir}/openssh \
213 --with-pid-dir=%{_var}/run \
214 --with-default-path=/@unixroot/usr/local/bin:/@unixroot/bin:/@unixroot/usr/bin \
215 --with-superuser-path=/@unixroot/usr/local/sbin:/@unixroot/usr/local/bin:/@unixroot/sbin:/@unixroot/bin:/@unixroot/usr/sbin:/@unixroot/usr/bin \
216 --with-privsep-path=%{_var}/empty/sshd \
217 --disable-strip \
218 --without-zlib-version-check \
219 --with-ssl-engine \
220 --disable-utmp \
221 --disable-utmpx \
222 --disable-wtmp \
223 --disable-wtmpx \
224 --disable-libutil \
225 --disable-pututline \
226 --disable-pututxline \
227%if %{nss}
228 --with-nss \
229%endif
230%if %{scard}
231 --with-smartcard \
232%endif
233%if %{rescue}
234 --without-pam \
235%else
236 --without-pam \
237%endif
238%if %{WITH_SELINUX}
239 --with-selinux --with-linux-audit \
240%endif
241%if %{kerberos5}
242 --with-kerberos5${krb5_prefix:+=${krb5_prefix}} \
243%else
244 --without-kerberos5 \
245%endif
246%if %{libedit}
247 --with-libedit \
248%else
249 --without-libedit \
250%endif
251 "--cache-file=%{_topdir}/cache/%{name}-%{_target_cpu}.cache"
252
253%if %{static_libcrypto}
254perl -pi -e "s|-lcrypto|%{_libdir}/libcrypto.a|g" Makefile
255%endif
256
257make
258
259# Define a variable to toggle gnome1/gtk2 building. This is necessary
260# because RPM doesn't handle nested %if statements.
261%if %{gtk2}
262 gtk2=yes
263%else
264 gtk2=no
265%endif
266
267%if ! %{no_gnome_askpass}
268pushd contrib
269if [ $gtk2 = yes ] ; then
270 make gnome-ssh-askpass2
271 mv gnome-ssh-askpass2 gnome-ssh-askpass
272else
273 make gnome-ssh-askpass1
274 mv gnome-ssh-askpass1 gnome-ssh-askpass
275fi
276popd
277%endif
278
279%if %{pam_ssh_agent}
280pushd pam_ssh_agent_auth-%{pam_ssh_agent_ver}
281LDFLAGS="$SAVE_LDFLAGS"
282%configure --with-selinux --libexecdir=/%{_lib}/security
283make
284popd
285%endif
286
287# Add generation of HMAC checksums of the final stripped binaries
288%define __spec_install_post_000 \
289 %{?__debug_package:%{__debug_install_post}} \
290 %{__arch_install_post} \
291 %{__os_install_post} \
292 fipshmac $RPM_BUILD_ROOT%{_bindir}/ssh \
293 fipshmac $RPM_BUILD_ROOT%{_sbindir}/sshd \
294%{nil}
295
296%install
297rm -rf $RPM_BUILD_ROOT
298mkdir -p -m755 $RPM_BUILD_ROOT%{_sysconfdir}/ssh
299mkdir -p -m755 $RPM_BUILD_ROOT%{_libexecdir}/openssh
300mkdir -p -m755 $RPM_BUILD_ROOT%{_var}/empty/sshd
301make install DESTDIR=$RPM_BUILD_ROOT
302
303install -d $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/
304install -d $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d
305install -d $RPM_BUILD_ROOT%{_libexecdir}/openssh
306#install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/sshd
307#install -m755 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/sshd
308install -m755 contrib/ssh-copy-id $RPM_BUILD_ROOT%{_bindir}/
309mkdir -p -m755 $RPM_BUILD_ROOT%{_mandir}/man1
310install contrib/ssh-copy-id.1 $RPM_BUILD_ROOT%{_mandir}/man1/
311
312%if ! %{no_gnome_askpass}
313install -s contrib/gnome-ssh-askpass $RPM_BUILD_ROOT%{_libexecdir}/openssh/gnome-ssh-askpass
314%endif
315
316%if ! %{scard}
317 rm -f $RPM_BUILD_ROOT%{_datadir}/openssh/Ssh.bin
318%endif
319
320%if ! %{no_gnome_askpass}
321ln -s gnome-ssh-askpass $RPM_BUILD_ROOT%{_libexecdir}/openssh/ssh-askpass
322install -m 755 -d $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/
323install -m 755 contrib/redhat/gnome-ssh-askpass.csh $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/
324install -m 755 contrib/redhat/gnome-ssh-askpass.sh $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/
325%endif
326
327%if %{no_gnome_askpass}
328rm -f $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/gnome-ssh-askpass.*
329%endif
330
331sed -i -e "s|$RPM_BUILD_ROOT||g" $RPM_BUILD_ROOT%{_mandir}/man*/*
332
333rm -f README.nss.nss-keys
334%if ! %{nss}
335rm -f README.nss
336%endif
337
338%if %{pam_ssh_agent}
339pushd pam_ssh_agent_auth-%{pam_ssh_agent_ver}
340make install DESTDIR=$RPM_BUILD_ROOT
341popd
342%endif
343%clean
344rm -rf $RPM_BUILD_ROOT
345
346%pre server
347%if %{nologin}
348/usr/sbin/useradd -c "Privilege-separated SSH" -u %{sshd_uid} \
349 -s /sbin/nologin -r -d /var/empty/sshd sshd 2> /dev/null || :
350%else
351/usr/sbin/useradd -c "Privilege-separated SSH" -u %{sshd_uid} \
352 -s /dev/null -r -d /var/empty/sshd sshd 2> /dev/null || :
353%endif
354
355%post server
356/sbin/chkconfig --add sshd
357
358%postun server
359/sbin/service sshd condrestart > /dev/null 2>&1 || :
360
361%preun server
362if [ "$1" = 0 ]
363then
364 /sbin/service sshd stop > /dev/null 2>&1 || :
365 /sbin/chkconfig --del sshd
366fi
367
368%files
369%defattr(-,root,root)
370%doc CREDITS ChangeLog INSTALL LICENCE OVERVIEW PROTOCOL* README* TODO
371#WARNING*
372%attr(0755,root,root) %dir %{_sysconfdir}/ssh
373%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/ssh/moduli
374%if ! %{rescue}
375%attr(0755,root,root) %{_bindir}/ssh-keygen.exe
376%attr(0644,root,root) %{_mandir}/cat1/ssh-keygen.1*
377%attr(0755,root,root) %dir %{_libexecdir}/openssh
378%attr(4755,root,root) %{_libexecdir}/openssh/ssh-keysign.exe
379%attr(0644,root,root) %{_mandir}/cat8/ssh-keysign.8*
380%endif
381%if %{scard}
382%attr(0755,root,root) %dir %{_datadir}/openssh
383%attr(0644,root,root) %{_datadir}/openssh/Ssh.bin
384%endif
385
386%files clients
387%defattr(-,root,root)
388%attr(0755,root,root) %{_bindir}/ssh.exe
389#%attr(0644,root,root) %{_bindir}/.ssh.hmac
390%attr(0644,root,root) %{_mandir}/cat1/ssh.1*
391%attr(0755,root,root) %{_bindir}/scp.exe
392%attr(0644,root,root) %{_mandir}/cat1/scp.1*
393%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/ssh/ssh_config
394%attr(0755,root,root) %{_bindir}/slogin.exe
395%attr(0644,root,root) %{_mandir}/cat1/slogin.1*
396%attr(0644,root,root) %{_mandir}/cat5/ssh_config.5*
397%if ! %{rescue}
398%attr(2755,root,nobody) %{_bindir}/ssh-agent.exe
399%attr(0755,root,root) %{_bindir}/ssh-add.exe
400%attr(0755,root,root) %{_bindir}/ssh-keyscan.exe
401%attr(0755,root,root) %{_bindir}/sftp.exe
402%attr(0755,root,root) %{_bindir}/ssh-copy-id
403%attr(0755,root,root) %{_libexecdir}/openssh/ssh-pkcs11-helper.exe
404%attr(0644,root,root) %{_mandir}/cat1/ssh-agent.1*
405%attr(0644,root,root) %{_mandir}/cat1/ssh-add.1*
406%attr(0644,root,root) %{_mandir}/cat1/ssh-keyscan.1*
407%attr(0644,root,root) %{_mandir}/cat1/sftp.1*
408%attr(0644,root,root) %{_mandir}/man1/ssh-copy-id.1*
409%attr(0644,root,root) %{_mandir}/cat8/ssh-pkcs11-helper.8*
410%endif
411
412%if ! %{rescue}
413%files server
414%defattr(-,root,root)
415%dir %attr(0711,root,root) %{_var}/empty/sshd
416%attr(0755,root,root) %{_sbindir}/sshd.exe
417#%attr(0644,root,root) %{_sbindir}/.sshd.hmac
418%attr(0755,root,root) %{_libexecdir}/openssh/sftp-server.exe
419%attr(0644,root,root) %{_mandir}/cat5/sshd_config.5*
420%attr(0644,root,root) %{_mandir}/cat5/moduli.5*
421%attr(0644,root,root) %{_mandir}/cat8/sshd.8*
422%attr(0644,root,root) %{_mandir}/cat8/sftp-server.8*
423%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/ssh/sshd_config
424#%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/pam.d/sshd
425#%attr(0755,root,root) %{_sysconfdir}/rc.d/init.d/sshd
426%endif
427
428%if ! %{no_gnome_askpass}
429%files askpass
430%defattr(-,root,root)
431%attr(0644,root,root) %{_sysconfdir}/profile.d/gnome-ssh-askpass.*
432%attr(0755,root,root) %{_libexecdir}/openssh/gnome-ssh-askpass
433%attr(0755,root,root) %{_libexecdir}/openssh/ssh-askpass
434%endif
435
436%if %{pam_ssh_agent}
437%files -n pam_ssh_agent_auth
438%defattr(-,root,root)
439%doc pam_ssh_agent_auth-%{pam_ssh_agent_ver}/OPENSSH_LICENSE
440%attr(0755,root,root) /%{_lib}/security/pam_ssh_agent_auth.so
441%attr(0644,root,root) %{_mandir}/cat8/pam_ssh_agent_auth.8*
442%endif
443
444%changelog
Note: See TracBrowser for help on using the repository browser.