- 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:
parent
7fdb7fd693
commit
e51da3145d
150
bind.spec
150
bind.spec
@ -16,7 +16,7 @@ Summary: The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) serv
|
||||
Name: bind
|
||||
License: BSD-like
|
||||
Version: 9.4.1
|
||||
Release: 5%{?dist}
|
||||
Release: 6%{?dist}
|
||||
Epoch: 31
|
||||
Url: http://www.isc.org/products/BIND/
|
||||
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
@ -37,21 +37,18 @@ Source11: named.service
|
||||
Source12: README.sdb_pgsql
|
||||
Source13: namedSetForwarders
|
||||
Source14: namedGetForwarders
|
||||
Source16: named.caching-nameserver.conf
|
||||
Source16: named.conf
|
||||
Source17: named.root
|
||||
Source18: named.local
|
||||
Source19: localhost.zone
|
||||
Source20: localdomain.zone
|
||||
Source21: named.ip6.local
|
||||
Source22: named.broadcast
|
||||
Source23: named.zero
|
||||
Source24: Copyright.caching-nameserver
|
||||
Source26: bind-chroot-admin.in
|
||||
Source27: named.rfc1912.zones
|
||||
Source28: libbind.pc
|
||||
Source29: named.conf.sample
|
||||
Source30: named.rfc1912.zones.sample
|
||||
Source31: named.root.hints
|
||||
Source18: named.localhost
|
||||
Source19: named.loopback
|
||||
Source20: named.empty
|
||||
Source21: Copyright.caching-nameserver
|
||||
Source22: bind-chroot-admin.in
|
||||
Source23: named.rfc1912.zones
|
||||
Source24: libbind.pc
|
||||
Source25: named.conf.sample
|
||||
Source26: named.rfc1912.zones.sample
|
||||
Source27: named.root.hints
|
||||
|
||||
# Common patches
|
||||
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(pre): shadow-utils
|
||||
Requires(preun):chkconfig >= 1.3.26
|
||||
Obsoletes: bind-config
|
||||
Provides: bind-config
|
||||
%if %{selinux}
|
||||
Requires(post): policycoreutils
|
||||
%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
|
||||
|
||||
|
||||
%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
|
||||
Summary: A chroot runtime environment for the ISC BIND DNS server, named(8)
|
||||
Group: System Environment/Daemons
|
||||
@ -391,7 +365,7 @@ cp -fp %{SOURCE12} contrib/sdb/pgsql/
|
||||
%if %{LIBBIND}
|
||||
gunzip < %{SOURCE9} | (cd ${RPM_BUILD_ROOT}/usr/share; tar -xpf -)
|
||||
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
|
||||
%if %{WITH_DBUS}
|
||||
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:
|
||||
touch ${RPM_BUILD_ROOT}/etc/named.conf
|
||||
# caching-nameserver files:
|
||||
# configuration files:
|
||||
mkdir -p ${RPM_BUILD_ROOT}/{etc,var/named}
|
||||
install -m 644 %{SOURCE16} ${RPM_BUILD_ROOT}/etc/named.caching-nameserver.conf
|
||||
install -m 644 %{SOURCE27} ${RPM_BUILD_ROOT}/etc/named.rfc1912.zones
|
||||
install -m 644 %{SOURCE16} ${RPM_BUILD_ROOT}/etc/named.conf
|
||||
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 %{SOURCE18} ${RPM_BUILD_ROOT}/var/named/named.local
|
||||
install -m 644 %{SOURCE19} ${RPM_BUILD_ROOT}/var/named/localhost.zone
|
||||
install -m 644 %{SOURCE20} ${RPM_BUILD_ROOT}/var/named/localdomain.zone
|
||||
install -m 644 %{SOURCE21} ${RPM_BUILD_ROOT}/var/named/named.ip6.local
|
||||
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
|
||||
install -m 644 %{SOURCE18} ${RPM_BUILD_ROOT}/var/named/named.localhost
|
||||
install -m 644 %{SOURCE19} ${RPM_BUILD_ROOT}/var/named/named.loopback
|
||||
install -m 644 %{SOURCE20} ${RPM_BUILD_ROOT}/var/named/named.empty
|
||||
for f in /etc/named.conf /var/named/{named.ca,named.localhost,named.loopback,named.empty}; do
|
||||
touch ${RPM_BUILD_ROOT}/%{chroot_prefix}/$f;
|
||||
done
|
||||
install -m 644 %{SOURCE5} ./rfc1912.txt
|
||||
install -m 644 %{SOURCE24} ./Copyright
|
||||
install -m 644 %{SOURCE21} ./Copyright
|
||||
# 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}
|
||||
# sample bind configuration files for %doc:
|
||||
mkdir -p sample/etc sample/var/named/{data,slaves}
|
||||
cp -fp %{SOURCE29} sample/etc/named.conf
|
||||
cp -fp %{SOURCE30} sample/etc/named.rfc1912.zones
|
||||
cp -fp %{SOURCE31} sample/etc/
|
||||
cp -fp %{SOURCE17} %{SOURCE18} %{SOURCE19} %{SOURCE20} %{SOURCE21} %{SOURCE22} %{SOURCE23} sample/var/named
|
||||
cp -fp %{SOURCE25} sample/etc/named.conf
|
||||
cp -fp %{SOURCE26} sample/etc/named.rfc1912.zones
|
||||
cp -fp %{SOURCE27} sample/etc/
|
||||
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
|
||||
echo '@ in soa localhost. root 1 3H 15M 1W 1D
|
||||
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 ;
|
||||
fi
|
||||
[ -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
|
||||
:;
|
||||
|
||||
@ -537,17 +512,6 @@ fi
|
||||
%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
|
||||
if [ "$1" -gt 0 ]; then
|
||||
/usr/sbin/bind-chroot-admin --enable > /dev/null 2>&1;
|
||||
@ -609,6 +573,21 @@ rm -rf ${RPM_BUILD_ROOT}
|
||||
%files
|
||||
%defattr(0640,root,named,0750)
|
||||
%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)
|
||||
%dir /var/named/slaves
|
||||
%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
|
||||
# ^- Let the named internal default rndc.conf be used -
|
||||
# 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
|
||||
# ^- The default rndc.conf which uses rndc.key is in named's default internal config -
|
||||
# so rndc.conf is not necessary.
|
||||
@ -705,32 +682,6 @@ rm -rf ${RPM_BUILD_ROOT}
|
||||
%{_mandir}/man5/libbind-*
|
||||
%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
|
||||
%defattr(0640,root,named,0750)
|
||||
%dir %prefix
|
||||
@ -740,7 +691,6 @@ rm -rf ${RPM_BUILD_ROOT}
|
||||
%dir %prefix/var/run
|
||||
%dir %prefix/var/named
|
||||
%ghost %config(noreplace) %prefix/etc/named.conf
|
||||
%ghost %config(noreplace) %prefix/etc/named.caching-nameserver.conf
|
||||
%ghost %config(noreplace) %prefix/etc/rndc.key
|
||||
%defattr(0660,named,named,0770)
|
||||
%dir %prefix/var/named/slaves
|
||||
@ -772,6 +722,12 @@ rm -rf ${RPM_BUILD_ROOT}
|
||||
%endif
|
||||
|
||||
%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
|
||||
- very minor compatibility change in bind-chroot-admin (line 215)
|
||||
- enabled IDN support by default and don't distribute IDN libraries
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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.
|
@ -11,6 +11,7 @@
|
||||
// to create named.conf - edits to this file will be lost on
|
||||
// caching-nameserver package upgrade.
|
||||
//
|
||||
|
||||
options {
|
||||
listen-on port 53 { 127.0.0.1; };
|
||||
listen-on-v6 port 53 { ::1; };
|
||||
@ -21,10 +22,18 @@ options {
|
||||
allow-query { localhost; };
|
||||
recursion yes;
|
||||
};
|
||||
|
||||
logging {
|
||||
channel default_debug {
|
||||
file "data/named.run";
|
||||
severity dynamic;
|
||||
};
|
||||
};
|
||||
|
||||
zone "." IN {
|
||||
type hint;
|
||||
file "named.ca";
|
||||
};
|
||||
|
||||
include "/etc/named.rfc1912.zones";
|
||||
|
8
named.empty
Normal file
8
named.empty
Normal 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.
|
387
named.init
387
named.init
@ -8,17 +8,22 @@
|
||||
# that is used to resolve host names to IP addresses.
|
||||
# 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.
|
||||
. /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
|
||||
|
||||
RETVAL=0
|
||||
|
||||
# Don't kill named during clean-up
|
||||
NAMED_SHUTDOWN_TIMEOUT=${NAMED_SHUTDOWN_TIMEOUT:-100}
|
||||
|
||||
@ -30,191 +35,180 @@ if [ -n "$ROOTDIR" ]; then
|
||||
fi;
|
||||
fi
|
||||
|
||||
RETVAL=0
|
||||
# Run SDB backend?
|
||||
named='named'
|
||||
if [[ "$ENABLE_SDB" = [yY1]* ]] && [ -x /usr/sbin/named_sdb ]; then
|
||||
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;
|
||||
if `echo "$ENABLE_SDB" | grep -q ^[yY1].*`; then
|
||||
named='named_sdb';
|
||||
fi;
|
||||
|
||||
dbusEnabled=0;
|
||||
# Manage forwarders through D-BUS?
|
||||
for a in $OPTIONS; do
|
||||
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;
|
||||
if [ $a = "-D" ]; then
|
||||
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() {
|
||||
# Start daemons.
|
||||
echo -n $"Starting $named: "
|
||||
if [ -n "`/sbin/pidof -o %PPID $named`" ]; then
|
||||
echo -n $"$named: already running"
|
||||
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
|
||||
# Check if all what named needs running
|
||||
start()
|
||||
{
|
||||
# Source networking configuration.
|
||||
[ -r /etc/sysconfig/network ] && . /etc/sysconfig/network
|
||||
|
||||
conf_ok=0;
|
||||
if [ -x /usr/sbin/named-checkconf ] && [ -x /usr/sbin/named-checkzone ] && /usr/sbin/named-checkconf $ckcf_options ${named_conf} >/dev/null 2>&1; then
|
||||
conf_ok=1;
|
||||
else
|
||||
RETVAL=$?;
|
||||
fi
|
||||
if [ $conf_ok -eq 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 2>/dev/null
|
||||
ln -s $ROOTDIR/var/run/named/named.pid /var/run/named.pid;
|
||||
if [ "$named" = "named_sdb" ]; then
|
||||
ln -s $ROOTDIR/var/run/named/named.pid /var/run/named_sdb.pid;
|
||||
fi;
|
||||
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;
|
||||
if [ "$named" = "named_sdb" ]; then
|
||||
echo `/sbin/pidof -o %PPID $named` > $ROOTDIR/var/run/named/named_sdb.pid;
|
||||
fi;
|
||||
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
|
||||
if [ -x /usr/bin/logger ]; then
|
||||
echo "$named_err" | /usr/bin/logger -pdaemon.error -tnamed
|
||||
fi;
|
||||
return $RETVAL;
|
||||
fi;
|
||||
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/named
|
||||
echo
|
||||
return $RETVAL
|
||||
# Check that networking is up
|
||||
[ "${NETWORKING}" = "no" ] && exit 1
|
||||
|
||||
|
||||
[ -x /usr/sbin/$named ] || exit 5
|
||||
|
||||
# Handle -c option
|
||||
previous_option='unspecified';
|
||||
for a in $OPTIONS; do
|
||||
if [ $previous_option = '-c' ]; then
|
||||
named_conf=$a;
|
||||
fi;
|
||||
previous_option=$a;
|
||||
done;
|
||||
|
||||
named_conf=${named_conf:-/etc/named.conf};
|
||||
|
||||
if [ ! -r $named_conf ]; then
|
||||
echo 'Cannot find configuration file. You could create it by system-config-bind'
|
||||
exit 6;
|
||||
fi;
|
||||
|
||||
# all pre-start is done, lets start named
|
||||
echo -n $"Starting $named: "
|
||||
if [ -n "`/sbin/pidof -o %PPID $named`" ]; then
|
||||
echo -n $"$named: already running"
|
||||
failure
|
||||
echo
|
||||
exit 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}";
|
||||
[ -s /etc/localtime ] && cp -fp /etc/localtime ${ROOTDIR}/etc/localtime;
|
||||
[ -d ${ROOTDIR}/proc ] || mkdir -p ${ROOTDIR}/proc;
|
||||
if ! egrep -q '^/proc[[:space:]]+'${ROOTDIR}'/proc' /proc/mounts; then
|
||||
mount --bind -n /proc ${ROOTDIR}/proc >/dev/null 2>&1;
|
||||
fi
|
||||
if [ ! -z $dbusEnabled ]; then
|
||||
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 daemons.
|
||||
echo -n $"Stopping $named: "
|
||||
/usr/sbin/rndc stop >/dev/null 2>&1
|
||||
RETVAL=$?
|
||||
# is it still here?
|
||||
if /sbin/pidof -o %PPID $named >/dev/null; then
|
||||
timeout=0
|
||||
while : ; do
|
||||
if /sbin/pidof -o %PPID $named >/dev/null; then
|
||||
if [ $timeout -ge $NAMED_SHUTDOWN_TIMEOUT ]; then
|
||||
killproc $named -TERM >/dev/null 2>&1
|
||||
RETVAL=$?
|
||||
echo $"no response, killing with -TERM "
|
||||
break
|
||||
else
|
||||
sleep 2 && echo -n "."
|
||||
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;
|
||||
# Stop daemons.
|
||||
echo -n $"Stopping $named: "
|
||||
[ -x /usr/sbin/rndc ] && /usr/sbin/rndc stop >/dev/null 2>&1;
|
||||
RETVAL=$?
|
||||
# is it still here?
|
||||
if /sbin/pidof -o %PPID $named >/dev/null; then
|
||||
timeout=0
|
||||
while : ; do
|
||||
if /sbin/pidof -o %PPID $named >/dev/null; then
|
||||
if [ $timeout -ge $NAMED_SHUTDOWN_TIMEOUT ]; then
|
||||
killproc $named -TERM >/dev/null 2>&1
|
||||
RETVAL=$?
|
||||
echo $"no response, killing with -TERM "
|
||||
break
|
||||
else
|
||||
sleep 2 && echo -n "."
|
||||
timeout=$((timeout+2))
|
||||
fi;
|
||||
if [ $RETVAL -eq 0 ]; then
|
||||
success
|
||||
else
|
||||
failure
|
||||
fi;
|
||||
echo
|
||||
return $RETVAL
|
||||
else
|
||||
break
|
||||
fi;
|
||||
done
|
||||
fi;
|
||||
|
||||
# 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() {
|
||||
/usr/sbin/rndc status
|
||||
return $?
|
||||
[ -x /usr/sbin/rndc ] && /usr/sbin/rndc status;
|
||||
status /usr/bin/$named;
|
||||
return $?
|
||||
}
|
||||
restart() {
|
||||
stop
|
||||
@ -231,25 +225,7 @@ reload() {
|
||||
fi
|
||||
[ "$RETVAL" -eq 0 ] && success $"$named reload" || failure $"$named reload"
|
||||
echo
|
||||
return $?
|
||||
}
|
||||
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
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
# See how we were called.
|
||||
@ -261,7 +237,8 @@ case "$1" in
|
||||
stop
|
||||
;;
|
||||
status)
|
||||
rhstatus
|
||||
rhstatus;
|
||||
RETVAL=$?
|
||||
;;
|
||||
restart)
|
||||
restart
|
||||
@ -272,16 +249,10 @@ case "$1" in
|
||||
reload)
|
||||
reload
|
||||
;;
|
||||
probe)
|
||||
probe
|
||||
;;
|
||||
checkconfig|configtest|check|test)
|
||||
checkconfig
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|probe}"
|
||||
exit 1
|
||||
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
|
||||
exit 3
|
||||
esac
|
||||
|
||||
exit $?
|
||||
exit $RETVAL
|
||||
|
||||
|
@ -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.
|
@ -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
10
named.localhost
Normal 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
9
named.loopback
Normal 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.
|
@ -7,43 +7,34 @@
|
||||
//
|
||||
// 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;
|
||||
file "localdomain.zone";
|
||||
file "named.localhost";
|
||||
allow-update { none; };
|
||||
};
|
||||
|
||||
zone "localhost" IN {
|
||||
type master;
|
||||
file "localhost.zone";
|
||||
file "named.localhost";
|
||||
allow-update { none; };
|
||||
};
|
||||
|
||||
zone "0.0.127.in-addr.arpa" IN {
|
||||
zone "1.0.0.127.in-addr.arpa" IN {
|
||||
type master;
|
||||
file "named.local";
|
||||
file "named.loopback";
|
||||
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 {
|
||||
type master;
|
||||
file "named.ip6.local";
|
||||
allow-update { none; };
|
||||
};
|
||||
|
||||
zone "255.in-addr.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.broadcast";
|
||||
file "named.loopback";
|
||||
allow-update { none; };
|
||||
};
|
||||
|
||||
zone "0.in-addr.arpa" IN {
|
||||
zone "0.in-addr.arpa" IN { // "this" network
|
||||
type master;
|
||||
file "named.zero";
|
||||
file "named.empty";
|
||||
allow-update { none; };
|
||||
};
|
||||
|
||||
|
@ -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.
|
Loading…
Reference in New Issue
Block a user