Add boost-devel dependency.
[shibboleth/cpp-sp.git] / shibboleth.spec.in
1 Name:           @PACKAGE_NAME@
2 Version:        @PACKAGE_VERSION@
3 Release:        1
4 Summary:        Open source system for attribute-based Web SSO
5 Group:          Productivity/Networking/Security
6 Vendor:         Internet2
7 License:        Apache 2.0
8 URL:            http://shibboleth.internet2.edu/
9 Source:         %{name}-sp-%{version}.tar.gz
10 BuildRoot:      %{_tmppath}/%{name}-%{version}-root
11 Requires:       openssl
12 PreReq:         xmltooling-schemas, opensaml-schemas
13 %if 0%{?suse_version} > 1030 && 0%{?suse_version} < 1130
14 PreReq:         %{insserv_prereq} %{fillup_prereq}
15 BuildRequires:  libXerces-c-devel >= 2.8.0
16 %else
17 BuildRequires:  libxerces-c-devel >= 2.8.0
18 %endif
19 BuildRequires:  libxml-security-c-devel >= 1.4.0
20 BuildRequires:  libxmltooling-devel >= 1.5
21 BuildRequires:  libsaml-devel >= 2.5
22 %{?_with_log4cpp:BuildRequires: liblog4cpp-devel >= 1.0}
23 %{!?_with_log4cpp:BuildRequires: liblog4shib-devel}
24 %if 0%{?rhel} >= 6 || 0%{?centos_version} >= 600
25 Requires:               libcurl-openssl >= 7.21.7
26 BuildRequires:  chrpath
27 %endif
28 BuildRequires:  gcc-c++, zlib-devel, boost-devel >= 1.32.0
29 %{!?_without_doxygen:BuildRequires: doxygen}
30 %{!?_without_odbc:BuildRequires:unixODBC-devel}
31 %{?_with_fastcgi:BuildRequires: fcgi-devel}
32 %if "%{_vendor}" == "redhat"
33 %{!?_without_builtinapache:BuildRequires: httpd-devel}
34 BuildRequires: redhat-rpm-config
35 Requires(pre): shadow-utils
36 Requires(post): chkconfig
37 Requires(preun): chkconfig, initscripts
38 %endif
39 %if "%{_vendor}" == "suse"
40 Requires(pre): pwdutils
41 %{!?_without_builtinapache:BuildRequires: apache2-devel}
42 %endif
43
44 %define runuser shibd
45 %if "%{_vendor}" == "suse"
46 %define pkgdocdir %{_docdir}/%{name}
47 %else
48 %define pkgdocdir %{_docdir}/%{name}-%{version}
49 %endif
50
51 %description
52 Shibboleth is a Web Single Sign-On implementations based on OpenSAML
53 that supports multiple protocols, federated identity, and the extensible
54 exchange of rich attributes subject to privacy controls.
55
56 This package contains the Shibboleth Service Provider runtime libraries,
57 daemon, default plugins, and Apache module(s).
58
59 %package devel
60 Summary:        Shibboleth Development Headers
61 Group:          Development/Libraries/C and C++
62 Requires:       %{name} = %{version}-%{release}
63 %if 0%{?suse_version} > 1030 && 0%{?suse_version} < 1130
64 Requires:       libXerces-c-devel >= 2.8.0
65 %else
66 Requires:       libxerces-c-devel >= 2.8.0
67 %endif
68 Requires:       libxml-security-c-devel >= 1.4.0
69 Requires:       libxmltooling-devel >= 1.5
70 Requires:       libsaml-devel >= 2.5
71 %{?_with_log4cpp:Requires: liblog4cpp-devel >= 1.0}
72 %{!?_with_log4cpp:Requires: liblog4shib-devel}
73
74 %description devel
75 Shibboleth is a Web Single Sign-On implementations based on OpenSAML
76 that supports multiple protocols, federated identity, and the extensible
77 exchange of rich attributes subject to privacy controls.
78
79 This package includes files needed for development with Shibboleth.
80
81 %prep
82 %setup -q
83
84 %build
85 %configure %{?_without_odbc:--disable-odbc} %{?_without_adfs:--disable-adfs} %{?_with_fastcgi} %{?_with_memcached} %{?shib_options}
86 %{__make} pkgdocdir=%{pkgdocdir}
87
88 %install
89 %{__make} install NOKEYGEN=1 DESTDIR=$RPM_BUILD_ROOT pkgdocdir=%{pkgdocdir}
90
91 %if "%{_vendor}" == "suse"
92         %{__sed} -i "s/\/var\/log\/httpd/\/var\/log\/apache2/g" \
93                 $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/native.logger
94 %endif
95
96 # Plug the SP into the built-in Apache on a recognized system.
97 touch rpm.filelist
98 APACHE_CONFIG="no"
99 if [ -f $RPM_BUILD_ROOT%{_libdir}/%{name}/mod_shib_13.so ] ; then
100         APACHE_CONFIG="apache.config"
101 fi
102 if [ -f $RPM_BUILD_ROOT%{_libdir}/%{name}/mod_shib_20.so ] ; then
103         APACHE_CONFIG="apache2.config"
104 fi
105 if [ -f $RPM_BUILD_ROOT%{_libdir}/%{name}/mod_shib_22.so ] ; then
106         APACHE_CONFIG="apache22.config"
107 fi
108 %{?_without_builtinapache:APACHE_CONFIG="no"}
109 if [ "$APACHE_CONFIG" != "no" ] ; then
110         APACHE_CONFD="no"
111         if [ -d %{_sysconfdir}/httpd/conf.d ] ; then
112                 APACHE_CONFD="%{_sysconfdir}/httpd/conf.d"
113         fi
114         if [ -d %{_sysconfdir}/apache2/conf.d ] ; then
115                 APACHE_CONFD="%{_sysconfdir}/apache2/conf.d"
116         fi
117         if [ "$APACHE_CONFD" != "no" ] ; then
118                 %{__mkdir} -p $RPM_BUILD_ROOT$APACHE_CONFD
119                 %{__cp} -p $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/$APACHE_CONFIG $RPM_BUILD_ROOT$APACHE_CONFD/shib.conf 
120                 echo "%config(noreplace) $APACHE_CONFD/shib.conf" >> rpm.filelist
121         fi
122 fi
123
124 # Establish location of sysconfig file, if any.
125 SYSCONFIG_SHIBD="no"
126 %if "%{_vendor}" == "redhat"
127         %{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
128         echo "%config(noreplace) %{_sysconfdir}/sysconfig/shibd" >> rpm.filelist
129         SYSCONFIG_SHIBD="$RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/shibd"
130 %endif
131 %if "%{_vendor}" == "suse"
132         %{__mkdir} -p $RPM_BUILD_ROOT%{_localstatedir}/adm/fillup-templates
133         echo "%{_localstatedir}/adm/fillup-templates/sysconfig.shibd" >> rpm.filelist
134         SYSCONFIG_SHIBD="$RPM_BUILD_ROOT%{_localstatedir}/adm/fillup-templates/sysconfig.shibd"
135 %endif
136 if [ "$SYSCONFIG_SHIBD" != "no" ] ; then
137         # Populate the sysconfig file.
138         cat > $SYSCONFIG_SHIBD <<EOF
139 # Shibboleth SP init script customization
140
141 # User account for shibd
142 SHIBD_USER=%{runuser}
143 EOF
144         %if 0%{?rhel} >= 6 || 0%{?centos_version} >= 600
145                 cat >> $SYSCONFIG_SHIBD <<EOF
146
147 # Override OS-supplied libcurl
148 export LD_LIBRARY_PATH=/opt/shibboleth/%{_lib}
149 EOF
150                 # Strip existing rpath to libcurl.
151                 chrpath -d $RPM_BUILD_ROOT%{_sbindir}/shibd
152                 chrpath -d $RPM_BUILD_ROOT%{_bindir}/mdquery
153                 chrpath -d $RPM_BUILD_ROOT%{_bindir}/resolvertest
154         %endif
155 fi
156
157 %if "%{_vendor}" == "redhat" || "%{_vendor}" == "suse"
158         # %{_initddir} not yet in RHEL5, use deprecated %{_initrddir}
159         install -d -m 0755 $RPM_BUILD_ROOT%{_initrddir}
160         install -m 0755 $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/shibd-%{_vendor} $RPM_BUILD_ROOT%{_initrddir}/shibd
161 %if "%{_vendor}" == "suse"
162         install -d -m 0755 $RPM_BUILD_ROOT/%{_sbindir}
163         %{__ln_s} -f %{_initrddir}/shibd $RPM_BUILD_ROOT%{_sbindir}/rcshibd
164 %endif
165 %endif
166
167 %check
168 %{__make} check
169
170 %clean
171 [ "$RPM_BUILD_ROOT" != "/" ] && %{__rm} -rf $RPM_BUILD_ROOT
172
173 %pre
174 getent group %{runuser} >/dev/null || groupadd -r %{runuser}
175 getent passwd %{runuser} >/dev/null || useradd -r -g %{runuser} \
176         -d  %{_localstatedir}/run/%{name} -s /sbin/nologin -c "Shibboleth SP daemon" %{runuser}
177 exit 0
178
179 %post
180 %ifnos solaris2.8 solaris2.9 solaris2.10
181 /sbin/ldconfig
182 %endif
183
184 # Key generation or ownership fix
185 cd %{_sysconfdir}/%{name}
186 if [ -f sp-key.pem ] ; then
187         %{__chown} %{runuser}:%{runuser} sp-key.pem sp-cert.pem 2>/dev/null || :
188 else
189         sh ./keygen.sh -b -u %{runuser} -g %{runuser}
190 fi
191
192 # Fix ownership of log files (even on new installs, if they're left from an older one).
193 %{__chown} %{runuser}:%{runuser} %{_localstatedir}/log/%{name}/* 2>/dev/null || :
194
195 %if "%{_vendor}" == "redhat"
196         if [ "$1" -gt "1" ] ; then
197                 # On Red Hat with shib.conf installed, clean up old Alias commands
198                 # by pointing them at new version-independent /usr/share/share tree.
199                 # Any Aliases we didn't create we assume are custom files.
200                 # This is to accomodate making shib.conf a noreplace config file.
201                 # We can't do this for SUSE, because they disallow changes to
202                 # packaged files in scriplets.
203                 APACHE_CONF="no"
204                 if [ -f %{_sysconfdir}/httpd/conf.d/shib.conf ] ; then
205                         APACHE_CONF="%{_sysconfdir}/httpd/conf.d/shib.conf"
206                 fi
207                 if [ "$APACHE_CONF" != "no" ] ; then
208                         %{__sed} -i "s/\/usr\/share\/doc\/shibboleth\(\-\(.\)\{1,\}\)\{0,1\}\/main\.css/\/usr\/share\/shibboleth\/main.css/g" \
209                                 $APACHE_CONF
210                         %{__sed} -i "s/\/usr\/share\/doc\/shibboleth\(\-\(.\)\{1,\}\)\{0,1\}\/logo\.jpg/\/usr\/share\/shibboleth\/logo.jpg/g" \
211                                 $APACHE_CONF
212                 fi
213         fi
214
215         # This adds the proper /etc/rc*.d links for the script
216         /sbin/chkconfig --add shibd
217
218         # On upgrade, restart components if they're already running.
219         # This gets repeated now down in %postun, and the next release
220         # should remove this copy. If we yank it now, we'll break upgrades.
221         if [ "$1" -gt "1" ] ; then
222                 /etc/init.d/shibd status 1>/dev/null && /etc/init.d/shibd restart 1>/dev/null
223                 %{!?_without_builtinapache:/etc/init.d/httpd status 1>/dev/null && /etc/init.d/httpd restart 1>/dev/null}
224                 exit 0
225         fi
226 %endif
227 %if "%{_vendor}" == "suse"
228         # This adds the proper /etc/rc*.d links for the script
229         # and populates the sysconfig/shibd file.
230         cd /
231         %{fillup_only -n shibd}
232         %insserv_force_if_yast shibd
233 %endif
234
235 %preun
236 # On final removal, stop shibd and remove service, restart Apache if running.
237 %if "%{_vendor}" == "redhat"
238         if [ "$1" -eq 0 ] ; then
239                 /sbin/service shibd stop >/dev/null 2>&1
240                 /sbin/chkconfig --del shibd
241                 %{!?_without_builtinapache:/etc/init.d/httpd status 1>/dev/null && /etc/init.d/httpd restart 1>/dev/null}
242         fi
243 %endif
244 %if "%{_vendor}" == "suse"
245         %stop_on_removal shibd
246         if [ "$1" -eq 0 ] ; then
247                 %{!?_without_builtinapache:/etc/init.d/apache2 status 1>/dev/null && /etc/init.d/apache2 restart 1>/dev/null}
248         fi
249 %endif
250 exit 0
251
252 %postun
253 %ifnos solaris2.8 solaris2.9 solaris2.10
254 /sbin/ldconfig
255 %endif
256 %if "%{_vendor}" == "redhat"
257         # On upgrade, restart components if they're already running.
258         if [ "$1" -ge "1" ] ; then
259                 /etc/init.d/shibd status 1>/dev/null && /etc/init.d/shibd restart 1>/dev/null
260                 %{!?_without_builtinapache:/etc/init.d/httpd status 1>/dev/null && /etc/init.d/httpd restart 1>/dev/null}
261                 exit 0
262         fi
263 %endif
264 %if "%{_vendor}" == "suse"
265         cd / 
266         %restart_on_update shibd
267         %{!?_without_builtinapache:%restart_on_update apache2}
268         %{insserv_cleanup}
269 %endif
270
271 %posttrans
272 # ugly hack if init script got removed during %postun by upgraded (buggy/2.1) package
273 %if "%{_vendor}" == "redhat"
274         if [ ! -f %{_initrddir}/shibd ] ; then
275                 if [ -f %{_sysconfdir}/%{name}/shibd-%{_vendor} ] ; then
276                         %{__cp} -p %{_sysconfdir}/%{name}/shibd-%{_vendor} %{_initrddir}/shibd
277                         %{__chmod} 755 %{_initrddir}/shibd
278                         /sbin/chkconfig --add shibd
279         fi
280 fi
281 %endif
282
283 %files -f rpm.filelist
284 %defattr(-,root,root,-)
285 %{_sbindir}/shibd
286 %{_bindir}/mdquery
287 %{_bindir}/resolvertest
288 %{_libdir}/libshibsp.so.*
289 %{_libdir}/libshibsp-lite.so.*
290 %dir %{_libdir}/%{name}
291 %{_libdir}/%{name}/*
292 %exclude %{_libdir}/%{name}/*.la
293 %attr(0750,%{runuser},%{runuser}) %dir %{_localstatedir}/log/%{name}
294 %attr(0755,%{runuser},%{runuser}) %dir %{_localstatedir}/run/%{name}
295 %dir %{_datadir}/xml/%{name}
296 %{_datadir}/xml/%{name}/*
297 %dir %{_datadir}/%{name}
298 %{_datadir}/%{name}/*
299 %dir %{_sysconfdir}/%{name}
300 %config(noreplace) %{_sysconfdir}/%{name}/*.xml
301 %config(noreplace) %{_sysconfdir}/%{name}/*.html
302 %config(noreplace) %{_sysconfdir}/%{name}/*.logger
303 %if "%{_vendor}" == "redhat" || "%{_vendor}" == "suse"
304 %config %{_initrddir}/shibd
305 %endif
306 %if "%{_vendor}" == "suse"
307 %{_sbindir}/rcshibd
308 %endif
309 %{_sysconfdir}/%{name}/*.dist
310 %{_sysconfdir}/%{name}/apache*.config
311 %{_sysconfdir}/%{name}/shibd-*
312 %attr(0755,root,root) %{_sysconfdir}/%{name}/keygen.sh
313 %attr(0755,root,root) %{_sysconfdir}/%{name}/metagen.sh
314 %{_sysconfdir}/%{name}/*.xsl
315 %doc %{pkgdocdir}
316 %exclude %{pkgdocdir}/api
317
318 %files devel
319 %defattr(-,root,root,-)
320 %{_includedir}/*
321 %{_libdir}/libshibsp.so
322 %{_libdir}/libshibsp-lite.so
323 %doc %{pkgdocdir}/api
324
325 %changelog
326 * Wed Dec 14 2011  Scott Cantor  <cantor.2@osu.edu>  - 2.5-1
327 - Move logo and stylesheet to version-independent tree
328 - Make shib.conf noreplace
329 - Post-fixup of Alias commands in older shib.conf
330 - Changes to run shibd as non-root shibboleth user
331 - Move init customizations to /etc/sysconfig/shibd
332 - Copy shibd restart for Red Hat to postun
333 - Add boost-devel dependency
334
335 * Sun Jun 26 2011  Scott Cantor  <cantor.2@osu.edu>  - 2.4.3-1
336 - Log files shouldn't be world readable.
337 - Explicit requirement for libcurl-openssl on RHEL6
338 - Uncomment LD_LIBRARY_PATH in init script for RHEL6 
339 - Remove rpath from binaries for RHEL6
340
341 * Fri Dec 25 2009  Scott Cantor  <cantor.2@osu.edu>  - 2.4-1
342 - Update dependencies.
343
344 * Mon Nov 23 2009 Scott Cantor  <cantor.2@osu.edu>  - 2.3.1-1
345 - Reset revision for 2.3.1 release
346
347 * Wed Aug 19 2009 Scott Cantor  <cantor.2@osu.edu>  - 2.2.1-2
348 - SuSE init script changes
349 - Restart Apache on removal, not just upgrade
350 - Fix scriptlet exit values when Apache is stopped
351
352 * Mon Aug 10 2009 Scott Cantor  <cantor.2@osu.edu>  - 2.2.1-1
353 - Doc handling changes
354 - SuSE init script
355
356 * Tue Aug 4 2009 Scott Cantor  <cantor.2@osu.edu>  - 2.2.1-1
357 - Initial version for 2.2.1, with shibd/httpd restart on upgrade
358
359 * Thu Jun 25 2009 Scott Cantor  <cantor.2@osu.edu>  - 2.2-3
360 - Add additional cleanup to posttrans fix
361
362 * Tue Jun 23 2009 Scott Cantor  <cantor.2@osu.edu>  - 2.2-2
363 - Reverse without_builtinapache macro test
364 - Fix init script handling on Red Hat to handle upgrades
365
366 * Wed Dec 3 2008  Scott Cantor  <cantor.2@osu.edu>  - 2.2-1
367 - Bump minor version.
368 - Make keygen.sh executable.
369 - Fixing SUSE Xerces dependency name.
370 - Optionally package shib.conf.
371
372 * Tue Jun 10 2008  Scott Cantor  <cantor.2@osu.edu>  - 2.1-1
373 - Change shib.conf handling to treat as config file.
374
375 * Mon Mar 17 2008  Scott Cantor  <cantor.2@osu.edu>  - 2.0-6
376 - Official release.
377
378 * Fri Jan 18 2008  Scott Cantor  <cantor.2@osu.edu>  - 2.0-5
379 - Release candidate 1.
380
381 * Sun Oct 21 2007 Scott Cantor  <cantor.2@osu.edu>  - 2.0-4
382 - libexec -> lib/shibboleth changes
383 - Added doc subpackage
384
385 * Thu Aug 16 2007 Scott Cantor  <cantor.2@osu.edu>  - 2.0-3
386 - First public beta.
387
388 * Fri Jul 13 2007 Scott Cantor  <cantor.2@osu.edu>  - 2.0-2
389 - Second alpha release.
390
391 * Sun Jun 10 2007 Scott Cantor  <cantor.2@osu.edu>  - 2.0-1
392 - First alpha release.
393
394 * Mon Oct 2 2006 Scott Cantor   <cantor.2@osu.edu>  - 1.3-11
395 - Applied fix for secadv 20061002
396 - Fix for metadata loader loop
397
398 * Wed Jun 15 2006 Scott Cantor  <cantor.2@osu.edu>  - 1.3-10
399 - Applied fix for sec 20060615
400
401 * Fri Apr 15 2006 Scott Cantor  <cantor.2@osu.edu>  - 1.3-9
402 - Misc. patches, SuSE, Apache 2.2, gcc 4.1, and 64-bit support
403
404 * Mon Jan 9 2006 Scott Cantor  <cantor.2@osu.edu>  - 1.3-8
405 - Applied new fix for secadv 20060109
406
407 * Tue Nov 8 2005 Scott Cantor  <cantor.2@osu.edu>  - 1.3-7
408 - Applied new fix for secadv 20050901 plus rollup
409
410 * Fri Sep 23 2005 Scott Cantor  <cantor.2@osu.edu>  - 1.3-6
411 - Minor patches and default config changes
412 - pidfile patch
413 - Fix shib.conf creation
414 - Integrated init.d script
415 - Prevent replacement of config files
416
417 * Thu Sep 1 2005  Scott Cantor  <cantor.2@osu.edu>  - 1.3-5
418 - Applied fix for secadv 20050901 plus rollup of NSAPI fixes
419
420 * Sun Apr 24 2005  Scott Cantor  <cantor.2@osu.edu>  - 1.3-1
421 - Updated test programs and location of schemas.
422 - move siterefresh to to sbindir
423
424 * Fri Apr  1 2005  Derek Atkins  <derek@ihtfp.com>  - 1.3-1
425 - Add selinux-targeted-policy package
426 - move shar to sbindir
427
428 * Tue Oct 19 2004  Derek Atkins  <derek@ihtfp.com>  - 1.2-1
429 - Create SPEC file based on various versions in existence.