mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-04 12:28:58 +00:00
Named normally cannot be started chrooted inside a jail. Thus treat
the jail case specifically. In case we find a proper pre-seeded devfs in the chroot path (mounted from the base system) permit starting chrooted else give proper warn/error messages. PR: conf/103489 Reviewed by: dougb MFC after: 5 days
This commit is contained in:
parent
3e1c5e2b56
commit
507fe729a1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=188293
@ -61,10 +61,23 @@ chroot_autoupdate()
|
||||
|
||||
# Mount a devfs in the chroot directory if needed
|
||||
#
|
||||
umount ${named_chrootdir}/dev 2>/dev/null
|
||||
devfs_domount ${named_chrootdir}/dev devfsrules_hide_all
|
||||
devfs -m ${named_chrootdir}/dev rule apply path null unhide
|
||||
devfs -m ${named_chrootdir}/dev rule apply path random unhide
|
||||
if [ `${SYSCTL_N} security.jail.jailed` -eq 0 ]; then
|
||||
umount ${named_chrootdir}/dev 2>/dev/null
|
||||
devfs_domount ${named_chrootdir}/dev devfsrules_hide_all
|
||||
devfs -m ${named_chrootdir}/dev rule apply path null unhide
|
||||
devfs -m ${named_chrootdir}/dev rule apply path random unhide
|
||||
else
|
||||
if [ -c ${named_chrootdir}/dev/null -a \
|
||||
-c ${named_chrootdir}/dev/random ]; then
|
||||
info "named chroot: using pre-mounted devfs."
|
||||
else
|
||||
err 1 "named chroot: devfs cannot be mounted from" \
|
||||
"within a jail. Thus a chrooted named cannot" \
|
||||
"be run from within a jail." \
|
||||
"To run named without chrooting it, set" \
|
||||
"named_chrootdir=\"\" in /etc/rc.conf."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Copy and/or update key files to the chroot /etc
|
||||
#
|
||||
@ -113,7 +126,12 @@ named_stop()
|
||||
named_poststop()
|
||||
{
|
||||
if [ -n "${named_chrootdir}" -a -c ${named_chrootdir}/dev/null ]; then
|
||||
umount ${named_chrootdir}/dev 2>/dev/null || true
|
||||
if [ `${SYSCTL_N} security.jail.jailed` -eq 0 ]; then
|
||||
umount ${named_chrootdir}/dev 2>/dev/null || true
|
||||
else
|
||||
warn "named chroot:" \
|
||||
"cannot unmount devfs from inside jail!"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user