4101ba1
%global _hardened_build 1
4101ba1
a25e271
Summary: Fast and lean authoritative DNS Name Server
fea33a3
Name: nsd
d30696e
Version: 3.2.17
d30696e
Release: 1%{?dist}
d7c2c32
License: BSD
32e1238
Url: http://www.nlnetlabs.nl/%{name}/
c9ed87c
Source: http://www.nlnetlabs.nl/downloads/%{name}/%{name}-%{version}.tar.gz
3dd0f65
Source1: nsd.service
709b0f5
Source2: nsd.cron
a25e271
Source3: nsd.sysconfig
3dd0f65
Source4: tmpfiles-nsd.conf
f4a96a5
Patch0: nsd-install.patch
fea33a3
Group: System Environment/Daemons
0fb8b47
BuildRequires: flex, openssl-devel
3dd0f65
BuildRequires: systemd-units
3dd0f65
Requires(post): systemd-sysv
3dd0f65
Requires(post): systemd-units
3dd0f65
Requires(preun): systemd-units
3dd0f65
Requires(postun): systemd-units
d7c2c32
Requires(pre): shadow-utils
fea33a3
fea33a3
%description
fea33a3
NSD is a complete implementation of an authoritative DNS name server.
fea33a3
For further information about what NSD is and what NSD is not please
fea33a3
consult the REQUIREMENTS document which is a part of this distribution
fea33a3
(thanks to Olaf).
fea33a3
fea33a3
%prep
c9ed87c
%setup -q
ecf94c8
%patch0 -p1 -b .install
fea33a3
d7c2c32
%build
4101ba1
export CFLAGS="$RPM_OPT_FLAGS -fPIE -Wformat-nonliteral -Wformat-security"
4101ba1
export LDFLAGS="-pie -Wl,-z,relro,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld"
Paul Wouters f0ac2e0
%configure --enable-bind8-stats --enable-checking --enable-nsec3  \
4101ba1
           --with-pidfile=/run/%{name}/%{name}.pid --with-ssl \
59bea48
           --with-user=nsd --with-difffile=%{_localstatedir}/lib/%{name}/ixfr.db \
a85cd70
           --with-xfrdfile=%{_localstatedir}/lib/%{name}/ixfr.state \
ecf94c8
           --with-dbfile=%{_localstatedir}/lib/%{name}/nsd.db \
d30696e
           --enable-ratelimit --with-max-ips=1024
fea33a3
fea33a3
%{__make} %{?_smp_mflags}
75611be
#convert to utf8
7ccd03e
iconv -f iso8859-1 -t utf-8 doc/RELNOTES > doc/RELNOTES.utf8
7ccd03e
iconv -f iso8859-1 -t utf-8 doc/CREDITS > doc/CREDITS.utf8
75611be
mv -f doc/RELNOTES.utf8 doc/RELNOTES
75611be
mv -f doc/CREDITS.utf8 doc/CREDITS
75611be
fea33a3
%install
c025ce8
%{__make} DESTDIR=%{buildroot} install
3dd0f65
mkdir -p %{buildroot}%{_unitdir}
3dd0f65
install -d -m 0755 %{buildroot}%{_sysconfdir}/cron.hourly
3dd0f65
install -c -m 0755 %{SOURCE2} %{buildroot}%{_sysconfdir}/cron.hourly/nsd
3dd0f65
install -m 0755 %{SOURCE1} %{buildroot}/%{_unitdir}/nsd.service
59bea48
install -d -m 0700 %{buildroot}%{_localstatedir}/lib/%{name}
a25e271
install -d -m 0755 %{buildroot}%{_sysconfdir}/sysconfig
a25e271
install -m 0755 %{SOURCE3} %{buildroot}/%{_sysconfdir}/sysconfig/%{name}
4101ba1
mkdir -p %{buildroot}%{_sysconfdir}/tmpfiles.d/ %{buildroot}/run/%{name}
3dd0f65
install -m 0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/tmpfiles.d/nsd.conf
fea33a3
c025ce8
# change .sample to normal config files
4dfd50d
head -76 %{buildroot}%{_sysconfdir}/nsd/nsd.conf.sample > %{buildroot}%{_sysconfdir}/nsd/nsd.conf
4dfd50d
rm %{buildroot}%{_sysconfdir}/nsd/nsd.conf.sample 
da6cbb8
echo "database: /var/lib/nsd/nsd.db" >> %{buildroot}%{_sysconfdir}/nsd/nsd.conf
4dfd50d
echo "# include: \"/some/path/file\"" >> %{buildroot}%{_sysconfdir}/nsd/nsd.conf
fea33a3
fea33a3
%files 
16359b2
%doc doc/*
7b80a30
%doc contrib/nsd.zones2nsd.conf
fea33a3
%dir %{_sysconfdir}/nsd/
16359b2
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/nsd/nsd.conf
a25e271
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/nsd
3dd0f65
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/tmpfiles.d/nsd.conf
2ab2918
%attr(0644,root,root) %{_unitdir}/%{name}.service
709b0f5
%{_sysconfdir}/cron.hourly/nsd
4101ba1
%attr(0755,nsd,nsd) %dir /run/%{name}
59bea48
%attr(0755,%{name},%{name}) %dir %{_localstatedir}/lib/%{name}
fea33a3
%{_sbindir}/*
fea33a3
%{_mandir}/*/*
fea33a3
fea33a3
%pre
d7c2c32
getent group nsd >/dev/null || groupadd -r nsd
d7c2c32
getent passwd nsd >/dev/null || \
d7c2c32
useradd -r -g nsd -d /etc/nsd -s /sbin/nologin \
d7c2c32
-c "nsd daemon account" nsd
fea33a3
exit 0
fea33a3
fea33a3
%post
4101ba1
%systemd_post nsd.service
fea33a3
fea33a3
%preun
4101ba1
%systemd_preun nsd.service
fea33a3
fea33a3
%postun
4101ba1
%systemd_postun_with_restart nsd.service
fea33a3
3dd0f65
%triggerun -- nsd < 3.2.8-6
3dd0f65
# Save the current service runlevel info
3dd0f65
# User must manually run systemd-sysv-convert --apply nsd
3dd0f65
# to migrate them to systemd targets
3dd0f65
/usr/bin/systemd-sysv-convert --save nsd >/dev/null 2>&1 ||:
3dd0f65
3dd0f65
# Run these because the SysV package being removed won't do them
3dd0f65
/sbin/chkconfig --del nsd >/dev/null 2>&1 || :
3dd0f65
/bin/systemctl try-restart nsd.service >/dev/null 2>&1 || :
3dd0f65
fea33a3
%changelog
d30696e
* Sun Mar 30 2014 Paul Wouters <pwouters@redhat.com> - 3.2.17-1
d30696e
- Updated to 3.2.17
d30696e
- Added --with-max-ips=1024 
d30696e
- Removed merged in patch
d30696e
93651b5
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.2.15-5
93651b5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
93651b5
4101ba1
* Thu Apr 18 2013 Paul Wouters <pwouters@redhat.com> - 3.2.15-4
4101ba1
- Enable hardened build
4101ba1
- rhbz#850231 - Introduce new systemd-rpm macros in nsd spec file
4101ba1
- Added -D option to nsd to allow us to use systemd service Type=simple
4101ba1
- Switch from Fork to Simple systemd service
4101ba1
- Use /run and not /var/run for pid 
4101ba1
- The cronjon now uses systemctl reload, which also triggers notifies
4101ba1
  (should speed up notifications to secondaries)
4101ba1
b4553b5
* Mon Mar 25 2013 Peter Robinson <pbrobinson@fedoraproject.org> 3.2.15-3
b4553b5
- Bump so rawhide/F19 has bigger NVR that older releases
b4553b5
Paul Wouters ae25fdd
* Mon Feb 04 2013 Paul Wouters <pwouters@redhat.com> - 3.2.15-1
Paul Wouters ae25fdd
- Updates to 3.2.15 which contains rate limit code
4101ba1
  (fixes rhbz#842036 - nsd fails to start in fips mode)
3902fb1
95ab6c9
* Fri Nov 23 2012 Paul Wouters <pwouters@redhat.com> - 3.2.14-2
ecf94c8
- Updated to 3.2.14 with minor bugfixes and TCP writev support
95ab6c9
- Only run nsdc rebuild hourly cronjob when nsd service is running
19f94a3
17d8550
* Fri Jul 27 2012 Paul Wouters <pwouters@redhat.com> - 3.2.13-1
5bcb6b5
- Updated to 3.2.13, addresses VU#517036 CVE-2012-2979
5bcb6b5
  (note Fedora/EPEL packages are not vulnerable to this)
5bcb6b5
200b040
* Mon Jul 23 2012 Paul Wouters <pwouters@redhat.com> - 3.2.12-2
200b040
- Add /var/run/nsd via tmpfiles (rhbz#842021)
200b040
9971012
* Thu Jul 19 2012 Paul Wouters <pwouters@redhat.com> - 3.2.12-1
9971012
- Upgraded to 3.2.12 which fixes CVE-2012-2978 (rhbz#841268)
9971012
4585a36
* Mon Jul 16 2012 Paul Wouters <pwouters@redhat.com> - 3.2.11-1
4585a36
- Updated to 3.2.11
2ab2918
- Remove execute perm from unitdir file
4585a36
3601986
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.2.9-3
3601986
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
3601986
Paul Wouters 3804984
* Tue Nov 29 2011 Paul Wouters <paul@xelerance.com> - 3.2.9-2
Paul Wouters 3804984
- Change spec and initscript to chown /var/run/nsd to nsd user to work around
Paul Wouters 3804984
  the "nsdc restart" problem where it cannot update its own pid file
Paul Wouters 3804984
Paul Wouters d38c631
* Sun Nov 27 2011 Paul Wouters <paul@xelerance.com> - 3.2.9-1
Paul Wouters d38c631
- Updated to 3.2.9
Paul Wouters d38c631
dd99da5
* Mon Sep 12 2011 Tom Callaway <spot@fedoraproject.org> - 3.2.8-7
dd99da5
- fix tmpfiles.d creation of /var/run/nsd to be owned by root
dd99da5
3dd0f65
* Mon Sep 12 2011 Tom Callaway <spot@fedoraproject.org> - 3.2.8-6
3dd0f65
- convert to systemd, tmpfiles.d
3dd0f65
Paul Wouters fc38092
* Fri Jun  3 2011 Paul Wouters <paul@xelerance.com> - 3.2.8-5
Paul Wouters fc38092
- fix /var/run/nsd to be owned by root, not nsd
Paul Wouters fc38092
Paul Wouters 18d921d
* Fri Jun  3 2011 Tuomo Soini <tis@foobar.fi> - 3.2.8-4
Paul Wouters b833fb6
- fix init status to work as expected (bz#525107)
Paul Wouters e1c27bc
- fix nsd.conf and nsd.conf.5 to have correct logfile
Paul Wouters e1c27bc
- fix nsd.init syntax error by piddir change
Paul Wouters 0792db3
- fix initscript to create /var/run/nsd if missing (bz#710376)
Paul Wouters e1c27bc
Paul Wouters bbb0b68
* Sun Mar 27 2011 Paul Wouters <paul@xelerance.com> - 3.2.8-1
Paul Wouters bbb0b68
- updated to 3.2.8
Paul Wouters bbb0b68
Paul Wouters ec86161
* Wed Mar 09 2011 Paul Wouters <paul@xelerance.com> - 3.2.7-5
Paul Wouters 888e8c3
- Fix misnamed variable NSD_AUTORELOAD which should be NSD_AUTOREBUILD
Paul Wouters cda864f
- Fix for init script properly returning OK/Failed (bz#535107) by Noa Resare
Paul Wouters cda864f
- Add ghost directive to /var/run/nsd (bz#656642)
Paul Wouters cda864f
- Bump release for EVR
Paul Wouters 888e8c3
e65f585
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.2.7-2
e65f585
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
e65f585
Paul Wouters 4c365ff
* Thu Feb 03 2011 Paul Wouters <paul@xelerance.com> - 3.2.7-1
Paul Wouters 4c365ff
- Updated to 3.2.7
Paul Wouters 4c365ff
Paul Wouters f0ac2e0
* Mon Aug 02 2010 Paul Wouters <paul@xelerance.com> - 3.2.6-1
Paul Wouters f0ac2e0
- Updated to 3.2.6
Paul Wouters f0ac2e0
- Removed obsolete --enable-nsid
Paul Wouters f0ac2e0
8a578a6
* Wed Jan 06 2010 Paul Wouters <paul@xelerance.com> - 3.2.4-1
8a578a6
- Updated to nsd 3.2.4
8a578a6
a236fa7
* Tue Jan 05 2010 Paul Wouters <paul@xelerance.com> - 3.2.3-4
a236fa7
- Incorporated Ville Mattila's fixes  to nsd.cron
a236fa7
- Support for NSD_AUTOREBUILD in /etc/sysconfig/nsd [Ville]
a236fa7
c772ab1
* Fri Aug 21 2009 Tomas Mraz <tmraz@redhat.com> - 3.2.3-3
c772ab1
- rebuilt with new openssl
c772ab1
6d6ff76
* Thu Aug 20 2009 Ville Mattila <vmattila@csc.fi> - 3.2.3-2
6d6ff76
- The 'nsdc patch' and 'nsdc rebuild' commands wrote a %%1 file by mistake
6d6ff76
3fa14f2
* Mon Aug 17 2009 Paul Wouters <paul@xelerance.com> - 3.2.3-1
3fa14f2
-Updated to version 3.2.3
3fa14f2
a11c503
* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.2.2-4
a11c503
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
a11c503
bbdc21b
* Sat Jun 06 2009 Paul Wouters <paul@xelerance.com> - 3.2.2-3
bbdc21b
- Fixed /dev/nul which cause a file \%%1 to be written by cron
bbdc21b
- Bump for EVR.
bbdc21b
f4a96a5
* Mon May 18 2009 Paul Wouters <paul@xelerance.com> - 3.2.2-1
f4a96a5
- Upgraded to 3.2.2 security release
f4a96a5
  http://www.nlnetlabs.nl/publications/NSD_vulnerability_announcement.html
f4a96a5
a25e271
* Thu Apr 09 2009 Ville Mattila <vmattila@csc.fi> - 3.2.1-6
a25e271
- Make various file paths used by the nsd.init script configurable
a25e271
  from /etc/sysconfig/nsd.
a25e271
- Add template /etc/sysconfig/nsd.
a25e271
e4e00f6
* Sun Mar 08 2009 Paul Wouters <paul@xelerance.com> - 3.2.1-5
e4e00f6
- nsd used the 'named' subsystem in one call in the init script
e4e00f6
f7b588c
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.2.1-4
f7b588c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
f7b588c
43f3812
* Mon Jan 26 2009 Paul Wouters <paul@xelerance.com> - 3.2.1-3
43f3812
- Fix init script 'unary operator' error.
32640be
6c7e77b
* Mon Jan 26 2009 Paul Wouters <paul@xelerance.com> - 3.2.1-1
6c7e77b
- Updated to new version 3.2.1
6c7e77b
76f2997
* Sat Jan 17 2009 Tomas Mraz <tmraz@redhat.com> - 3.2.0-4
76f2997
- rebuild with new openssl
76f2997
fff8fa1
* Mon Nov 24 2008 Paul Wouters <paul@xelerance.com> - 3.2.0-3
fff8fa1
- Updates summary as per Richard Hughes guidelines
fff8fa1
351f14e
* Mon Nov 10 2008 Paul Wouters <paul@xelerance.com> - 3.2.0-2
351f14e
- Bump version after pre-release version correction.
351f14e
74e93d6
* Mon Nov 10 2008 Paul Wouters <paul@xelerance.com> - 3.2.0-1
74e93d6
- 3.2.0-1
74e93d6
c858bae
* Thu Oct  9 2008 Paul Wouters <paul@xelerance.com> - 3.1.1-1
c858bae
- updated to 3.1.1
c858bae
d7c2c32
* Mon Aug 11 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 3.1.0-2
d7c2c32
- fix license tag
d7c2c32
- fix static user creation
d7c2c32
24d1de1
* Mon Jun 30 2008 Paul Wouters <paul@xelerance.com> - 3.1.0-1
24d1de1
- Updated to 3.1.0
24d1de1
976466d
* Tue May  6 2008 Paul Wouters <paul@xelerance.com> - 3.0.8-2
976466d
- Fix /dev/null redirection [Venkatesh Krishnamurthi]
976466d
60cac7a
* Tue May  6 2008 Paul Wouters <paul@xelerance.com> - 3.0.8-1
60cac7a
- Updated to 3.0.8
60cac7a
cf1ea9d
* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 3.0.7-3
cf1ea9d
- Autorebuild for GCC 4.3
cf1ea9d
487bcef
* Wed Dec  5 2007 Paul Wouters <paul@xelerance.com> - 3.0.7-2
487bcef
- Rebuild for new libcrypto
487bcef
75611be
* Tue Nov 13 2007 Paul Wouters <paul@xelerance.com> - 3.0.7-1
75611be
- Updated to new version
75611be
- fix RELNOTES/README to be utf8
32ca9f4
- Fix path to nsd.db in cron job.
75611be
da6cbb8
* Thu Nov  8 2007 Paul Wouters <paul@xelerance.com> - 3.0.6-7
da6cbb8
- Modified cron to only rebuild/reload when zone updates
da6cbb8
  have been received
da6cbb8
709b0f5
* Wed Nov  7 2007 Paul Wouters <paul@xelerance.com> - 3.0.6-6
709b0f5
- Added hourly cron job to do various maintenance tasks
709b0f5
- Added nsd rebuild to create the proper nsd.db file on startup
709b0f5
- Added nsd patch on shutdown to ensure zonefiles are up to date
709b0f5
50ae015
* Tue Oct  2 2007 Paul Wouters <paul@xelerance.com> - 3.0.6-5
50ae015
- nsdc update and nsdc notify are no longer needed in initscript.
50ae015
b7aa26c
* Mon Sep 24 2007 Jesse Keating <jkeating@redhat.com> - 3.0.6-4
b7aa26c
- Bump release for upgrade path.
b7aa26c
4dfd50d
* Fri Sep 14 2007 Paul Wouters <paul@xelerance.com> 3.0.6-3
4dfd50d
- Do not include examples from nsd.conf.sample that causes
4dfd50d
  bogus network traffic.
4dfd50d
59bea48
* Fri Sep 14 2007 Paul Wouters <paul@xelerance.com> 3.0.6-2
59bea48
- Change locations of ixfr.db and xfrd.state to /var/lib/nsd
59bea48
- Enable NSEC3
59bea48
- Delay running nsdc update until after nsd has started
59bea48
- Delete xfrd.state on nsd stop
59bea48
- Run nsdc notify in the background, since it can take
59bea48
  a very long time when remote servers are unavailable.
59bea48
6d65e23
* Tue Sep 11 2007 Paul Wouters <paul@xelerance.com> 3.0.6-1
6d65e23
- Upgraded to 3.0.6
6d65e23
- Do not include bind2nsd, since it didn't compile for me
6d65e23
63634cb
* Fri Jul 13 2007 Paul Wouters <paul@xelerance.com> 3.0.5-2
63634cb
- Fix init script, bug #245546
63634cb
00bb8e6
* Fri Mar 23 2007 Paul Wouters <paul@xelerance.com> 3.0.5-1
00bb8e6
- Upgraded to 3.0.5
00bb8e6
a49fa68
* Thu Dec  7 2006 Paul Wouters <paul@xelerance.com> 3.0.3-1
a49fa68
- Upgraded to 3.0.3
a49fa68
16359b2
* Mon Nov 27 2006 Paul Wouters <paul@xelerance.com> 3.0.2-1
16359b2
- Upgraded to 3.0.2.
16359b2
- Use new configuration file nsd.conf. Still needs migration script.
16359b2
  patch from Farkas Levente <lfarkas@bppiac.hu>
16359b2
e9f5ce6
* Mon Oct 16 2006  Paul Wouters <paul@xelerance.com> 2.3.6-2
e9f5ce6
- Bump version for upgrade path
e9f5ce6
2979b81
* Thu Oct 12 2006  Paul Wouters <paul@xelerance.com> 2.3.6-1
2979b81
- Upgraded to 2.3.6
2979b81
- Removed obsolete workaround in nsd.init
2979b81
- Fixed spec file so daemon gets properly restarted on upgrade
2979b81
232bfb4
* Mon Sep 11 2006 Paul Wouters <paul@xelerance.com> 2.3.5-4
232bfb4
- Rebuild requested for PT_GNU_HASH support from gcc
232bfb4
- Removed dbaccess.c from doc section
232bfb4
c2f0858
* Mon Jun 26 2006 Paul Wouters <paul@xelerance.com> - 2.3.5-3
c2f0858
- Bump version for FC-x upgrade path
c2f0858
c2f0858
* Mon Jun 26 2006 Paul Wouters <paul@xelerance.com> - 2.3.5-1
788b255
- Upgraded to nsd-2.3.5
788b255
babe51a
* Sun May  7 2006 Paul Wouters <paul@xelerance.com> - 2.3.4-3
c025ce8
- Upgraded to nsd-2.3.4. 
c025ce8
- Removed manual install targets because DESTDIR is now supported
c025ce8
- Re-enabled --checking, checking patch no longer needed and removed.
c025ce8
- Work around in nsd.init for nsd failing to start when there is no ipv6
c025ce8
e39af5e
* Thu Dec 15 2005 Paul Wouters <paul@xelerance.com> - 2.3.3-7
e39af5e
- chkconfig and attribute  changes as proposed by Dmitry Butskoy
e39af5e
1f3f193
* Thu Dec 15 2005 Paul Wouters <paul@xelerance.com> - 2.3.3-6
1f3f193
- Moved pid file to /var/run/nsd/nsd.pid.
a49fa68
- Use _localstatedir instead of "/var"
1f3f193
c98708c
* Tue Dec 13 2005 Paul Wouters <paul@xelerance.com> - 2.3.3-5
c98708c
- Added BuildRequires for openssl-devel, removed Requires for openssl.
c98708c
c98708c
* Mon Dec 12 2005 Paul Wouters <paul@xelerance.com> - 2.3.3-4
fea33a3
- upgraded to nsd-2.3.3
fea33a3
fea33a3
* Wed Dec  7 2005 Tom "spot" Callaway <tcallawa@redhat.com> - 2.3.2-2
fea33a3
- minor cleanups
fea33a3
fea33a3
* Mon Dec  5 2005 Paul Wouters <paul@xelerance.com> - 2.3.2-1
fea33a3
- Upgraded to 2.3.2. Changed post scripts to comply to Fedora
fea33a3
  Extras policies (eg do not start daemon on fresh install)
fea33a3
fea33a3
* Tue Oct  4 2005 Paul Wouters <paul@xelerance.com> - 2.3.1-1
fea33a3
- Initial version