New jail related rc.conf variable
jeremie le-hen
le-hen_j at epita.fr
Fri Mar 26 14:46:53 PST 2004
Hi,
while setting up a jail using rc.conf variables, I noticed that although
there were some variables controlling whether or not I want to mount devfs
or procfs, I did not found any simple way to use some nullfs or unionfs
mounts inside it. Therefore, I though that the jail rc script was laking
of flexibility in sense that there is no simple way to do some unusual
configuration before starting the jail and I decided to add a
`jail_example_pre_exec' variable in rc.conf which is simply a command
to execute before jailing.
The scrawny patch is attached.
Regards,
--
Jeremie LE HEN aka ttz jeremie.le-hen at epita.fr
ttz at epita.fr
Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread!
-------------- next part --------------
Index: defaults/rc.conf
===================================================================
RCS file: /home/cvs/FreeBSD/src/etc/defaults/rc.conf,v
retrieving revision 1.202
diff -u -r1.202 rc.conf
--- defaults/rc.conf 23 Mar 2004 23:22:34 -0000 1.202
+++ defaults/rc.conf 26 Mar 2004 21:31:47 -0000
@@ -473,6 +473,8 @@
#jail_example_rootdir="/usr/jail/default" # Jail's root directory
#jail_example_hostname="default.domain.com" # Jail's hostname
#jail_example_ip="192.168.0.10" # Jail's IP number
+#jail_example_pre_exec="" # command to execute just
+ # before jailing.
#jail_example_exec="/bin/sh /etc/rc" # command to execute in jail
#jail_example_devfs_enable="NO" # mount devfs in the jail
#jail_example_fdescfs_enable="NO" # mount fdescfs in the jail
Index: rc.d/jail
===================================================================
RCS file: /home/cvs/FreeBSD/src/etc/rc.d/jail,v
retrieving revision 1.14
diff -u -r1.14 jail
--- rc.d/jail 8 Mar 2004 12:25:05 -0000 1.14
+++ rc.d/jail 26 Mar 2004 22:42:50 -0000
@@ -33,6 +33,7 @@
jail_procdir="${jail_rootdir}/proc"
eval jail_hostname=\"\$jail_${_j}_hostname\"
eval jail_ip=\"\$jail_${_j}_ip\"
+ eval jail_pre_exec=\"\$jail_${_j}_pre_exec\"
eval jail_exec=\"\$jail_${_j}_exec\"
[ -z "${jail_exec}" ] && jail_exec="/bin/sh /etc/rc"
@@ -155,6 +156,7 @@
mount -t procfs proc "${jail_procdir}"
fi
fi
+ [ -n "${jail_pre_exec}" ] && ${jail_pre_exec}
_tmp_jail=/tmp/jail.$$
jail -i ${jail_rootdir} ${jail_hostname} \
${jail_ip} ${jail_exec} > ${_tmp_jail} 2>&1
More information about the freebsd-current
mailing list