7328c7
#global prever rc1
b4a3df
# Rebuild configure.ac if patches do change it
b4a3df
%global rebuild_ac 1
7328c7
7328c7
Summary: Software version of a PKCS#11 Hardware Security Module
7328c7
Name: softhsm
1f4084
Version: 2.6.0
b4a3df
Release: %{?prever:0.}5%{?prever:.%{prever}}%{?dist}
7328c7
License: BSD
7328c7
Url: http://www.opendnssec.org/
7328c7
Source: http://dist.opendnssec.org/source/%{?prever:testing/}%{name}-%{version}.tar.gz
7328c7
Source1: http://dist.opendnssec.org/source/%{?prever:testing/}%{name}-%{version}.tar.gz.sig
7328c7
1f4084
Patch1: softhsm-2.6.1-rh1834909-exit.patch
b4a3df
Patch2: softhsm-2.6.1-rh1857272-negatives.patch
7328c7
7328c7
Group: Applications/System
7328c7
BuildRequires: openssl-devel >= 1.0.1k-6, sqlite-devel >= 3.4.2, cppunit-devel
7328c7
BuildRequires: gcc-c++, pkgconfig, p11-kit-devel, nss-devel
7328c7
7328c7
Requires(pre): shadow-utils
7328c7
Requires: p11-kit, nss-tools
7328c7
Requires: openssl-libs >= 1.0.1k-6
7328c7
7328c7
%global _hardened_build 1
7328c7
7328c7
%global softhsm_module "SoftHSM PKCS #11 Module"
7328c7
7328c7
%description
7328c7
OpenDNSSEC is providing a software implementation of a generic
7328c7
cryptographic device with a PKCS#11 interface, the SoftHSM. SoftHSM is
7328c7
designed to meet the requirements of OpenDNSSEC, but can also work together
7328c7
with other cryptographic products because of the PKCS#11 interface.
7328c7
7328c7
%package devel
7328c7
Summary: Development package of softhsm that includes the header files
7328c7
Group: Development/Libraries
7328c7
Requires: %{name} = %{version}-%{release}, openssl-devel, sqlite-devel
b4a3df
#if 0%{?prever:1}
7328c7
BuildRequires: autoconf, libtool, automake
b4a3df
#endif
7328c7
7328c7
%description devel
7328c7
The devel package contains the libsofthsm include files
7328c7
7328c7
%prep
7328c7
%setup -q -n %{name}-%{version}%{?prever}
7328c7
%patch1 -p1
b4a3df
%patch2 -p1
7328c7
7328c7
# remove softhsm/ subdir auto-added to --libdir
7328c7
sed -i "s:full_libdir/softhsm:full_libdir:g" configure
b4a3df
%if 0%{?prever:1} || 0%{?rebuild_ac}
7328c7
sed -i 's:^full_libdir=":#full_libdir=":g' configure.ac
7328c7
%endif
7328c7
sed -i "s:libdir)/@PACKAGE@:libdir):" Makefile.in
7328c7
1f4084
sed -i 's:$full_libdir/libsofthsm2\.so:libsofthsm2\.so:g' configure
1f4084
b4a3df
%if 0%{?prever:1} || 0%{?rebuild_ac}
1f4084
sed -i 's:$full_libdir/libsofthsm2\.so:libsofthsm2\.so:g' configure.ac
1f4084
%endif
1f4084
b4a3df
%if 0%{?prever:1} || 0%{?rebuild_ac}
1f4084
autoreconf -fiv
1f4084
%endif
1f4084
7328c7
%build
7328c7
%configure --libdir=%{_libdir}/pkcs11 --with-openssl=%{_prefix} --enable-ecc --disable-gost \
7328c7
           --with-migrate --enable-visibility --with-p11-kit=%{_datadir}/p11-kit/modules/
7328c7
7328c7
make %{?_smp_mflags}
7328c7
# install our copy of pk11install taken from coolkey package
7328c7
7328c7
%check
7328c7
# skip while cppunit is broken
7328c7
#make check
7328c7
7328c7
%install
7328c7
rm -rf %{buildroot}
7328c7
make DESTDIR=%{buildroot} install
7328c7
7328c7
rm %{buildroot}/%{_sysconfdir}/softhsm2.conf.sample
7328c7
rm -f %{buildroot}/%{_libdir}/pkcs11/*a
7328c7
mkdir -p %{buildroot}%{_includedir}/softhsm
7328c7
cp src/lib/*.h %{buildroot}%{_includedir}/softhsm
7328c7
mkdir -p %{buildroot}/%{_sharedstatedir}/softhsm/tokens
7328c7
7328c7
# leave a softlink where softhsm-1 installed its library. Programs like
7328c7
# opendnssec have that filename in their configuration file.
7328c7
mkdir -p %{buildroot}/%{_libdir}/softhsm/
7328c7
ln -s ../pkcs11/libsofthsm2.so %{buildroot}/%{_libdir}/softhsm/libsofthsm.so
7328c7
# rhbz#1272423 NSS needs it to be in the search path too
7328c7
( cd  %{buildroot}/%{_libdir} ; ln -s pkcs11/libsofthsm2.so)
7328c7
7328c7
%files
7328c7
%config(noreplace) %{_sysconfdir}/softhsm2.conf
7328c7
%{_bindir}/*
7328c7
%dir %{_libdir}/softhsm
7328c7
%{_libdir}/pkcs11/libsofthsm2.so
7328c7
%{_libdir}/libsofthsm2.so
7328c7
%{_libdir}/softhsm/libsofthsm.so
7328c7
%attr(0664,root,root) %{_datadir}/p11-kit/modules/softhsm2.module
7328c7
%attr(0750,ods,ods) %dir %{_sharedstatedir}/softhsm
7328c7
%attr(1770,ods,ods) %dir %{_sharedstatedir}/softhsm/tokens
7328c7
%doc LICENSE README.md NEWS
7328c7
%{_mandir}/*/*
7328c7
7328c7
%files devel
7328c7
%attr(0755,root,root) %dir %{_includedir}/softhsm
7328c7
%{_includedir}/softhsm/*.h
7328c7
7328c7
%pre
7328c7
getent group ods >/dev/null || groupadd -r ods
7328c7
getent passwd ods >/dev/null || \
7328c7
    useradd -r -g ods -d %{_sharedstatedir}/softhsm -s /sbin/nologin \
7328c7
    -c "softhsm private keys owner" ods
7328c7
exit 0
7328c7
7328c7
%post
7328c7
7328c7
%triggerpostun -- softhsm < 2.0.0
7328c7
if [ -f /var/softhsm/slot0.db ]; then
7328c7
      runuser -g ods ods -c 'softhsm2-migrate --db /var/softhsm/slot0.db --pin 1234 --slot 0' || :
7328c7
fi
7328c7
7328c7
%changelog
b4a3df
* Mon Feb 15 2021 Thomas Woerner <twoerner@redhat.com> - 2.6.0-5
b4a3df
- Install prever devel package requirements for new negative option patch
b4a3df
  Related: RHBZ#1857272
b4a3df
b4a3df
* Mon Feb 15 2021 Alexander Bokovoy <abokovoy@redhat.com> - 2.6.0-4
b4a3df
- Fixes: rhbz#1857272 - negative option for token.mechanism not working correctly
b4a3df
1f4084
* Thu Jun 04 2020 Alexander Bokovoy <abokovoy@redhat.com> - 2.6.0-3
1f4084
- Fixes: rhbz#1834909 - softhsm use-after-free on process exit
1f4084
- Synchronize the final fix with Fedora
1f4084
1f4084
* Thu May 14 2020 Paul Wouters <pwouters@redhat.com> - 2.6.0-2
1f4084
- Fixes: rhbz#1834909 - softhsm use-after-free on process exit
1f4084
1f4084
* Wed Apr 01 2020 Alexander Bokovoy <abokovoy@redhat.com> - 2.6.0-1
1f4084
- Fixes: rhbz#1818877 - rebase to softhsm 2.6.0+
1f4084
- Fixes: rhbz#1701233 - support setting supported signature methods on the token
1f4084
1f4084
* Mon Feb 17 2020 Alexander Bokovoy <abokovoy@redhat.com> - 2.4.0-4
1f4084
- Provide specific version libsofthsm2.so for p11-kit
1f4084
- Fixes: rhbz#1727065
1f4084
1f4084
* Tue Feb 11 2020 Alexander Bokovoy <abokovoy@redhat.com> - 2.4.0-3
1f4084
- Remove architecture-specific path from softhsm2.module definition
1f4084
- Fixes: rhbz#1727065
1f4084
7328c7
* Fri Aug 17 2018 Alexander Bokovoy <abokovoy@redhat.com> - 2.4.0-2
7328c7
- Replace PKCS11 headers by a more liberal version from p11-kit
7328c7
- Fixes: rhbz#1615766
7328c7
7328c7
* Sat Aug 11 2018 Nikos Mavrogiannopoulos <nmav@redhat.com> - 2.4.0-1
7328c7
- Updated to latest upstream release
7328c7
7328c7
* Tue Jul 31 2018 Alexander Bokovoy <abokovoy@redhat.com> - 2.3.0-4
7328c7
- Fix crash when used as a PKCS11 library via p11-kit (#1608690)
7328c7
7328c7
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.3.0-3.1
7328c7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
7328c7
7328c7
* Fri Feb 02 2018 Nikos Mavrogiannopoulos <nmav@redhat.com> - 2.3.0-3
7328c7
- Remove softhsm2-pk11install. Software modules are to be registered with
7328c7
  p11-kit as in https://fedoraproject.org/wiki/PackagingDrafts/Pkcs11Support (#1541095).
7328c7
7328c7
* Tue Dec 05 2017 Jakub Jelen <jjelen@redhat.com> - 2.3.0-2
7328c7
- Add support for RSA-PSS from upstrem PR#335
7328c7
7328c7
* Tue Dec 05 2017 Jakub Jelen <jjelen@redhat.com> - 2.3.0-1
7328c7
- New upstream release (#1467329)
7328c7
7328c7
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.0-2.2
7328c7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
7328c7
7328c7
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.0-2.1
7328c7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
7328c7
7328c7
* Tue Jun 27 2017 Nikos Mavrogiannopoulos <nmav@redhat.com> - 2.2.0-2
7328c7
- Increased the level of messages that go to syslog, thus softhsm
7328c7
  will no longer write on syslog when it cannot open the shared DB (#1425135)
7328c7
- Allow users in the 'ods' group to store their keys in /var/lib/softhsm/tokens/
7328c7
  while at the same time disallow deleting other users' keys (using the
7328c7
  sticky bit). Prevent users in the 'ods' group from writing in /var/lib/softhsm.
7328c7
7328c7
* Thu Jun 22 2017 Nikos Mavrogiannopoulos <nmav@redhat.com> - 2.2.0-1
7328c7
- Rebased to latest upstream release
7328c7
7328c7
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.0-2.1
7328c7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
7328c7
7328c7
* Fri Sep 23 2016 Paul Wouters <pwouters@redhat.com> - 2.1.0-2
7328c7
- Resolves: rhbz#1378800 Module cleanup crash
7328c7
7328c7
* Mon May 16 2016 Paul Wouters <pwouters@redhat.com> - 2.1.0-1
7328c7
- Resolves: rhbz#1244461 Updated to 2.1.0
7328c7
- Resolves: rhbz#1272423 Softhsm PKCS#11 module not visible to NSS becasue it is not in the search path
7328c7
- Resolves: rhbz#1177086 A marked as trusted certificate cannot be written in a softhsmv2 db
7328c7
- Resolves: rhbz#1272453 - A marked as CA certificate cannot be written in a softhsmv2 db
7328c7
- Removed merged in bug#162 patch
7328c7
- Temporarily disable make check because cppunit is broken
7328c7
7328c7
* Thu Feb 25 2016 Paul Wouters <pwouters@redhat.com> - 2.0.0-2
7328c7
- Resolves: rhbz#1272453 A marked as CA certificate cannot be written in a softhsmv2 db
7328c7
7328c7
* Fri Feb 05 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.0-1.1
7328c7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
7328c7
7328c7
* Wed Sep 02 2015 Paul Wouters <pwouters@redhat.com> - 2.0.0-1
7328c7
- Resolves: rhbz#1244461 Update to softhsm-2.0.0
7328c7
- Resolves: rhbz#1177086 A marked as trusted certificate cannot be written in a softhsmv2 db
7328c7
- Resolves: rhbz#1159827 Typo in homedir in /etc/passwd
7328c7
- Added global prever to toggle snapshot vs full release build changes
7328c7
7328c7
* Fri Jun 26 2015 Petr Spacek <pspacek@redhat.com> - 2.0.0rc1-3
7328c7
- Add dependency on OpenSSL with fixed AES wrapping support
7328c7
7328c7
* Fri Jun 19 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.0rc1-2
7328c7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
7328c7
7328c7
* Mon Jun 01 2015 Petr Spacek <pspacek@redhat.com> - 2.0.0rc1-1
7328c7
- Rebase to latest upstream release
7328c7
7328c7
* Sat May 02 2015 Kalev Lember <kalevlember@gmail.com> - 2.0.0b1-4
7328c7
- Rebuilt for GCC 5 C++11 ABI change
7328c7
7328c7
* Tue Sep 30 2014 Paul Wouters <pwouters@redhat.com> - 2.0.0b1-3
7328c7
- Add support for CKM_RSA_PKCS_OAEP key un/wrapping [Petr Spacek]
7328c7
- Use OpenSSL EVP interface for AES key wrapping [Petr Spacek]
7328c7
- Fix softhsm2-pk11install buid and post call
7328c7
- Do not use --with-objectstore-backend-db (causes issues on i686)
7328c7
- Change install directory to /usr/lib*/pkcs11/
7328c7
- Install pkcs11 module file
7328c7
- Use official upstream tar ball
7328c7
- Create ods user to own softhsm/token files
7328c7
- Enable migration tools (for softhsm-v1 installs)
7328c7
- Add softlink for softhsm-v1 .so (needed for opendnssec's conf.xml)
7328c7
- Require p11-kit, nss-tools, for SoftHSM PKCS #11 Module file
7328c7
- Copy pk11install.c from coolkey package
7328c7
- Enable hardened build
7328c7
- Add upstream official source url
7328c7
7328c7
* Mon Aug 18 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.6-3
7328c7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
7328c7
7328c7
* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.6-2
7328c7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
7328c7
7328c7
* Fri Apr 18 2014 Paul Wouters <pwouters@redhat.com> - 1.3.6-1
7328c7
- Updated to 1.3.6 (rhbz#1070196)
7328c7
- Provide a p11-kit module file (rhbz#1085327)
7328c7
7328c7
* Sun Nov 03 2013 Paul Wouters <pwouters@redhat.com> - 1.3.5-1
7328c7
- Updated to 1.3.5 (rhbz#987721)
7328c7
7328c7
* Tue Jul 30 2013 Paul Wouters <pwouters@redhat.com> - 1.3.3-4
7328c7
- Rebuilt for new botan - requires --with-botan argument
7328c7
7328c7
* Fri Feb 15 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.3-3
7328c7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
7328c7
7328c7
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.3-2
7328c7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
7328c7
7328c7
* Mon Jun 04 2012 Paul Wouters <pwouters@redhat.com> - 1.3.3-1
7328c7
- Updated to 1.3.3
7328c7
7328c7
* Tue Apr 03 2012 Paul Wouters <pwouters@redhat.com> - 1.3.2-1
7328c7
- Updated to 1.3.2.
7328c7
- Changed user from opendnssec to ods, as used in the opendnssec package
7328c7
7328c7
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.0-4
7328c7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
7328c7
7328c7
* Thu Oct 27 2011 Paul Wouters <paul@xelerance.com> - 1.3.0-3
7328c7
- Initial Fedora package
7328c7
- Do not install the .a file
7328c7
- Use a separate "opendnssec" user to own /var/sofhsm
7328c7
7328c7
* Tue Oct 25 2011 Paul Wouters <paul@xelerance.com> - 1.3.0-2
7328c7
- Fix description texts w.r.t. include files
7328c7
7328c7
* Wed Oct 05 2011 Paul Wouters <paul@xelerance.com> - 1.3.0-1
7328c7
- Upgraded to 1.3.0
7328c7
7328c7
* Thu Mar  3 2011 Paul Wouters <paul@xelerance.com> - 1.2.0-1
7328c7
- Initial package for Fedora