783137
#global prever rcX
783137
%global _hardened_build 1
783137
783137
Summary: DNSSEC key and zone management software
783137
Name: opendnssec
783137
Version: 2.1.7
783137
Release: 1%{?prever}%{?dist}
783137
License: BSD
783137
Url: http://www.opendnssec.org/
783137
Source0: http://www.opendnssec.org/files/source/%{?prever:testing/}%{name}-%{version}%{?prever}.tar.gz
783137
Source1: ods-enforcerd.service
783137
Source2: ods-signerd.service
783137
Source3: ods.sysconfig
783137
Source4: conf.xml
783137
Source5: tmpfiles-opendnssec.conf
783137
Source6: opendnssec.cron
783137
Source7: opendnssec-2.1.sqlite_convert.sql
783137
Source8: opendnssec-2.1.sqlite_rpmversion.sql
783137
783137
Requires: opencryptoki, softhsm >= 2.5.0 , systemd-units
783137
Requires: libxml2, libxslt sqlite
783137
BuildRequires:  gcc
783137
BuildRequires: ldns-devel >= 1.6.12, sqlite-devel >= 3.0.0, openssl-devel
783137
BuildRequires: libxml2-devel CUnit-devel, doxygen
783137
# It tests for pkill/killall and would use /bin/false if not found
783137
BuildRequires: procps-ng
783137
BuildRequires: perl-interpreter
783137
BuildRequires: libmicrohttpd-devel jansson-devel libyaml-devel
783137
783137
BuildRequires: systemd-units
783137
Requires(pre): shadow-utils
783137
Requires(post): systemd-units
783137
Requires(preun): systemd-units
783137
Requires(postun): systemd-units
783137
%if 0%{?prever:1}
783137
# For building development snapshots
783137
Buildrequires: autoconf, automake, libtool, java
783137
%endif
783137
783137
%description
783137
OpenDNSSEC was created as an open-source turn-key solution for DNSSEC.
783137
It secures zone data just before it is published in an authoritative
783137
name server. It requires a PKCS#11 crypto module library, such as softhsm
783137
783137
%prep
783137
%setup -q -n %{name}-%{version}%{?prever}
783137
# bump default policy ZSK keysize to 2048
783137
sed -i "s/1024/2048/" conf/kasp.xml.in
783137
783137
%build
783137
#export LDFLAGS="-Wl,-z,relro,-z,now -pie -specs=/usr/lib/rpm/redhat/redhat-hardened-ld"
783137
#export CFLAGS="$RPM_OPT_FLAGS -fPIE -pie -Wextra -Wformat -Wformat-nonliteral -Wformat-security"
783137
#export CXXFLAGS="$RPM_OPT_FLAGS -fPIE -pie -Wformat-nonliteral -Wformat-security"
783137
%if 0%{?prever:1}
783137
# for development snapshots
783137
sh ./autogen.sh
783137
%endif
783137
%configure --with-ldns=%{_libdir}
783137
make %{?_smp_mflags}
783137
783137
%check
783137
# Requires sample db not shipped with upstream
783137
# make check
783137
783137
%install
783137
rm -rf %{buildroot}
783137
make DESTDIR=%{buildroot} install
783137
mkdir -p %{buildroot}%{_localstatedir}/opendnssec/{tmp,signed,signconf,enforcer}
783137
install -d -m 0755 %{buildroot}%{_initrddir} %{buildroot}%{_sysconfdir}/cron.d/
783137
install -m 0644 %{SOURCE6} %{buildroot}/%{_sysconfdir}/cron.d/opendnssec
783137
rm -f %{buildroot}/%{_sysconfdir}/opendnssec/*.sample
783137
install -d -m 0755 %{buildroot}/%{_sysconfdir}/sysconfig
783137
install -d -m 0755 %{buildroot}%{_unitdir}
783137
install -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/
783137
install -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/
783137
install -m 0644 %{SOURCE3} %{buildroot}/%{_sysconfdir}/sysconfig/ods
783137
install -m 0644 %{SOURCE4} %{buildroot}/%{_sysconfdir}/opendnssec/
783137
mkdir -p %{buildroot}%{_tmpfilesdir}/
783137
install -m 0644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/opendnssec.conf
783137
mkdir -p %{buildroot}%{_localstatedir}/run/opendnssec
783137
mkdir -p %{buildroot}%{_datadir}/opendnssec/
783137
cp -a enforcer/utils %{buildroot}%{_datadir}/opendnssec/migration
783137
cp -a enforcer/src/db/schema.* %{buildroot}%{_datadir}/opendnssec/migration/1.4-2.0_db_convert/
783137
# fixup path for mysql/sqlite. Use our replacement sqlite_convert.sql to detect previous migration
783137
cp -a %{SOURCE7} %{buildroot}%{_datadir}/opendnssec/migration/1.4-2.0_db_convert/sqlite_convert.sql
783137
cp -a %{SOURCE8} %{buildroot}%{_datadir}/opendnssec/migration/1.4-2.0_db_convert/rpmversion.sql
783137
sed -i "s:^SCHEMA=.*schema:SCHEMA=%{_datadir}/opendnssec/migration/1.4-2.0_db_convert/schema:" %{buildroot}%{_datadir}/opendnssec/migration/1.4-2.0_db_convert/convert_sqlite
783137
sed -i "s:find_problematic_zones.sql:%{_datadir}/opendnssec/migration/1.4-2.0_db_convert/find_problematic_zones.sql:g" %{buildroot}%{_datadir}/opendnssec/migration/1.4-2.0_db_convert/convert_sqlite
783137
sed -i "s:^SCHEMA=.*schema:SCHEMA=%{_datadir}/opendnssec/migration/1.4-2.0_db_convert/schema:" %{buildroot}%{_datadir}/opendnssec/migration/1.4-2.0_db_convert/convert_mysql
783137
sed -i "s:find_problematic_zones.sql:%{_datadir}/opendnssec/migration/1.4-2.0_db_convert/find_problematic_zones.sql:g" %{buildroot}%{_datadir}/opendnssec/migration/1.4-2.0_db_convert/convert_mysql
783137
sed -i "s:sqlite_convert.sql:%{_datadir}/opendnssec/migration/1.4-2.0_db_convert/sqlite_convert.sql:g" %{buildroot}%{_datadir}/opendnssec/migration/1.4-2.0_db_convert/convert_sqlite
783137
783137
783137
%files
783137
%{_unitdir}/ods-enforcerd.service
783137
%{_unitdir}/ods-signerd.service
783137
%config(noreplace) %{_tmpfilesdir}/opendnssec.conf
783137
%attr(0770,root,ods) %dir %{_sysconfdir}/opendnssec
783137
%attr(0770,root,ods) %dir %{_localstatedir}/opendnssec
783137
%attr(0770,root,ods) %dir %{_localstatedir}/opendnssec/tmp
783137
%attr(0775,root,ods) %dir %{_localstatedir}/opendnssec/signed
783137
%attr(0770,root,ods) %dir %{_localstatedir}/opendnssec/signconf
783137
%attr(0770,root,ods) %dir %{_localstatedir}/opendnssec/enforcer
783137
%attr(0660,root,ods) %config(noreplace) %{_sysconfdir}/opendnssec/*.xml
783137
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/ods
783137
%attr(0770,root,ods) %dir %{_localstatedir}/run/opendnssec
783137
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/cron.d/opendnssec
783137
%doc NEWS README.md
783137
%license LICENSE
783137
%{_mandir}/*/*
783137
%{_sbindir}/*
783137
%{_bindir}/*
783137
%attr(0755,root,root) %dir %{_datadir}/opendnssec
783137
%{_datadir}/opendnssec/*
783137
783137
%pre
783137
getent group ods >/dev/null || groupadd -r ods
783137
getent passwd ods >/dev/null || \
783137
useradd -r -g ods -d /etc/opendnssec -s /sbin/nologin \
783137
-c "opendnssec daemon account" ods
783137
exit 0
783137
783137
%post
783137
# Initialise a slot on the softhsm on first install
783137
if [ "$1" -eq 1 ]; then
783137
   %{_sbindir}/runuser -u ods -- %{_bindir}/softhsm2-util --init-token \
783137
                --free --label "OpenDNSSEC" --pin 1234 --so-pin 1234
783137
   if [ ! -s %{_localstatedir}/opendnssec/kasp.db ]; then
783137
      echo y | %{_sbindir}/ods-enforcer-db-setup
783137
      %{_bindir}/sqlite3 -batch %{_localstatedir}/opendnssec/kasp.db < %{_datadir}/opendnssec/migration/1.4-2.0_db_convert/rpmversion.sql
783137
   fi
783137
783137
elif [ -z "$(%{_bindir}/sqlite3 %{_localstatedir}/opendnssec/kasp.db 'select * from rpm_migration;')" ]; then
783137
   # Migrate version 1.4 db to version 2.1 db
783137
   if [ -e %{_localstatedir}/opendnssec/rpm-migration-in-progress ]; then
783137
      echo "previous (partial?) migration found - human intervention is needed"
783137
   else
783137
      echo "opendnssec 1.4 database found, migrating to 2.x"
783137
      touch %{_localstatedir}/opendnssec/rpm-migration-in-progress
783137
      mv -n %{_localstatedir}/opendnssec/kasp.db %{_localstatedir}/opendnssec/kasp.db-1.4
783137
      echo "migrating conf.xml from 1.4 to 2.1 schema"
783137
      cp -n %{_sysconfdir}/opendnssec/conf.xml %{_sysconfdir}/opendnssec/conf.xml-1.4
783137
      # fixup incompatibilities inflicted upon us by upstream :(
783137
      sed -i "/<Interval>.*Interval>/d" %{_sysconfdir}/opendnssec/conf.xml
783137
      echo "Converting kasp.db"
783137
      ERR=""
783137
      %{_datadir}/opendnssec/migration/1.4-2.0_db_convert/convert_sqlite -i %{_localstatedir}/opendnssec/kasp.db-1.4 -o %{_localstatedir}/opendnssec/kasp.db || ERR="convert_sqlite error"
783137
      chown ods.ods %{_localstatedir}/opendnssec/kasp.db
783137
      cp -n %{_sysconfdir}/opendnssec/zonelist.xml %{_localstatedir}/opendnssec/enforcer/zones.xml
783137
      if [ -z "$ERR" ]; then
783137
         echo "calling ods-migrate"
783137
         ods-migrate || ERR="ods-migrate failed"
783137
         if [ -z "$ERR" ]; then
783137
            echo "opendnssec 1.4 to 2.x migration completed"
783137
            rm %{_localstatedir}/opendnssec/rpm-migration-in-progress
783137
         else
783137
            echo "ods-migrate process failed - human intervention is needed"
783137
         fi
783137
      else
783137
         echo "%{_localstatedir}/opendnssec/kasp.db conversion failed - not calling ods-migrate to complete migration. human intervention is needed"
783137
      fi
783137
   fi
783137
fi
783137
783137
# in case we update any xml conf file
783137
ods-enforcer update all >/dev/null 2>/dev/null ||:
783137
783137
%systemd_post ods-enforcerd.service
783137
%systemd_post ods-signerd.service
783137
783137
%preun
783137
%systemd_preun ods-enforcerd.service
783137
%systemd_preun ods-signerd.service
783137
783137
%postun
783137
%systemd_postun_with_restart ods-enforcerd.service
783137
%systemd_postun_with_restart ods-signerd.service
783137
783137
%changelog
783137
* Fri Dec 04 2020 Alexander Bokovoy <abokovoy@redhat.com> - 2.1.7-1
783137
- Upstream release 2.1.7
783137
- Resolves: rhbz#1904484
783137
783137
* Fri May 08 2020 Paul Wouters <pwouters@redhat.com> - 2.1.6-2
783137
- Resolves: rhbz#1831732 AVC avc: denied { dac_override } for comm="ods-enforcerd
783137
783137
* Wed Apr 15 2020 Paul Wouters <pwouters@redhat.com> - 2.1.6-1
783137
- Resolves: rhbz#1759888 Rebase OpenDNSSEC to 2.1
783137
783137
* Tue Dec 12 2017 Paul Wouters <pwouters@redhat.com> - 1.4.14-1
783137
- Update to 1.4.14 as first steop to migrating to 2.x
783137
- Resolves: rhbz#1413254 Move tmpfiles.d config to %%{_tmpfilesdir}, install LICENSE as %%license
783137
783137
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.9-7
783137
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
783137
783137
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.9-6
783137
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
783137
783137
* Wed Mar 08 2017 Tomas Hozza <thozza@redhat.com> - 1.4.9-5
783137
- Fix FTBFS (#1424019) in order to rebuild against new ldns
783137
783137
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.9-4
783137
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
783137
783137
* Thu Feb 18 2016 Paul Wouters <pwouters@redhat.com> - 1.4.9-3
783137
- Resolves: rbz#1303965 upgrade to opendnssec-1.4.9-1.fc23 breaks old installations
783137
- On initial install, after token init, also run ods-ksmutil setup
783137
783137
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.9-2
783137
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
783137
783137
* Mon Feb 01 2016 Paul Wouters <pwouters@redhat.com> - 1.4.9-1
783137
- Updated to 1.4.9
783137
- Removed merged in patch
783137
783137
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.7-3
783137
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
783137
783137
* Tue Jun 09 2015 Paul Wouters <pwouters@redhat.com> - 1.4.7-2
783137
- Resolves rhbz#1219746 ods-signerd.service misplaced After= in section Service
783137
- Resolves rhbz#1220443 OpenDNSSEC fails to initialise a slot in softhsm on first install
783137
783137
* Tue Dec 09 2014 Paul Wouters <pwouters@redhat.com> - 1.4.7-1
783137
- Updated to 1.4.7 (fix zone update can get stuck, crash on retransfer cmd)
783137
783137
* Wed Oct 15 2014 Paul Wouters <pwouters@redhat.com> - 1.4.6-4
783137
- Change /etc/opendnssec to be ods group writable
783137
783137
* Wed Oct 08 2014 Paul Wouters <pwouters@redhat.com> - 1.4.6-3
783137
- Added Petr Spacek's patch that adds the config option <AllowExtraction/> (rhbz#1123354)
783137
783137
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.6-2
783137
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
783137
783137
* Mon Jul 28 2014 Paul Wouters <pwouters@redhat.com> - 1.4.6-1
783137
- Updated to 1.4.6
783137
- Removed incorporated patch upstream
783137
- Remove Wants= from ods-signerd.service (rhbz#1098205)
783137
783137
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.5-3
783137
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
783137
783137
* Fri Apr 18 2014 Paul Wouters <pwouters@redhat.com> - 1.4.5-2
783137
- Updated to 1.4.5
783137
- Added patch for serial 0 bug in XFR adapter
783137
783137
* Tue Apr 01 2014 Paul Wouters <pwouters@redhat.com> - 1.4.4-3
783137
- Add buildrequires for ods-kasp2html (rhbz#1073313)
783137
783137
* Sat Mar 29 2014 Paul Wouters <pwouters@redhat.com> - 1.4.4-2
783137
- Add requires for ods-kasp2html (rhbz#1073313)
783137
783137
* Thu Mar 27 2014 Paul Wouters <pwouters@redhat.com> - 1.4.4-1
783137
- Updated to 1.4.4 (compatibility with non RFC 5155 errata 3441)
783137
- Change the default ZSK policy from 1024 to 2048 bit RSA keys
783137
- Fix post to be quiet when upgrading opendnssec
783137
783137
* Thu Jan 09 2014 Paul Wouters <pwouters@redhat.com> - 1.4.3-1
783137
- Updated to 1.4.3 (rhel#1048449) - minor bugfixes, minor feature enhancements
783137
- rhel#1025985 OpenDNSSEC signer cannot be started due to a typo in service file
783137
783137
* Wed Sep 11 2013 Paul Wouters <pwouters@redhat.com> - 1.4.2-1
783137
- Updated to 1.4.2, bugfix release
783137
783137
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.1-2
783137
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
783137
783137
* Fri Jun 28 2013 Paul Wouters <pwouters@redhat.com> - 1.4.1-1
783137
- Updated to 1.4.1. NSEC3 handling and serial number handling fixes
783137
- Add BuildRequire for systemd-units
783137
783137
* Sat May 11 2013 Paul Wouters <pwouters@redhat.com> - 1.4.0-1
783137
- Updated to 1.4.0
783137
783137
* Fri Apr 12 2013 Paul Wouters <pwouters@redhat.com> - 1.4.20-0.8.rc3
783137
- Updated to 1.4.0rc3
783137
- Enabled hardened compile, full relzo/pie
783137
783137
* Fri Jan 25 2013 Patrick Uiterwijk <puiterwijk@gmail.com> - 1.4.0-0.7.rc2
783137
- Updated to 1.4.0rc2, which includes svn r6952
783137
783137
* Fri Jan 18 2013 Patrick Uiterwijk <puiterwijk@gmail.com> - 1.4.0-0.6.rc1
783137
- Updated to 1.4.0rc1
783137
- Applied opendnssec-ksk-premature-retirement.patch (svn r6952)
783137
783137
* Tue Dec 18 2012 Paul Wouters <pwouters@redhat.com> - 1.4.0-0.5.b2
783137
- Updated to 1.4.0b2
783137
- All patches have been merged upstream
783137
- cron job should be marked as config file
783137
783137
* Tue Oct 30 2012 Paul Wouters <pwouters@redhat.com> - 1.4.0-0.4.b1
783137
- Added BuildRequires: procps-ng for bug OPENDNSSEC-345
783137
- Change RRSIG inception offset to -2h to avoid possible
783137
  daylight saving issues on resolvers
783137
- Patch to prevent removal of occluded data
783137
783137
* Wed Sep 26 2012 Paul Wouters <pwouters@redhat.com> - 1.4.0-0.3.b1
783137
- Just an EVR fix to the proper standard
783137
- Cleanup of spec file
783137
- Introduce new systemd-rpm macros (rhbz#850242)
783137
783137
* Wed Sep 12 2012 Paul Wouters <pwouters@redhat.com> - 1.4.0-0.b1.1
783137
- Updated to 1.4.0b1
783137
- Patch for NSEC3PARAM TTL
783137
- Cron job to assist narrowing ods-enforcerd timing differences
783137
783137
* Wed Aug 29 2012 Paul Wouters <pwouters@redhat.com> - 1.4.0-0.a3.1
783137
- Updated to 1.4.0a3
783137
- Patch to more aggressively try to resign
783137
- Patch to fix locking issue eating up cpu
783137
783137
* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.0-0.a2.2
783137
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
783137
783137
* Tue Jun 12 2012 Paul Wouters <pwouters@redhat.com> - 1.4.0-0.a2.1
783137
- Updated to 1.4.0a2
783137
- ksm-utils patch for ods-ksmutil to die sooner when it can't lock
783137
  the HSM.
783137
783137
* Wed May 16 2012 Paul Wouters <pwouters@redhat.com> - 1.4.0-0.a1.3
783137
- Patch for crasher with deleted RRsets and NSEC3/OPTOUT chains
783137
783137
* Mon Mar 26 2012 Paul Wouters <pwouters@redhat.com> - 1.4.0-0.a1.2
783137
- Added opendnssec LICENSE file from trunk (Thanks Jakob!)
783137
783137
* Mon Mar 26 2012 Paul Wouters <pwouters@redhat.com> - 1.4.0-0.a1.1
783137
- Fix macros in comment
783137
- Added missing -m to install target
783137
783137
* Sun Mar 25 2012 Paul Wouters <pwouters@redhat.com> - 1.4.0-0.a1
783137
- The 1.4.x branch no longer needs ruby, as the auditor has been removed
783137
- Added missing openssl-devel BuildRequire
783137
- Comment out <SkipPublicKey/> so keys generated by ods can be used by bind
783137
783137
* Fri Feb 24 2012 Paul Wouters <pwouters@redhat.com> - 1.3.6-3
783137
- Requires rubygem-soap4r when using ruby-1.9
783137
- Don't ghost /var/run/opendnssec
783137
- Converted initd to systemd
783137
783137
* Thu Nov 24 2011 root - 1.3.2-6
783137
- Added rubygem-dnsruby requires as rpm does not pick it up automatically
783137
783137
* Tue Nov 22 2011 root - 1.3.2-5
783137
- Added /var/opendnssec/signconf/ /as this temp dir is needed
783137
783137
* Mon Nov 21 2011 Paul Wouters <paul@xelerance.com> - 1.3.2-4
783137
- Added /var/opendnssec/signed/ as this is the default output dir
783137
783137
* Sun Nov 20 2011 Paul Wouters <paul@xelerance.com> - 1.3.2-3
783137
- Add ods user for opendnssec tasks
783137
- Added initscripts and services for ods-signerd and ods-enforcerd
783137
- Initialise OpenDNSSEC softhsm token on first install
783137
783137
* Wed Oct 05 2011 Paul Wouters <paul@xelerance.com> - 1.3.2-1
783137
- Updated to 1.3.2
783137
- Added dependancies on opencryptoki and softhsm
783137
- Don't install duplicate unreadable .sample files
783137
- Fix upstream conf.xml to point to actually used library paths
783137
783137
* Thu Mar  3 2011 Paul Wouters <paul@xelerance.com> - 1.2.0-1
783137
- Initial package for Fedora