From baae0f383ae133903ecc9997f38ef45f7c0b3f16 Mon Sep 17 00:00:00 2001 From: Paul Wouters Date: Apr 10 2009 18:05:03 +0000 Subject: Moved all supported nsd versions to yse a sysconfig file and fixed various small issues in the cron and init scripts. Also upgraded all to latest nsd (3.2.1) --- diff --git a/nsd.init b/nsd.init index 5e24f46..4820f35 100755 --- a/nsd.init +++ b/nsd.init @@ -6,7 +6,7 @@ # description: NSD is a complete implementation of an authoritative \ # DNS name server. # processname: /usr/sbin/nsd -# config: /etc/nsd/nsdc.config +# config: /etc/nsd/nsd.conf # ### BEGIN INIT INFO # Provides: nsd @@ -17,21 +17,12 @@ # DNS name server. ### END INIT INFO -# Sanity checks. -[ -f /etc/nsd/nsdc.conf ] || exit 0 -[ -f /etc/nsd/nsd.zones ] || exit 0 -[ -x /usr/sbin/nsd ] || exit 0 - -#extra verbosity -#ZONEC_VERBOSE=-v -OTHER_NSD_OPTS="" - -#fixed in 2.3.6 -#work around for bug in nsd-2.3.x when no ipv6 is available -#if [ ! -d /proc/sys/net/ipv6/ ] -#then -# OTHER_NSD_OPTS="-4 $OTHER_NSD_OPTS" -#fi +# Init script default settings +NSD_CONF="/etc/nsd/nsd.conf" +NSD_PROG="/usr/sbin/nsd" +NSD_PIDFILE="/var/run/nsd/nsd.pid" +NSD_XFRDFILE="/var/lib/nsd/xfrd.state" +NSDC_PROG="/usr/sbin/nsdc" # Source function library. . /etc/init.d/functions @@ -42,24 +33,26 @@ OTHER_NSD_OPTS="" [ ${NETWORKING} = "no" ] && exit 0 start() { - /usr/sbin/nsdc rebuild >/dev/null - /usr/sbin/nsdc update >/dev/null echo -n $"Starting nsd... " + /usr/sbin/nsdc rebuild >/dev/null 2>%1 nsd $OTHER_NSD_OPTS RETVAL=$? echo - /usr/sbin/nsdc notify touch /var/lock/subsys/nsd return $RETVAL } stop() { echo -n $"Shutting down nsd services: " + # save state to zonefiles + /usr/sbin/nsdc patch > /dev/null 2>%1 killproc nsd RETVAL=$? if [ $RETVAL -eq 0 ] ; then + rm -f /var/run/nsd/nsd.pid + # ensure notifies are sent at startup + rm -f /var/lib/nsd/xfrd.state rm -f /var/lock/subsys/nsd - rm -f /var/run/nsd.pid fi echo return $RETVAL @@ -87,10 +80,10 @@ case "$1" in [ -f /var/lock/subsys/nsd ] && restart || : ;; status) - /usr/sbin/nsdc running + $NSDC_PROG -c $NSD_CONF running ;; stats|reload|rebuild|running|update|notify) - /usr/sbin/nsdc $1 + $NSDC_PROG -c $NSD_CONF $1 ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|stats|notify|reload|rebuild|running|update}" diff --git a/nsd.spec b/nsd.spec index c813b3a..9d5b1cc 100644 --- a/nsd.spec +++ b/nsd.spec @@ -1,14 +1,17 @@ Summary: NSD is a complete implementation of an authoritative DNS name server Name: nsd -Version: 2.3.7 -Release: 2%{?dist} -License: BSD-like -Url: http://open.nlnetlabs.nl/nsd/ -Source: http://open.nlnetlabs.nl/downloads/nsd/%{name}-%{version}.tar.gz +Version: 3.2.1 +Release: 1%{?dist} +License: BSD +Url: http://www.nlnetlabs.nl/%{name}/ +Source: http://www.nlnetlabs.nl/downloads/%{name}/%{name}-%{version}.tar.gz Source1: nsd.init +Source2: nsd.cron +Source3: nsd.sysconfig Group: System Environment/Daemons BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: flex, openssl-devel +Requires(pre): shadow-utils %description NSD is a complete implementation of an authoritative DNS name server. @@ -19,43 +22,62 @@ consult the REQUIREMENTS document which is a part of this distribution %prep %setup -q +%build %configure --enable-bind8-stats --enable-plugins --enable-checking \ - --enable-mmap --with-pidfile=%{_localstatedir}/run/%{name}/%{name}.pid --with-ssl \ - --with-user=nsd + --enable-mmap --with-ssl --enable-nsec3 --enable-nsid \ + --with-pidfile=%{_localstatedir}/run/%{name}/%{name}.pid --with-ssl \ + --with-user=nsd --with-difffile=%{_localstatedir}/lib/%{name}/ixfr.db \ + --with-xfrdfile=%{_localstatedir}/lib/%{name}/ixfr.state -%build %{__make} %{?_smp_mflags} +#convert to utf8 +iconv -f iso8859-1 -t utf-8 doc/RELNOTES > doc/RELNOTES.utf8 +iconv -f iso8859-1 -t utf-8 doc/CREDITS > doc/CREDITS.utf8 +mv -f doc/RELNOTES.utf8 doc/RELNOTES +mv -f doc/CREDITS.utf8 doc/CREDITS + %install rm -rf %{buildroot} %{__make} DESTDIR=%{buildroot} install -install -d 0755 %{buildroot}%{_initrddir} +install -d -m 0755 %{buildroot}%{_initrddir} +install -d -m 0755 $RPM_BUILD_ROOT%{_sysconfdir}/cron.hourly +install -c -m 0755 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/cron.hourly/nsd install -m 0755 %{SOURCE1} %{buildroot}/%{_initrddir}/nsd -install -d 0700 %{buildroot}%{_localstatedir}/run/%{name} +install -d -m 0700 %{buildroot}%{_localstatedir}/run/%{name} +install -d -m 0700 %{buildroot}%{_localstatedir}/lib/%{name} +install -d -m 0755 %{buildroot}%{_sysconfdir}/sysconfig +install -m 0755 %{SOURCE3} %{buildroot}/%{_sysconfdir}/sysconfig/%{name} # change .sample to normal config files -mv %{buildroot}%{_sysconfdir}/nsd/nsdc.conf.sample \ - %{buildroot}%{_sysconfdir}/nsd/nsdc.conf -mv %{buildroot}%{_sysconfdir}/nsd/nsd.zones.sample \ - %{buildroot}%{_sysconfdir}/nsd/nsd.zones +head -76 %{buildroot}%{_sysconfdir}/nsd/nsd.conf.sample > %{buildroot}%{_sysconfdir}/nsd/nsd.conf +rm %{buildroot}%{_sysconfdir}/nsd/nsd.conf.sample +echo "database: /var/lib/nsd/nsd.db" >> %{buildroot}%{_sysconfdir}/nsd/nsd.conf +echo "# include: \"/some/path/file\"" >> %{buildroot}%{_sysconfdir}/nsd/nsd.conf %clean rm -rf ${RPM_BUILD_ROOT} %files %defattr(-,root,root,-) -%doc README LICENSE NSD-DATABASE DIFFERENCES TODO RELNOTES REQUIREMENTS +%doc doc/* +%doc contrib/nsd.zones2nsd.conf %dir %{_sysconfdir}/nsd/ -%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/nsd/nsdc.conf -%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/nsd/nsd.zones +%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/nsd/nsd.conf +#%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/nsd/nsd.zones +%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/nsd %attr(0755,root,root) %{_initrddir}/%{name} -%attr(0700,%{name},%{name}) %dir %{_localstatedir}/run/%{name} +%{_sysconfdir}/cron.hourly/nsd +%attr(0755,%{name},%{name}) %dir %{_localstatedir}/run/%{name} +%attr(0755,%{name},%{name}) %dir %{_localstatedir}/lib/%{name} %{_sbindir}/* %{_mandir}/*/* %pre -if getent passwd nsd >/dev/null 2>&1 ; then : ; else /usr/sbin/useradd -d /etc/nsd -r -s /sbin/nologin nsd >/dev/null 2>&1 || exit 1 ; fi -# "Everyone is doing it, so why can't we?" +getent group nsd >/dev/null || groupadd -r nsd +getent passwd nsd >/dev/null || \ +useradd -r -g nsd -d /etc/nsd -s /sbin/nologin \ +-c "nsd daemon account" nsd exit 0 %post @@ -69,21 +91,91 @@ fi %postun if [ "$1" -ge "1" ]; then - /sbin/service %{name} condrestart > /dev/null 2> /dev/null + /sbin/service %{name} condrestart fi %changelog -* Fri Jul 13 2007 Paul Wouters 2.3.7-2 +* Fri Apr 10 2009 Paul Wouters - 3.2.1-1 +- updated to 3.2.1 +- fixed /dev/nul which cause a file /%1 to be written by cron +- Applied Ville Mattila's changes to support non-default locations + +* Thu Oct 9 2008 Paul Wouters - 3.1.1-1 +- updated to 3.1.1 + +* Mon Aug 11 2008 Tom "spot" Callaway - 3.1.0-2 +- fix license tag +- fix static user creation + +* Mon Jun 30 2008 Paul Wouters - 3.1.0-1 +- Updated to 3.1.0 + +* Tue May 6 2008 Paul Wouters - 3.0.8-2 +- Fix /dev/null redirection [Venkatesh Krishnamurthi] + +* Tue May 6 2008 Paul Wouters - 3.0.8-1 +- Updated to 3.0.8 + +* Tue Feb 19 2008 Fedora Release Engineering - 3.0.7-3 +- Autorebuild for GCC 4.3 + +* Wed Dec 5 2007 Paul Wouters - 3.0.7-2 +- Rebuild for new libcrypto + +* Tue Nov 13 2007 Paul Wouters - 3.0.7-1 +- Updated to new version +- fix RELNOTES/README to be utf8 +- Fix path to nsd.db in cron job. + +* Thu Nov 8 2007 Paul Wouters - 3.0.6-7 +- Modified cron to only rebuild/reload when zone updates + have been received + +* Wed Nov 7 2007 Paul Wouters - 3.0.6-6 +- Added hourly cron job to do various maintenance tasks +- Added nsd rebuild to create the proper nsd.db file on startup +- Added nsd patch on shutdown to ensure zonefiles are up to date + +* Tue Oct 2 2007 Paul Wouters - 3.0.6-5 +- nsdc update and nsdc notify are no longer needed in initscript. + +* Mon Sep 24 2007 Jesse Keating - 3.0.6-4 +- Bump release for upgrade path. + +* Fri Sep 14 2007 Paul Wouters 3.0.6-3 +- Do not include examples from nsd.conf.sample that causes + bogus network traffic. + +* Fri Sep 14 2007 Paul Wouters 3.0.6-2 +- Change locations of ixfr.db and xfrd.state to /var/lib/nsd +- Enable NSEC3 +- Delay running nsdc update until after nsd has started +- Delete xfrd.state on nsd stop +- Run nsdc notify in the background, since it can take + a very long time when remote servers are unavailable. + +* Tue Sep 11 2007 Paul Wouters 3.0.6-1 +- Upgraded to 3.0.6 +- Do not include bind2nsd, since it didn't compile for me + +* Fri Jul 13 2007 Paul Wouters 3.0.5-2 - Fix init script, bug #245546 -* Mon Apr 16 2007 Paul Wouters 2.3.7-1 -- Upgraded to 2.3.7 -- Ensure postun doesn't produce output when rebuilding binary zonefiles +* Fri Mar 23 2007 Paul Wouters 3.0.5-1 +- Upgraded to 3.0.5 + +* Thu Dec 7 2006 Paul Wouters 3.0.3-1 +- Upgraded to 3.0.3 + +* Mon Nov 27 2006 Paul Wouters 3.0.2-1 +- Upgraded to 3.0.2. +- Use new configuration file nsd.conf. Still needs migration script. + patch from Farkas Levente -* Mon Oct 16 2006 Paul Wouters 2.3.6-2 +* Mon Oct 16 2006 Paul Wouters 2.3.6-2 - Bump version for upgrade path -* Thu Oct 12 2006 Paul Wouters 2.3.6-1 +* Thu Oct 12 2006 Paul Wouters 2.3.6-1 - Upgraded to 2.3.6 - Removed obsolete workaround in nsd.init - Fixed spec file so daemon gets properly restarted on upgrade @@ -109,7 +201,7 @@ fi * Thu Dec 15 2005 Paul Wouters - 2.3.3-6 - Moved pid file to /var/run/nsd/nsd.pid. -- Use %{_localstatedir} instead of "/var" +- Use _localstatedir instead of "/var" * Tue Dec 13 2005 Paul Wouters - 2.3.3-5 - Added BuildRequires for openssl-devel, removed Requires for openssl. diff --git a/nsd.sysconfig b/nsd.sysconfig new file mode 100644 index 0000000..b1e8a07 --- /dev/null +++ b/nsd.sysconfig @@ -0,0 +1,27 @@ +# /etc/sysconfig/nsd +# Configuration for /etc/init.d/nsd + +OTHER_NSD_OPTS="" +#extra verbosity +#ZONEC_VERBOSE=-v + +# You might also need to change SElinux policies if you decide +# to deviate from the standard locations below. + +# Main configuration file +#NSD_CONF="/etc/nsd/nsd.conf" + +# Path to nsdc program +#NSDC_PROG="/usr/sbin/nsd" + +# Path to nsd program +#NSD_PROG="/usr/sbin/nsd" + +# NSD pid file +#NSD_PIDFILE="/var/run/nsd/nsd.pid" + +# NSD zone transfer daemon state file (should equal to the xfrdfile +# parameter set in nsd.conf) +#NSD_XFRDFILE="/var/lib/nsd/xfrd.state" + +# EOF diff --git a/sources b/sources index 6dbe9bb..c24b334 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -e9dfb18d544cd37c57b05a91384037e9 nsd-2.3.5.tar.gz -72428cdacc5bee63b4477becda27bf64 nsd-2.3.6.tar.gz -31a36167098a0ec9d736e113720c517f nsd-2.3.7.tar.gz +b96ac5e0e5f13cf99c0d07fa9d7ddabd nsd-3.0.8.tar.gz +69225bf59ae82181ca09af34c139fb6d nsd-3.1.0.tar.gz +93cb2d0fa005ab46f81ef00e4951a804 nsd-3.1.1.tar.gz