- major changes in initscript. Could be LSB compatible

- removed caching-nameserver subpackage and move configfiles from there
    into main bind package as default configuration
- major changes in default configuration
This commit is contained in:
Adam Tkac 2007-06-14 15:13:02 +00:00
parent 7fdb7fd693
commit e51da3145d
13 changed files with 278 additions and 380 deletions

150
bind.spec
View File

@ -16,7 +16,7 @@ Summary: The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) serv
Name: bind Name: bind
License: BSD-like License: BSD-like
Version: 9.4.1 Version: 9.4.1
Release: 5%{?dist} Release: 6%{?dist}
Epoch: 31 Epoch: 31
Url: http://www.isc.org/products/BIND/ Url: http://www.isc.org/products/BIND/
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -37,21 +37,18 @@ Source11: named.service
Source12: README.sdb_pgsql Source12: README.sdb_pgsql
Source13: namedSetForwarders Source13: namedSetForwarders
Source14: namedGetForwarders Source14: namedGetForwarders
Source16: named.caching-nameserver.conf Source16: named.conf
Source17: named.root Source17: named.root
Source18: named.local Source18: named.localhost
Source19: localhost.zone Source19: named.loopback
Source20: localdomain.zone Source20: named.empty
Source21: named.ip6.local Source21: Copyright.caching-nameserver
Source22: named.broadcast Source22: bind-chroot-admin.in
Source23: named.zero Source23: named.rfc1912.zones
Source24: Copyright.caching-nameserver Source24: libbind.pc
Source26: bind-chroot-admin.in Source25: named.conf.sample
Source27: named.rfc1912.zones Source26: named.rfc1912.zones.sample
Source28: libbind.pc Source27: named.root.hints
Source29: named.conf.sample
Source30: named.rfc1912.zones.sample
Source31: named.root.hints
# Common patches # Common patches
Patch0: bind-9.2.0rc3-varrun.patch Patch0: bind-9.2.0rc3-varrun.patch
@ -94,6 +91,8 @@ Requires: bind-libs = %{epoch}:%{version}-%{release}, glibc >= 2.2, mktemp
Requires(post): grep, chkconfig >= 1.3.26 Requires(post): grep, chkconfig >= 1.3.26
Requires(pre): shadow-utils Requires(pre): shadow-utils
Requires(preun):chkconfig >= 1.3.26 Requires(preun):chkconfig >= 1.3.26
Obsoletes: bind-config
Provides: bind-config
%if %{selinux} %if %{selinux}
Requires(post): policycoreutils Requires(post): policycoreutils
%endif %endif
@ -152,31 +151,6 @@ The bind-devel package contains all the header files and libraries
required for development with ISC BIND 9 and BIND 8 required for development with ISC BIND 9 and BIND 8
%package -n caching-nameserver
Summary: Default BIND configuration files for a caching nameserver
Group: System Environment/Daemons
Obsoletes: bind-config
Provides: bind-config
Requires: bind = %{epoch}:%{version}-%{release}
Requires(post): grep
Requires(postun): grep
%if %{selinux}
Requires(post): policycoreutils
Conflicts: selinux-policy-strict < 2.2.0
Conflicts: selinux-policy-targeted < 2.2.0
%endif
%description -n caching-nameserver
The caching-nameserver package includes the configuration files which will make
the ISC BIND named DNS name server act as a simple caching nameserver.
A caching nameserver is a DNS Resolver, as defined in RFC 1035, section 7.
ISC BIND named(8) provides a very efficient, flexible and robust resolver as
well as a server of authoritative DNS data - many users use this package
along with BIND to implement their primary system DNS resolver service.
If you would like to set up a caching name server, you'll need to install
bind, bind-libs, and bind-utils along with this package.
%package chroot %package chroot
Summary: A chroot runtime environment for the ISC BIND DNS server, named(8) Summary: A chroot runtime environment for the ISC BIND DNS server, named(8)
Group: System Environment/Daemons Group: System Environment/Daemons
@ -391,7 +365,7 @@ cp -fp %{SOURCE12} contrib/sdb/pgsql/
%if %{LIBBIND} %if %{LIBBIND}
gunzip < %{SOURCE9} | (cd ${RPM_BUILD_ROOT}/usr/share; tar -xpf -) gunzip < %{SOURCE9} | (cd ${RPM_BUILD_ROOT}/usr/share; tar -xpf -)
mkdir -p ${RPM_BUILD_ROOT}/%{_libdir}/pkgconfig mkdir -p ${RPM_BUILD_ROOT}/%{_libdir}/pkgconfig
install -m 644 %{SOURCE28} $RPM_BUILD_ROOT%{_libdir}/pkgconfig/libbind.pc install -m 644 %{SOURCE24} $RPM_BUILD_ROOT%{_libdir}/pkgconfig/libbind.pc
%endif %endif
%if %{WITH_DBUS} %if %{WITH_DBUS}
mkdir -p ${RPM_BUILD_ROOT}/etc/dbus-1/system.d mkdir -p ${RPM_BUILD_ROOT}/etc/dbus-1/system.d
@ -434,31 +408,28 @@ find ${RPM_BUILD_ROOT}/%{_libdir} -name '*.la' -exec '/bin/rm' '-f' '{}' ';';
# #
# Ghost config files: # Ghost config files:
touch ${RPM_BUILD_ROOT}/etc/named.conf touch ${RPM_BUILD_ROOT}/etc/named.conf
# caching-nameserver files: # configuration files:
mkdir -p ${RPM_BUILD_ROOT}/{etc,var/named} mkdir -p ${RPM_BUILD_ROOT}/{etc,var/named}
install -m 644 %{SOURCE16} ${RPM_BUILD_ROOT}/etc/named.caching-nameserver.conf install -m 644 %{SOURCE16} ${RPM_BUILD_ROOT}/etc/named.conf
install -m 644 %{SOURCE27} ${RPM_BUILD_ROOT}/etc/named.rfc1912.zones install -m 644 %{SOURCE23} ${RPM_BUILD_ROOT}/etc/named.rfc1912.zones
install -m 644 %{SOURCE17} ${RPM_BUILD_ROOT}/var/named/named.ca install -m 644 %{SOURCE17} ${RPM_BUILD_ROOT}/var/named/named.ca
install -m 644 %{SOURCE18} ${RPM_BUILD_ROOT}/var/named/named.local install -m 644 %{SOURCE18} ${RPM_BUILD_ROOT}/var/named/named.localhost
install -m 644 %{SOURCE19} ${RPM_BUILD_ROOT}/var/named/localhost.zone install -m 644 %{SOURCE19} ${RPM_BUILD_ROOT}/var/named/named.loopback
install -m 644 %{SOURCE20} ${RPM_BUILD_ROOT}/var/named/localdomain.zone install -m 644 %{SOURCE20} ${RPM_BUILD_ROOT}/var/named/named.empty
install -m 644 %{SOURCE21} ${RPM_BUILD_ROOT}/var/named/named.ip6.local for f in /etc/named.conf /var/named/{named.ca,named.localhost,named.loopback,named.empty}; do
install -m 644 %{SOURCE22} ${RPM_BUILD_ROOT}/var/named/named.broadcast
install -m 644 %{SOURCE23} ${RPM_BUILD_ROOT}/var/named/named.zero
for f in /etc/named.caching-nameserver.conf /var/named/{named.ca,named.local,localhost.zone,localdomain.zone,named.ip6.local,named.broadcast,named.zero}; do
touch ${RPM_BUILD_ROOT}/%{chroot_prefix}/$f; touch ${RPM_BUILD_ROOT}/%{chroot_prefix}/$f;
done done
install -m 644 %{SOURCE5} ./rfc1912.txt install -m 644 %{SOURCE5} ./rfc1912.txt
install -m 644 %{SOURCE24} ./Copyright install -m 644 %{SOURCE21} ./Copyright
# bind-chroot-admin script: # bind-chroot-admin script:
sed -e 's^@BIND_CHROOT_PREFIX@^'%{chroot_prefix}'^;s^@BIND_DIR@^'%{bind_dir}'^' < %{SOURCE26} > bind-chroot-admin; sed -e 's^@BIND_CHROOT_PREFIX@^'%{chroot_prefix}'^;s^@BIND_DIR@^'%{bind_dir}'^' < %{SOURCE22} > bind-chroot-admin;
install -m 754 bind-chroot-admin ${RPM_BUILD_ROOT}/%{_sbindir} install -m 754 bind-chroot-admin ${RPM_BUILD_ROOT}/%{_sbindir}
# sample bind configuration files for %doc: # sample bind configuration files for %doc:
mkdir -p sample/etc sample/var/named/{data,slaves} mkdir -p sample/etc sample/var/named/{data,slaves}
cp -fp %{SOURCE29} sample/etc/named.conf cp -fp %{SOURCE25} sample/etc/named.conf
cp -fp %{SOURCE30} sample/etc/named.rfc1912.zones cp -fp %{SOURCE26} sample/etc/named.rfc1912.zones
cp -fp %{SOURCE31} sample/etc/ cp -fp %{SOURCE27} sample/etc/
cp -fp %{SOURCE17} %{SOURCE18} %{SOURCE19} %{SOURCE20} %{SOURCE21} %{SOURCE22} %{SOURCE23} sample/var/named cp -fp %{SOURCE17} %{SOURCE18} %{SOURCE19} %{SOURCE20} sample/var/named
for f in my.internal.zone.db slaves/my.slave.internal.zone.db slaves/my.ddns.internal.zone.db my.external.zone.db; do for f in my.internal.zone.db slaves/my.slave.internal.zone.db slaves/my.ddns.internal.zone.db my.external.zone.db; do
echo '@ in soa localhost. root 1 3H 15M 1W 1D echo '@ in soa localhost. root 1 3H 15M 1W 1D
ns localhost.' > sample/var/named/$f; ns localhost.' > sample/var/named/$f;
@ -495,6 +466,10 @@ if [ "$1" -eq 1 ]; then
/bin/sed -i -e 's^@KEY@^'`/usr/sbin/dns-keygen`'^' /etc/rndc.key ; /bin/sed -i -e 's^@KEY@^'`/usr/sbin/dns-keygen`'^' /etc/rndc.key ;
fi fi
[ -x /sbin/restorecon ] && /sbin/restorecon /etc/rndc.* /etc/named.* >/dev/null 2>&1 ; [ -x /sbin/restorecon ] && /sbin/restorecon /etc/rndc.* /etc/named.* >/dev/null 2>&1 ;
[ -x /sbin/restorecon] && /sbin/restorecon /etc/named.conf >/dev/null 2>&1 || :;
[ -x /sbin/restorecon] && /sbin/restorecon /etc/named.rfc1912.zones >/dev/null 2>&1 || :;
[ -x /usr/sbin/bind-chroot-admin ] && /usr/sbin/bind-chroot-admin --sync;
fi fi
:; :;
@ -537,17 +512,6 @@ fi
%postun libs -p /sbin/ldconfig %postun libs -p /sbin/ldconfig
%post -n caching-nameserver
if [ "$1" -gt 0 ]; then
/sbin/restorecon /etc/named.caching-nameserver.conf >/dev/null 2>&1 || :;
/sbin/restorecon /etc/named.rfc1912.zones >/dev/null 2>&1 || :;
if [ -x /usr/sbin/bind-chroot-admin ]; then
/usr/sbin/bind-chroot-admin --sync;
fi;
fi;
:;
%post chroot %post chroot
if [ "$1" -gt 0 ]; then if [ "$1" -gt 0 ]; then
/usr/sbin/bind-chroot-admin --enable > /dev/null 2>&1; /usr/sbin/bind-chroot-admin --enable > /dev/null 2>&1;
@ -609,6 +573,21 @@ rm -rf ${RPM_BUILD_ROOT}
%files %files
%defattr(0640,root,named,0750) %defattr(0640,root,named,0750)
%dir /var/named %dir /var/named
%config(noreplace) %verify(not link) /etc/named.conf
%ghost %config(noreplace) %{chroot_prefix}/etc/named.conf
%config(noreplace) %verify(not link) /etc/named.rfc1912.zones
%ghost %config(noreplace) %{chroot_prefix}/etc/named.rfc1912.zones
%config %verify(not link) /var/named/named.ca
%ghost %config %{chroot_prefix}/var/named/named.ca
%config %verify(not link) /var/named/named.localhost
%ghost %config %{chroot_prefix}/var/named/named.localhost
%config %verify(not link) /var/named/named.loopback
%ghost %config %{chroot_prefix}/var/named/named.loopback
%config %verify(not link) /var/named/named.empty
%ghost %config %{chroot_prefix}/var/named/named.empty
%defattr(0644,root,root,0755)
%doc Copyright
%doc rfc1912.txt
%defattr(0660,named,named,0770) %defattr(0660,named,named,0770)
%dir /var/named/slaves %dir /var/named/slaves
%dir /var/named/data %dir /var/named/data
@ -623,8 +602,6 @@ rm -rf ${RPM_BUILD_ROOT}
# %verify(not size,not md5) %config(noreplace) %attr(0640,root,named) /etc/rndc.conf # %verify(not size,not md5) %config(noreplace) %attr(0640,root,named) /etc/rndc.conf
# ^- Let the named internal default rndc.conf be used - # ^- Let the named internal default rndc.conf be used -
# rndc.conf not required unless it differs from default. # rndc.conf not required unless it differs from default.
%ghost %config(noreplace) /etc/named.conf
# ^- Ensure something owns named.conf, even though it may not be installed at all
%ghost %config(noreplace) /etc/rndc.conf %ghost %config(noreplace) /etc/rndc.conf
# ^- The default rndc.conf which uses rndc.key is in named's default internal config - # ^- The default rndc.conf which uses rndc.key is in named's default internal config -
# so rndc.conf is not necessary. # so rndc.conf is not necessary.
@ -705,32 +682,6 @@ rm -rf ${RPM_BUILD_ROOT}
%{_mandir}/man5/libbind-* %{_mandir}/man5/libbind-*
%endif %endif
%files -n caching-nameserver
%defattr(0640,root,named,0750)
%config %verify(not link) /etc/named.caching-nameserver.conf
%ghost %config %{chroot_prefix}/etc/named.caching-nameserver.conf
%config %verify(not link) /etc/named.rfc1912.zones
%ghost %config %{chroot_prefix}/etc/named.rfc1912.zones
%ghost %config(noreplace) /etc/named.conf
%ghost %config(noreplace) %{chroot_prefix}/etc/named.conf
%config %verify(not link) /var/named/named.ca
%ghost %config %{chroot_prefix}/var/named/named.ca
%config %verify(not link) /var/named/named.local
%ghost %config %{chroot_prefix}/var/named/named.local
%config %verify(not link) /var/named/localhost.zone
%ghost %config %{chroot_prefix}/var/named/localhost.zone
%config %verify(not link) /var/named/localdomain.zone
%ghost %config %{chroot_prefix}/var/named/localdomain.zone
%config %verify(not link) /var/named/named.ip6.local
%ghost %config %{chroot_prefix}/var/named/named.ip6.local
%config %verify(not link) /var/named/named.broadcast
%ghost %config %{chroot_prefix}/var/named/named.broadcast
%config %verify(not link) /var/named/named.zero
%ghost %config %{chroot_prefix}/var/named/named.zero
%defattr(0644,root,root,0755)
%doc Copyright
%doc rfc1912.txt
%files chroot %files chroot
%defattr(0640,root,named,0750) %defattr(0640,root,named,0750)
%dir %prefix %dir %prefix
@ -740,7 +691,6 @@ rm -rf ${RPM_BUILD_ROOT}
%dir %prefix/var/run %dir %prefix/var/run
%dir %prefix/var/named %dir %prefix/var/named
%ghost %config(noreplace) %prefix/etc/named.conf %ghost %config(noreplace) %prefix/etc/named.conf
%ghost %config(noreplace) %prefix/etc/named.caching-nameserver.conf
%ghost %config(noreplace) %prefix/etc/rndc.key %ghost %config(noreplace) %prefix/etc/rndc.key
%defattr(0660,named,named,0770) %defattr(0660,named,named,0770)
%dir %prefix/var/named/slaves %dir %prefix/var/named/slaves
@ -772,6 +722,12 @@ rm -rf ${RPM_BUILD_ROOT}
%endif %endif
%changelog %changelog
* Tue Jun 12 2007 Adam Tkac <atkac redhat com> 31:9.4.1-6.fc8
- major changes in initscript. Could be LSB compatible now
- removed caching-nameserver subpackage. Move configs from this
package to main bind package as default configuration and major
configuration cleanup
* Tue Jun 04 2007 Adam Tkac <atkac redhat com> 31:9.4.1-5.fc8 * Tue Jun 04 2007 Adam Tkac <atkac redhat com> 31:9.4.1-5.fc8
- very minor compatibility change in bind-chroot-admin (line 215) - very minor compatibility change in bind-chroot-admin (line 215)
- enabled IDN support by default and don't distribute IDN libraries - enabled IDN support by default and don't distribute IDN libraries

View File

@ -1,10 +0,0 @@
$TTL 86400
@ IN SOA localhost root (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS localhost
localhost IN A 127.0.0.1

View File

@ -1,12 +0,0 @@
$TTL 86400
@ IN SOA @ root (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS @
IN A 127.0.0.1
IN AAAA ::1

View File

@ -1,8 +0,0 @@
$TTL 86400
@ IN SOA localhost. root.localhost. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS localhost.

View File

@ -11,6 +11,7 @@
// to create named.conf - edits to this file will be lost on // to create named.conf - edits to this file will be lost on
// caching-nameserver package upgrade. // caching-nameserver package upgrade.
// //
options { options {
listen-on port 53 { 127.0.0.1; }; listen-on port 53 { 127.0.0.1; };
listen-on-v6 port 53 { ::1; }; listen-on-v6 port 53 { ::1; };
@ -21,10 +22,18 @@ options {
allow-query { localhost; }; allow-query { localhost; };
recursion yes; recursion yes;
}; };
logging { logging {
channel default_debug { channel default_debug {
file "data/named.run"; file "data/named.run";
severity dynamic; severity dynamic;
}; };
}; };
zone "." IN {
type hint;
file "named.ca";
};
include "/etc/named.rfc1912.zones"; include "/etc/named.rfc1912.zones";

8
named.empty Normal file
View File

@ -0,0 +1,8 @@
$TTL 1D
@ IN SOA localhost. root.localhost. (
0 ; serial
3H ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS localhost.

View File

@ -8,17 +8,22 @@
# that is used to resolve host names to IP addresses. # that is used to resolve host names to IP addresses.
# probe: true # probe: true
# Return codes
# - script (all except status command)
# - 2 invalid or excess argument(s)
# - 3 unimplemented feature (for example, "reload")
# - 4 user had insufficient privilege
# - 5 program is not installed
# - 6 program is not configured
# - 7 program is not running
# Source function library. # Source function library.
. /etc/rc.d/init.d/functions . /etc/rc.d/init.d/functions
# Source networking configuration.
[ -r /etc/sysconfig/network ] && . /etc/sysconfig/network
# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 1
[ -r /etc/sysconfig/named ] && . /etc/sysconfig/named [ -r /etc/sysconfig/named ] && . /etc/sysconfig/named
RETVAL=0
# Don't kill named during clean-up # Don't kill named during clean-up
NAMED_SHUTDOWN_TIMEOUT=${NAMED_SHUTDOWN_TIMEOUT:-100} NAMED_SHUTDOWN_TIMEOUT=${NAMED_SHUTDOWN_TIMEOUT:-100}
@ -30,191 +35,180 @@ if [ -n "$ROOTDIR" ]; then
fi; fi;
fi fi
RETVAL=0 # Run SDB backend?
named='named' named='named'
if [[ "$ENABLE_SDB" = [yY1]* ]] && [ -x /usr/sbin/named_sdb ]; then if `echo "$ENABLE_SDB" | grep -q ^[yY1].*`; then
named='named_sdb'; named='named_sdb';
fi;
prog=$named
[ -x /usr/sbin/$named ] || exit 1
nmdcOption()
{ let i=0;
for a in $*;
do ((++i));
if [ $a = -c ]; then
((++i));
eval 'echo $'$i;
elif [[ $a = -c* ]]; then
echo ${a#-c};
fi;
done;
}
named_c_option=`nmdcOption $OPTIONS`;
named_conf=${named_c_option:-/etc/named.conf};
if [ ! -r ${ROOTDIR}${named_conf} ] ; then
if [ -z "$named_c_option" ] && [ -r ${ROOTDIR}/etc/named.caching-nameserver.conf ]; then
named_conf='/etc/named.caching-nameserver.conf';
OPTIONS="$OPTIONS -c ${named_conf}";
else
echo Locating $ROOTDIR/${named_conf} failed.
echo $"I can't find any configuration file. You can create it by system-config-bind"
echo $"or install caching-nameserver."
failure
echo;
exit 1;
fi;
fi; fi;
dbusEnabled=0; # Manage forwarders through D-BUS?
for a in $OPTIONS; do for a in $OPTIONS; do
if [ $a = "-D" ]; then if [ $a = "-D" ]; then
dbusEnabled=1;
fi;
done
if [ $dbusEnabled -eq 0 ] && [ -z "$DISABLE_NAMED_DBUS" ] ; then
NetworkManagerEnabled=0
for l in 0 1 2 3 4 5 6; do
if /sbin/chkconfig --level=$l NetworkManager >/dev/null 2>&1; then
NetworkManagerEnabled=1;
fi;
done
if [ $NetworkManagerEnabled -eq 1 ]; then
OPTIONS="$OPTIONS -D";
fi;
dbusEnabled=1; dbusEnabled=1;
fi fi;
done
if [ -z $dbusEnabled ] && [ -z "$DISABLE_NAMED_DBUS" ] ; then
for l in 0 1 2 3 4 5 6; do
if /sbin/chkconfig --level=$l NetworkManager >/dev/null 2>&1; then
dbusEnabled=1;
fi;
done
[ -z $NetworkManagerEnabled ] || OPTIONS="$OPTIONS -D";
fi;
start() { # Check if all what named needs running
# Start daemons. start()
echo -n $"Starting $named: " {
if [ -n "`/sbin/pidof -o %PPID $named`" ]; then # Source networking configuration.
echo -n $"$named: already running" [ -r /etc/sysconfig/network ] && . /etc/sysconfig/network
failure
echo
return 1
fi
ckcf_options='-z'; # enable named-checkzone for each zone (9.3.1+) !
if [ -n "${ROOTDIR}" -a "x${ROOTDIR}" != "x/" ]; then
OPTIONS="${OPTIONS} -t ${ROOTDIR}"
ckcf_options="$ckcf_options -t ${ROOTDIR}";
if [ -s /etc/localtime ]; then
cp -fp /etc/localtime ${ROOTDIR}/etc/localtime
fi;
if [ ! -d ${ROOTDIR}/proc ]; then
mkdir -p ${ROOTDIR}/proc
fi
if ! egrep -q '^/proc[[:space:]]+'${ROOTDIR}'/proc' /proc/mounts; then
mount --bind -n /proc ${ROOTDIR}/proc >/dev/null 2>&1
fi
if [ $dbusEnabled -eq 1 ]; then
if ! egrep -q '^/[^[:space:]]+[[:space:]]+'${ROOTDIR}'/var/run/dbus' /proc/mounts; then
mkdir -p ${ROOTDIR}/var/run/dbus
if [ ! -d /var/run/dbus ] ; then
mkdir -p /var/run/dbus ;
fi;
mount --bind -n /var/run/dbus ${ROOTDIR}/var/run/dbus > /dev/null 2>&1;
fi;
fi;
fi
conf_ok=0; # Check that networking is up
if [ -x /usr/sbin/named-checkconf ] && [ -x /usr/sbin/named-checkzone ] && /usr/sbin/named-checkconf $ckcf_options ${named_conf} >/dev/null 2>&1; then [ "${NETWORKING}" = "no" ] && exit 1
conf_ok=1;
else
RETVAL=$?; [ -x /usr/sbin/$named ] || exit 5
fi
if [ $conf_ok -eq 1 ]; then # Handle -c option
daemon /usr/sbin/$named -u named ${OPTIONS}; previous_option='unspecified';
RETVAL=$?; for a in $OPTIONS; do
if [ $RETVAL -eq 0 ]; then if [ $previous_option = '-c' ]; then
rm -f /var/run/named.pid named_conf=$a;
rm -f /var/run/named_sdb.pid 2>/dev/null fi;
ln -s $ROOTDIR/var/run/named/named.pid /var/run/named.pid; previous_option=$a;
if [ "$named" = "named_sdb" ]; then done;
ln -s $ROOTDIR/var/run/named/named.pid /var/run/named_sdb.pid;
fi; named_conf=${named_conf:-/etc/named.conf};
fi;
if [ -n "`/sbin/pidof -o %PPID $named`" ]; then if [ ! -r $named_conf ]; then
# Verify that named actually started (JM 2006-10-04) echo 'Cannot find configuration file. You could create it by system-config-bind'
if [ ! -e $ROOTDIR/var/run/named/named.pid ]; then exit 6;
# If there is not a file containing the PID of the now running named daemon then create it (JM 2006-10-04) fi;
echo `/sbin/pidof -o %PPID $named` > $ROOTDIR/var/run/named/named.pid;
if [ "$named" = "named_sdb" ]; then # all pre-start is done, lets start named
echo `/sbin/pidof -o %PPID $named` > $ROOTDIR/var/run/named/named_sdb.pid; echo -n $"Starting $named: "
fi; if [ -n "`/sbin/pidof -o %PPID $named`" ]; then
fi; echo -n $"$named: already running"
fi; failure
else echo
named_err="`/usr/sbin/named-checkconf $ckcf_options $named_conf 2>&1`"; exit 1;
echo fi;
echo $"Error in named configuration"':';
echo "$named_err"; ckcf_options='-z'; # enable named-checkzone for each zone (9.3.1+) !
failure if [ -n "${ROOTDIR}" -a "x${ROOTDIR}" != "x/" ]; then
echo OPTIONS="${OPTIONS} -t ${ROOTDIR}"
if [ -x /usr/bin/logger ]; then ckcf_options="$ckcf_options -t ${ROOTDIR}";
echo "$named_err" | /usr/bin/logger -pdaemon.error -tnamed [ -s /etc/localtime ] && cp -fp /etc/localtime ${ROOTDIR}/etc/localtime;
fi; [ -d ${ROOTDIR}/proc ] || mkdir -p ${ROOTDIR}/proc;
return $RETVAL; if ! egrep -q '^/proc[[:space:]]+'${ROOTDIR}'/proc' /proc/mounts; then
fi; mount --bind -n /proc ${ROOTDIR}/proc >/dev/null 2>&1;
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/named fi
echo if [ ! -z $dbusEnabled ]; then
return $RETVAL if ! egrep -q '^/[^[:space:]]+[[:space:]]+'${ROOTDIR}'/var/run/dbus' /proc/mounts; then
mkdir -p ${ROOTDIR}/var/run/dbus
[ -d /var/run/dbus ] || mkdir -p /var/run/dbus;
mount --bind -n /var/run/dbus ${ROOTDIR}/var/run/dbus > /dev/null 2>&1;
fi;
fi;
fi
RETVAL=0
# check if configuration is correct
if [ -x /usr/sbin/named-checkconf ] && [ -x /usr/sbin/named-checkzone ] && /usr/sbin/named-checkconf $ckcf_options ${named_conf} >/dev/null 2>&1; then
daemon /usr/sbin/$named -u named ${OPTIONS};
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
rm -f /var/run/named.pid;
rm -f /var/run/named_sdb.pid;
ln -s $ROOTDIR/var/run/named/named.pid /var/run/named.pid;
[ "$named" = "named_sdb" ] && ln -s $ROOTDIR/var/run/named/named.pid /var/run/named_sdb.pid;
fi;
if [ -n "`/sbin/pidof -o %PPID $named`" ]; then
# Verify that named actually started (JM 2006-10-04)
if [ ! -e $ROOTDIR/var/run/named/named.pid ]; then
# If there is not a file containing the PID of the now running named daemon then create it (JM 2006-10-04)
echo `/sbin/pidof -o %PPID $named` > $ROOTDIR/var/run/named/named.pid;
[ "$named" = "named_sdb" ] && echo `/sbin/pidof -o %PPID $named` > $ROOTDIR/var/run/named/named_sdb.pid;
fi;
fi;
else
named_err="`/usr/sbin/named-checkconf $ckcf_options $named_conf 2>&1`";
echo
echo "Error in named configuration:";
echo "$named_err";
failure
echo
[ -x /usr/bin/logger ] && echo "$named_err" | /usr/bin/logger -pdaemon.error -tnamed;
exit 2;
fi;
if [ $RETVAL -eq 0 ]; then
touch /var/lock/subsys/named;
else
exit 7;
fi
echo
return 0;
} }
stop() { stop() {
# Stop daemons. # Stop daemons.
echo -n $"Stopping $named: " echo -n $"Stopping $named: "
/usr/sbin/rndc stop >/dev/null 2>&1 [ -x /usr/sbin/rndc ] && /usr/sbin/rndc stop >/dev/null 2>&1;
RETVAL=$? RETVAL=$?
# is it still here? # is it still here?
if /sbin/pidof -o %PPID $named >/dev/null; then if /sbin/pidof -o %PPID $named >/dev/null; then
timeout=0 timeout=0
while : ; do while : ; do
if /sbin/pidof -o %PPID $named >/dev/null; then if /sbin/pidof -o %PPID $named >/dev/null; then
if [ $timeout -ge $NAMED_SHUTDOWN_TIMEOUT ]; then if [ $timeout -ge $NAMED_SHUTDOWN_TIMEOUT ]; then
killproc $named -TERM >/dev/null 2>&1 killproc $named -TERM >/dev/null 2>&1
RETVAL=$? RETVAL=$?
echo $"no response, killing with -TERM " echo $"no response, killing with -TERM "
break break
else else
sleep 2 && echo -n "." sleep 2 && echo -n "."
timeout=$((timeout+2)) timeout=$((timeout+2))
fi;
else
break
fi;
done
fi;
if [ $RETVAL -eq 0 ]; then
rm -f /var/lock/subsys/named
rm -f /var/run/named.pid
rm -f /var/run/named_sdb.pid 2>/dev/null
fi;
if [ -n "${ROOTDIR}" -a "x${ROOTDIR}" != "x/" ]; then
if egrep -q '^/proc[[:space:]]+'${ROOTDIR}'/proc' /proc/mounts; then
umount ${ROOTDIR}/proc >/dev/null 2>&1
fi
if [ $dbusEnabled -eq 1 ]; then
if egrep -q '^/[^[:space:]]+[[:space:]]+'${ROOTDIR}'/var/run/dbus' /proc/mounts; then
umount ${ROOTDIR}/var/run/dbus > /dev/null 2>&1
fi;
fi;
fi; fi;
if [ $RETVAL -eq 0 ]; then else
success break
else fi;
failure done
fi; fi;
echo
return $RETVAL # remove pid files
if [ $RETVAL -eq 0 ]; then
rm -f /var/lock/subsys/named
rm -f /var/run/named.pid
rm -f /var/run/named_sdb.pid
fi;
# unmount mounted filesystems/directories
if [ -n "${ROOTDIR}" -a "x${ROOTDIR}" != "x/" ]; then
if egrep -q '^/proc[[:space:]]+'${ROOTDIR}'/proc' /proc/mounts; then
umount ${ROOTDIR}/proc >/dev/null 2>&1
fi
if [ ! -z $dbusEnabled ]; then
if egrep -q '^/[^[:space:]]+[[:space:]]+'${ROOTDIR}'/var/run/dbus' /proc/mounts; then
umount ${ROOTDIR}/var/run/dbus > /dev/null 2>&1
fi;
fi;
fi;
if [ $RETVAL -eq 0 ]; then
success
else
failure
RETVAL=1
fi;
echo
return $RETVAL
} }
rhstatus() { rhstatus() {
/usr/sbin/rndc status [ -x /usr/sbin/rndc ] && /usr/sbin/rndc status;
return $? status /usr/bin/$named;
return $?
} }
restart() { restart() {
stop stop
@ -231,25 +225,7 @@ reload() {
fi fi
[ "$RETVAL" -eq 0 ] && success $"$named reload" || failure $"$named reload" [ "$RETVAL" -eq 0 ] && success $"$named reload" || failure $"$named reload"
echo echo
return $? return $RETVAL
}
probe() {
# named knows how to reload intelligently; we don't want linuxconf
# to offer to restart every time
/usr/sbin/rndc reload >/dev/null 2>&1 || echo start
return $?
}
checkconfig() {
ckcf_options='-z'; # enable named-checkzone for each zone (9.3.1+) !
if [ -n "${ROOTDIR}" -a "x${ROOTDIR}" != "x/" ]; then
OPTIONS="${OPTIONS} -t ${ROOTDIR}"
ckcf_options="$ckcf_options -t ${ROOTDIR}";
fi;
if [ -x /usr/sbin/named-checkconf ] && [ -x /usr/sbin/named-checkzone ] && /usr/sbin/named-checkconf $ckcf_options ${named_conf} | cat ; then
return 0;
else
return 1;
fi
} }
# See how we were called. # See how we were called.
@ -261,7 +237,8 @@ case "$1" in
stop stop
;; ;;
status) status)
rhstatus rhstatus;
RETVAL=$?
;; ;;
restart) restart)
restart restart
@ -272,16 +249,10 @@ case "$1" in
reload) reload)
reload reload
;; ;;
probe)
probe
;;
checkconfig|configtest|check|test)
checkconfig
;;
*) *)
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|probe}" echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
exit 1 exit 3
esac esac
exit $? exit $RETVAL

View File

@ -1,9 +0,0 @@
$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.
1 IN PTR localhost.

View File

@ -1,9 +0,0 @@
$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.
1 IN PTR localhost.

10
named.localhost Normal file
View File

@ -0,0 +1,10 @@
$TTL 1D
@ IN SOA localhost. root.localhost. (
0 ; serial
3H ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
@ IN NS localhost.
@ IN A 127.0.0.1
@ IN AAAA ::1

9
named.loopback Normal file
View File

@ -0,0 +1,9 @@
$TTL 1D
@ IN SOA localhost. root.localhost. (
0 ; serial
3H ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS localhost.
IN PTR localhost.

View File

@ -7,43 +7,34 @@
// //
// See /usr/share/doc/bind*/sample/ for example named configuration files. // See /usr/share/doc/bind*/sample/ for example named configuration files.
// //
zone "." IN {
type hint;
file "named.ca";
};
zone "localdomain" IN { zone "localhost.localdomain" IN {
type master; type master;
file "localdomain.zone"; file "named.localhost";
allow-update { none; }; allow-update { none; };
}; };
zone "localhost" IN { zone "localhost" IN {
type master; type master;
file "localhost.zone"; file "named.localhost";
allow-update { none; }; allow-update { none; };
}; };
zone "0.0.127.in-addr.arpa" IN { zone "1.0.0.127.in-addr.arpa" IN {
type master; type master;
file "named.local"; file "named.loopback";
allow-update { none; }; allow-update { none; };
}; };
zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN { zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
type master;
file "named.ip6.local";
allow-update { none; };
};
zone "255.in-addr.arpa" IN {
type master; type master;
file "named.broadcast"; file "named.loopback";
allow-update { none; }; allow-update { none; };
}; };
zone "0.in-addr.arpa" IN { zone "0.in-addr.arpa" IN { // "this" network
type master; type master;
file "named.zero"; file "named.empty";
allow-update { none; }; allow-update { none; };
}; };

View File

@ -1,8 +0,0 @@
$TTL 86400
@ IN SOA localhost. root.localhost. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS localhost.