summaryrefslogtreecommitdiffstats
path: root/etc/rc.d
diff options
context:
space:
mode:
authordougb <dougb@FreeBSD.org>2004-09-24 04:53:18 +0000
committerdougb <dougb@FreeBSD.org>2004-09-24 04:53:18 +0000
commitcdf79b2b3708519ec4e09e6837ba6f369960ad03 (patch)
tree7c44950d2d9f0cf7a6ebba7d17534c086ee26e93 /etc/rc.d
parentd0d010090d44ba61364b8a906283c81902df1801 (diff)
downloadFreeBSD-src-cdf79b2b3708519ec4e09e6837ba6f369960ad03.zip
FreeBSD-src-cdf79b2b3708519ec4e09e6837ba6f369960ad03.tar.gz
Update to reflect BIND 9 in the base:
1. Making the pid symlink now has to happen after named starts, otherwise it can generate a fatal error. 2. named-xfer is not part of the BIND 9 world. 3. BIND 9 needs a /dev/random in the chroot directory if chrooted. 4. Only the pid file is symlinked now, the ndc socket is BIND 8 only. 5. Create an rndc.key file for the user if one does not exist. This (generally) allows a BIND 8 config file to be used in a BIND 9 world with little or no modification.
Diffstat (limited to 'etc/rc.d')
-rwxr-xr-xetc/rc.d/named33
1 files changed, 17 insertions, 16 deletions
diff --git a/etc/rc.d/named b/etc/rc.d/named
index eb0d454..a376b7a 100755
--- a/etc/rc.d/named
+++ b/etc/rc.d/named
@@ -14,6 +14,7 @@
name="named"
rcvar=`set_rcvar`
start_precmd="named_precmd"
+start_postcmd="make_symlinks"
required_dirs="$named_chrootdir" # if it is set, it must exist
extra_commands="reload"
@@ -28,24 +29,17 @@ extra_commands="reload"
#
chroot_autoupdate()
{
- # If the named-xfer in the system is newer than the one in the
- # chroot directory or if it (in the chrootdir) doesn't exist
- # copy it over
- #
- if [ ! -x "${named_chrootdir}/usr/libexec/named-xfer" -o \
- "${named_chrootdir}/usr/libexec/named-xfer" -ot \
- /usr/libexec/named-xfer ]; then
- rm -f "${named_chrootdir}/usr/libexec/named-xfer"
- cp -p /usr/libexec/named-xfer "${named_chrootdir}/usr/libexec"
- fi
-
- # Copy /dev/null over, if neccessary. Preserve everything (perms,
+ # Copy devices if neccessary. Preserve everything (perms,
# ownership, mod times).
#
if [ ! -c "${named_chrootdir}/dev/null" ]; then
rm -f "${named_chrootdir}/dev/null"
( cd /dev ; /bin/pax -rw -pe null "${named_chrootdir}/dev" )
fi
+ if [ ! -c "${named_chrootdir}/dev/random" ]; then
+ rm -f "${named_chrootdir}/dev/random"
+ ( cd /dev ; /bin/pax -rw -pe random "${named_chrootdir}/dev" )
+ fi
# Copy local timezone information if it's not up-to-date.
#
@@ -55,21 +49,28 @@ chroot_autoupdate()
fi
}
-# Make symlinks to the correct pid and ndc socket files
+# Make symlinks to the correct pid file
#
make_symlinks()
{
- ln -fs "${named_chrootdir}${named_pidfile}" ${named_pidfile}
- ln -fs "${named_chrootdir}/var/run/ndc" /var/run/ndc
+ checkyesno named_symlink_enable &&
+ ln -fs "${named_chrootdir}${pidfile}" ${pidfile}
}
named_precmd()
{
+ local confgen_chroot
+
# Is the user using a sandbox?
if [ -n "$named_chrootdir" ]; then
rc_flags="$rc_flags -t $named_chrootdir"
+ confgen_chroot="-t${named_chrootdir}"
checkyesno named_chroot_autoupdate && chroot_autoupdate
- checkyesno named_symlink_enable && make_symlinks
+ fi
+
+ # Create an rndc.key file for the user if none exists
+ if [ ! -f "${named_chrootdir}/etc/namedb/rndc.key" ]; then
+ rndc-confgen -a -b256 "${confgen_chroot}"
fi
}
OpenPOWER on IntegriCloud