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