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