18c7861
%{!?_httpd_apxs:       %{expand: %%global _httpd_apxs       %%{_sbindir}/apxs}}
18c7861
%{!?_httpd_mmn:        %{expand: %%global _httpd_mmn        %%(cat %{_includedir}/httpd/.mmn || echo missing-httpd-devel)}}
18c7861
%{!?_httpd_confdir:    %{expand: %%global _httpd_confdir    %%{_sysconfdir}/httpd/conf.d}}
18c7861
# /etc/httpd/conf.d with httpd < 2.4 and defined as /etc/httpd/conf.modules.d with httpd >= 2.4
18c7861
%{!?_httpd_modconfdir: %{expand: %%global _httpd_modconfdir %%{_sysconfdir}/httpd/conf.d}}
18c7861
%{!?_httpd_moddir:    %{expand: %%global _httpd_moddir    %%{_libdir}/httpd/modules}}
18c7861
1d51159
Name: mod_nss
ab58f3b
Version: 1.0.8
c0e3721
Release: 19.1%{?dist}
1d51159
Summary: SSL/TLS module for the Apache HTTP server
1d51159
Group: System Environment/Daemons
eb30dfb
License: ASL 2.0
a3ec3c2
URL: http://directory.fedoraproject.org/wiki/Mod_nss
a3ec3c2
Source: http://directory.fedoraproject.org/sources/%{name}-%{version}.tar.gz
1d51159
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
6a017c9
BuildRequires: nspr-devel >= 4.6.3, nss-devel >= 3.12.6
6a017c9
BuildRequires: httpd-devel, apr-devel, apr-util-devel
1d51159
BuildRequires: pkgconfig
18c7861
Requires: httpd-mmn = %{_httpd_mmn}
18c7861
Requires(post): httpd, nss-tools
6a017c9
Requires: nss >= 3.12.6
1d51159
Patch1: mod_nss-conf.patch
1d51159
Patch2: mod_nss-gencert.patch
ab58f3b
Patch3: mod_nss-wouldblock.patch
6a017c9
# Add options for tuning client negotiate in NSS
6a017c9
Patch4: mod_nss-negotiate.patch
37f57cd
Patch5: mod_nss-reverseproxy.patch
4658ec2
Patch6: mod_nss-pcachesignal.h
c191a5f
Patch7: mod_nss-reseterror.patch
2877b8e
Patch8: mod_nss-lockpcache.patch
f0160da
Patch9: mod_nss-httpd24.patch
be31bd1
Patch10: mod_nss-overlapping_memcpy.patch
1d51159
1d51159
%description
1d51159
The mod_nss module provides strong cryptography for the Apache Web
1d51159
server via the Secure Sockets Layer (SSL) and Transport Layer
1d51159
Security (TLS) protocols using the Network Security Services (NSS)
1d51159
security library.
1d51159
1d51159
%prep
1d51159
%setup -q
1d51159
%patch1 -p1 -b .conf
1d51159
%patch2 -p1 -b .gencert
ab58f3b
%patch3 -p1 -b .wouldblock
6a017c9
%patch4 -p1 -b .negotiate
37f57cd
%patch5 -p1 -b .reverseproxy
4658ec2
%patch6 -p1 -b .pcachesignal.h
c191a5f
%patch7 -p1 -b .reseterror
2877b8e
%patch8 -p1 -b .lockpcache
476c57d
%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
f0160da
%patch9 -p1 -b .httpd24
f0160da
%endif
be31bd1
%patch10 -p1 -b .overlap
1d51159
1d51159
# Touch expression parser sources to prevent regenerating it
1d51159
touch nss_expr_*.[chyl]
1d51159
1d51159
%build
1d51159
1d51159
CFLAGS="$RPM_OPT_FLAGS"
18c7861
APXS=%{_httpd_apxs}
18c7861
18c7861
export CFLAGS APXS
1d51159
1d51159
NSPR_INCLUDE_DIR=`/usr/bin/pkg-config --variable=includedir nspr`
1d51159
NSPR_LIB_DIR=`/usr/bin/pkg-config --variable=libdir nspr`
1d51159
1d51159
NSS_INCLUDE_DIR=`/usr/bin/pkg-config --variable=includedir nss`
1d51159
NSS_LIB_DIR=`/usr/bin/pkg-config --variable=libdir nss`
1d51159
1d51159
NSS_BIN=`/usr/bin/pkg-config --variable=exec_prefix nss`
1d51159
1d51159
%configure \
1d51159
    --with-nss-lib=$NSS_LIB_DIR \
1d51159
    --with-nss-inc=$NSS_INCLUDE_DIR \
1d51159
    --with-nspr-lib=$NSPR_LIB_DIR \
1d51159
    --with-nspr-inc=$NSPR_INCLUDE_DIR \
1150597
    --with-apr-config
1d51159
1d51159
make %{?_smp_mflags} all
1d51159
1d51159
%install
1d51159
# The install target of the Makefile isn't used because that uses apxs
1d51159
# which tries to enable the module in the build host httpd instead of in
1d51159
# the build root.
1d51159
rm -rf $RPM_BUILD_ROOT
1d51159
1d51159
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf
18c7861
mkdir -p $RPM_BUILD_ROOT%{_httpd_confdir}
1d51159
mkdir -p $RPM_BUILD_ROOT%{_libdir}/httpd/modules
1d51159
mkdir -p $RPM_BUILD_ROOT%{_sbindir}
1d51159
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/httpd/alias
1d51159
18c7861
%if "%{_httpd_modconfdir}" != "%{_httpd_confdir}"
18c7861
# httpd >= 2.4.x
18c7861
mkdir -p $RPM_BUILD_ROOT%{_httpd_modconfdir}
18c7861
sed -n /^LoadModule/p nss.conf > 10-nss.conf
18c7861
sed -i /^LoadModule/d nss.conf
18c7861
install -m 644 10-nss.conf $RPM_BUILD_ROOT%{_httpd_modconfdir}
18c7861
%endif
18c7861
18c7861
install -m 644 nss.conf $RPM_BUILD_ROOT%{_httpd_confdir}
18c7861
1d51159
install -m 755 .libs/libmodnss.so $RPM_BUILD_ROOT%{_libdir}/httpd/modules/
1d51159
install -m 755 nss_pcache $RPM_BUILD_ROOT%{_sbindir}/
1d51159
install -m 755 gencert $RPM_BUILD_ROOT%{_sbindir}/
6a017c9
ln -s ../../../%{_libdir}/libnssckbi.so $RPM_BUILD_ROOT%{_sysconfdir}/httpd/alias/
450756e
touch $RPM_BUILD_ROOT%{_sysconfdir}/httpd/alias/secmod.db
450756e
touch $RPM_BUILD_ROOT%{_sysconfdir}/httpd/alias/cert8.db
450756e
touch $RPM_BUILD_ROOT%{_sysconfdir}/httpd/alias/key3.db
450756e
touch $RPM_BUILD_ROOT%{_sysconfdir}/httpd/alias/install.log
1d51159
1d51159
perl -pi -e "s:$NSS_LIB_DIR:$NSS_BIN:" $RPM_BUILD_ROOT%{_sbindir}/gencert
1d51159
1d51159
%clean
1d51159
rm -rf $RPM_BUILD_ROOT
1d51159
1d51159
%post
1d51159
umask 077
1d51159
1d51159
if [ "$1" -eq 1 ] ; then
450756e
    if [ ! -e %{_sysconfdir}/httpd/alias/key3.db ]; then
1d51159
        %{_sbindir}/gencert %{_sysconfdir}/httpd/alias > %{_sysconfdir}/httpd/alias/install.log 2>&1
1d51159
        echo ""
1d51159
        echo "%{name} certificate database generated."
1d51159
        echo ""
1d51159
    fi
e03f3fe
e03f3fe
    # Make sure that the database ownership is setup properly.
6a017c9
    /bin/find %{_sysconfdir}/httpd/alias -user root -name "*.db" -exec /bin/chgrp apache {} \;
6a017c9
    /bin/find %{_sysconfdir}/httpd/alias -user root -name "*.db" -exec /bin/chmod g+r {} \;
1d51159
fi
1d51159
1d51159
%files
1d51159
%defattr(-,root,root,-)
1d51159
%doc README LICENSE docs/mod_nss.html
18c7861
%config(noreplace) %{_httpd_confdir}/nss.conf
18c7861
%if "%{_httpd_modconfdir}" != "%{_httpd_confdir}"
18c7861
%config(noreplace) %{_httpd_modconfdir}/10-nss.conf
18c7861
%endif
1d51159
%{_libdir}/httpd/modules/libmodnss.so
1d51159
%dir %{_sysconfdir}/httpd/alias/
e03f3fe
%ghost %attr(0640,root,apache) %config(noreplace) %{_sysconfdir}/httpd/alias/secmod.db
e03f3fe
%ghost %attr(0640,root,apache) %config(noreplace) %{_sysconfdir}/httpd/alias/cert8.db
e03f3fe
%ghost %attr(0640,root,apache) %config(noreplace) %{_sysconfdir}/httpd/alias/key3.db
450756e
%ghost %config(noreplace) %{_sysconfdir}/httpd/alias/install.log
1d51159
%{_sysconfdir}/httpd/alias/libnssckbi.so
1d51159
%{_sbindir}/nss_pcache
1d51159
%{_sbindir}/gencert
1d51159
1d51159
%changelog
c0e3721
* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.8-19.1
c0e3721
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
c0e3721
476c57d
* Mon Jun 18 2012 Joe Orton <jorton@redhat.com> - 1.0.8-18.1
476c57d
- fix build for RHEL7
476c57d
be31bd1
* Fri Jun 15 2012 Rob Crittenden <rcritten@redhat.com> - 1.0.8-18
be31bd1
- Actually apply the patch to use memmove in place of memcpy since the
be31bd1
  buffers can overlap (#669118)
be31bd1
f0160da
* Tue Jun 12 2012 Nathan Kinder <nkinder@redhat.com> - 1.0.8-17
f0160da
- Port mod_nss to work with httpd 2.4
f0160da
18c7861
* Mon Apr 23 2012 Joe Orton <jorton@redhat.com> - 1.0.8-16
18c7861
- packaging fixes/updates (#803072)
18c7861
3717a76
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.8-15
3717a76
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
3717a76
7a3225a
* Wed Mar  7 2011 Rob Crittenden <rcritten@redhat.com> - 1.0.8-14
7a3225a
- Add Requires(post) for nss-tools, gencert needs it (#652007)
7a3225a
2877b8e
* Wed Mar  2 2011 Rob Crittenden <rcritten@redhat.com> - 1.0.8-13
2877b8e
- Lock around the pipe to nss_pcache for retrieving the token PIN
2877b8e
  (#677701)
2877b8e
a027bee
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.8-12
a027bee
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
a027bee
7884b1d
* Wed Jan 12 2011 Rob Crittenden <rcritten@redhat.com> - 1.0.8-11
7884b1d
- Use memmove in place of memcpy since the buffers can overlap (#669118)
7884b1d
Jesse Keating b83f9ae
* Wed Sep 29 2010 jkeating - 1.0.8-10
Jesse Keating b83f9ae
- Rebuilt for gcc bug 634757
Jesse Keating b83f9ae
c191a5f
* Thu Sep 23 2010 Rob Crittenden <rcritten@redhat.com> - 1.0.8-9
c191a5f
- Revert mod_nss-wouldblock patch
c191a5f
- Reset NSPR error before calling PR_Read(). This should fix looping
c191a5f
  in #620856
c191a5f
8c652c6
* Fri Sep 17 2010 Rob Crittenden <rcritten@redhat.com> - 1.0.8-8
8c652c6
- Fix hang when handling large POST under some conditions (#620856)
8c652c6
1563eb1
* Tue Jun 22 2010 Rob Crittenden <rcritten@redhat.com> - 1.0.8-7
1563eb1
- Remove file Requires on libnssckbi.so (#601939)
1563eb1
4658ec2
* Fri May 14 2010 Rob Crittenden <rcritten@redhat.com> - 1.0.8-6
4658ec2
- Ignore SIGHUP in nss_pcache (#591889).
4658ec2
37f57cd
* Thu May 13 2010 Rob Crittenden <rcritten@redhat.com> - 1.0.8-5
37f57cd
- Use remote hostname set by mod_proxy to compare to CN in peer cert (#591224)
37f57cd
6a017c9
* Thu Mar 18 2010 Rob Crittenden <rcritten@redhat.com> - 1.0.8-4
6a017c9
- Patch to add configuration options for new NSS negotiation API (#574187)
6a017c9
- Add (pre) for Requires on httpd so we can be sure the user and group are
6a017c9
  already available
6a017c9
- Add file Requires on libnssckbi.so so symlink can't fail
6a017c9
- Use _sysconfdir macro instead of /etc
6a017c9
- Set minimum level of NSS to 3.12.6
6a017c9
6a017c9
* Mon Jan 25 2010 Rob Crittenden <rcritten@redhat.com> - 1.0.8-3
6a017c9
- The location of libnssckbi moved from /lib[64] to /usr/lib[64] (556744)
6a017c9
83b11db
* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.8-2
83b11db
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
83b11db
ab58f3b
* Mon Mar  2 2009 Rob Crittenden <rcritten@redhat.com> - 1.0.8-1
ab58f3b
- Update to 1.0.8
ab58f3b
- Add patch that fixes NSPR layer bug
ab58f3b
27f1634
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.7-11
27f1634
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
27f1634
eb30dfb
* Mon Aug 11 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 1.0.7-10
eb30dfb
- fix license tag
eb30dfb
e821ee0
* Mon Jul 28 2008 Rob Crittenden <rcritten@redhat.com> - 1.0.7-9
e821ee0
- rebuild to bump NVR
e821ee0
73247ca
* Mon Jul 14 2008 Rob Crittenden <rcritten@redhat.com> - 1.0.7-8
73247ca
- Don't force module de-init during the configuration stage (453508)
73247ca
73247ca
* Thu Jul 10 2008 Rob Crittenden <rcritten@redhat.com> - 1.0.7-7
73247ca
- Don't inherit the MP cache in multi-threaded mode (454701)
73247ca
- Don't initialize NSS in each child if SSL isn't configured
73247ca
541e194
* Wed Jul  2 2008 Rob Crittenden <rcritten@redhat.com> - 1.0.7-6
541e194
- Update the patch for FIPS to include fixes for nss_pcache, enforce
541e194
  the security policy and properly initialize the FIPS token.
541e194
ba1b066
* Mon Jun 30 2008 Rob Crittenden <rcritten@redhat.com> - 1.0.7-5
ba1b066
- Include patch to fix NSSFIPS (446851)
ba1b066
e03f3fe
* Mon Apr 28 2008 Rob Crittenden <rcritten@redhat.com> - 1.0.7-4
e03f3fe
- Apply patch so that mod_nss calls NSS_Init() after Apache forks a child
e03f3fe
  and not before. This is in response to a change in the NSS softtokn code
e03f3fe
  and should have always been done this way. (444348)
e03f3fe
- The location of libnssckbi moved from /usr/lib[64] to /lib[64]
e03f3fe
- The NSS database needs to be readable by apache since we need to use it
e03f3fe
  after the root priviledges are dropped.
e03f3fe
818134b
* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 1.0.7-3
818134b
- Autorebuild for GCC 4.3
818134b
b0b7ced
* Thu Oct 18 2007 Rob Crittenden <rcritten@redhat.com> 1.0.7-2
b0b7ced
- Register functions needed by mod_proxy if mod_ssl is not loaded.
b0b7ced
a3ec3c2
* Fri Jun  1 2007 Rob Crittenden <rcritten@redhat.com> 1.0.7-1
a3ec3c2
- Update to 1.0.7
a3ec3c2
- Remove Requires for nss and nspr since those are handled automatically
a3ec3c2
  by versioned libraries
a3ec3c2
- Updated URL and Source to reference directory.fedoraproject.org
a3ec3c2
1150597
* Mon Apr  9 2007 Rob Crittenden <rcritten@redhat.com> 1.0.6-2
1150597
- Patch to properly detect the Apache model and set up NSS appropriately
1150597
- Patch to punt if a bad password is encountered
1150597
- Patch to fix crash when password.conf is malformatted
1150597
- Don't enable ECC support as NSS doesn't have it enabled (3.11.4-0.7)
1150597
c13df6e
* Mon Oct 23 2006 Rob Crittenden <rcritten@redhat.com> 1.0.6-1
c13df6e
- Update to 1.0.6
39a6bb3
450756e
* Fri Aug 04 2006 Rob Crittenden <rcritten@redhat.com> 1.0.3-4
450756e
- Include LogLevel warn in nss.conf and use separate log files
450756e
450756e
* Fri Aug 04 2006 Rob Crittenden <rcritten@redhat.com> 1.0.3-3
450756e
- Need to initialize ECC certificate and key variables
450756e
450756e
* Fri Aug 04 2006 Jarod Wilson <jwilson@redhat.com> 1.0.3-2
450756e
- Use %%ghost for db files and install.log
450756e
1d51159
* Tue Jun 20 2006 Rob Crittenden <rcritten@redhat.com> 1.0.3-1
1d51159
- Initial build