From a7cf97ec50d8f91cafad3bdeaecc132bc255a679 Mon Sep 17 00:00:00 2001 From: Adam Tkac Date: Fri, 20 Jul 2007 12:53:34 +0000 Subject: [PATCH] - fixed relation between logrotate and chroot-ed named --- bind-chroot-admin.in | 35 ++++++----------------------------- bind.spec | 8 +++++++- sources | 2 +- 3 files changed, 14 insertions(+), 31 deletions(-) diff --git a/bind-chroot-admin.in b/bind-chroot-admin.in index e11d7e6..d92b74b 100644 --- a/bind-chroot-admin.in +++ b/bind-chroot-admin.in @@ -207,27 +207,6 @@ function disable_bind_chroot() /bin/sed -i -e '/^ROOTDIR=/d' /etc/sysconfig/named; } -function master_zone_writes_enabled() -{ - if selinux_enabled; then - if [ -x /usr/sbin/getsebool ]; then - named_write_master_zones=`/usr/sbin/getsebool named_write_master_zones | cut -d' ' -f3`; - if [ $named_write_master_zones = "on" ]; then - return 0; - else - return 1; - fi; - fi; - fi; - - . /etc/sysconfig/named - if `echo "$ENABLE_ZONE_WRITE" | grep -q '[yY1].*'`; then - return 0; - fi; - - return 1; -} - function sync_files() { rootdir; @@ -249,6 +228,7 @@ function sync_files() do /bin/rm -f $f >/dev/null 2>&1; done + ln -sf ${BIND_CHROOT_PREFIX}/var/log/named.log /var/log/named.log pfx=${BIND_CHROOT_PREFIX} else # chroot is disabled /usr/bin/find /var/named/chroot/{etc/{named.*,rndc.*},var/named{/*,/data/*,/slaves/*,/dynamic/*}} -maxdepth 0 | @@ -259,6 +239,8 @@ function sync_files() [ ! -e $changed ] && touch $changed; fi; done + [ -L /var/log/named.log ] && rm -f /var/log/named.log + [ -e ${BIND_CHROOT_PREFIX}/var/log/named.log ] && mv -f ${BIND_CHROOT_PREFIX}/var/log/named.log /var/log/named.log fi; if [ ! -e ${pfx}/etc/rndc.key ]; then echo 'key "rndckey" { @@ -268,13 +250,8 @@ function sync_files() elif /bin/egrep -q '@KEY@' /etc/rndc.key; then /bin/sed -i -e 's^@KEY@^'`/usr/sbin/dns-keygen`'^' /etc/rndc.key ; fi - if master_zone_writes_enabled; then - chown -h named:named /var/named/* >/dev/null 2>&1; - chown -h named:named ${BIND_CHROOT_PREFIX}/var/named/* >/dev/null 2>&1; - else - chown -h root:named /var/named/* >/dev/null 2>&1; - chown -h root:named ${BIND_CHROOT_PREFIX}/var/named/* >/dev/null 2>&1; - fi + chown -h root:named /var/named/* >/dev/null 2>&1; + chown -h root:named ${BIND_CHROOT_PREFIX}/var/named/* >/dev/null 2>&1; chown -h root:named /etc/{named,rndc}.* >/dev/null 2>&1; chown -h root:named ${BIND_CHROOT_PREFIX}/etc/{named,rndc}.* >/dev/null 2>&1; chmod 750 ${pfx}/var/named >/dev/null 2>&1; @@ -300,7 +277,7 @@ function sync_files() /sbin/restorecon ${BIND_CHROOT_PREFIX} >/dev/null 2>&1; /sbin/restorecon /var/named/named.ca >/dev/null 2>&1; fi; - /sbin/service named condrestart + /sbin/service named try-restart rm -f $changed; fi; if [ $ng -eq 1 ]; then diff --git a/bind.spec b/bind.spec index c138e9d..8f16c4e 100644 --- a/bind.spec +++ b/bind.spec @@ -18,7 +18,7 @@ Summary: The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) serv Name: bind License: BSD-like Version: 9.5.0a5 -Release: 3.9%{?dist} +Release: 4%{?dist} Epoch: 31 Url: http://www.isc.org/products/BIND/ Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -322,6 +322,7 @@ touch ${RPM_BUILD_ROOT}/%{chroot_prefix}/etc/rndc.key touch ${RPM_BUILD_ROOT}/%{chroot_prefix}/dev/null touch ${RPM_BUILD_ROOT}/%{chroot_prefix}/dev/random touch ${RPM_BUILD_ROOT}/%{chroot_prefix}/dev/zero +touch ${RPM_BUILD_ROOT}/%{chroot_prefix}/var/log/named.log #end chroot make DESTDIR=${RPM_BUILD_ROOT} install touch ${RPM_BUILD_ROOT}%{_sysconfdir}/rndc.conf @@ -672,6 +673,8 @@ rm -rf ${RPM_BUILD_ROOT} %dir %{chroot_prefix}/var/named/dynamic %dir %{chroot_prefix}/var/run/named %dir %{chroot_prefix}/var/tmp +%dir %{chroot_prefix}/var/log +%ghost %{chroot_prefix}/var/log/named.log %ghost %{chroot_prefix}/dev/null %ghost %{chroot_prefix}/dev/random %ghost %{chroot_prefix}/dev/zero @@ -679,6 +682,9 @@ rm -rf ${RPM_BUILD_ROOT} %{_sbindir}/bind-chroot-admin %changelog +* Fri Jul 20 2007 Adam Tkac 31:9.5.0a5-4.fc8 +- fixed relation between logrotated and chroot-ed named + * Wed Jul 18 2007 Adam Tkac 31:9.5.0a5-3.9.fc8 - removed bind-sdb package (default named has compiled SDB backend now) - integrated DLZ (Dynamically loadable zones) drivers diff --git a/sources b/sources index f64fce1..c0f0c5b 100644 --- a/sources +++ b/sources @@ -1,4 +1,4 @@ beb3f6e7e8e1f804d1fb79dd11319e1e bind-9.5.0a5.tar.gz -dd2b4f4b795a0a989b0a01f93db3a57b bind-chroot.tar.bz2 +4faa4395b955e5f8a3d50f308b9fabc8 bind-chroot.tar.bz2 bdea8168751a29e61525f11e8195ad48 config.tar 13fef79f99fcefebb51d84b08805de51 libbind-man.tar.gz