FreeBSD src
Go to file
Ralf S. Engelschall 62bb1d78fe Improve the RC framework for the clean booting/shutdown of Jails:
1. Feature: for flexibility reasons and as a prerequisite to clean
   shutdowns, allow the configuration of a stop/shutdown command
   via rc.conf variable "jail_<name>_exec_stop" in addition to the
   start/boot command (rc.conf variable "jail_<name>_exec_start"). For
   backward compatibility reasons, rc.conf variable "jail_<name>_exec"
   is still supported, too.

2. Debug: Add the used boot/shutdown commands to the debug output of
   the /etc/rc.d/jail script, too.

3. Security: Run the Jail start/boot command in a cleaned environment
   to not leak information from the host to the Jail during startup.

4. Feature: Run the Jail stop/shutdown command "jail_<name>_exec_stop" on
   "/etc/rc.d/jail stop <name>" to allow a graceful shutdown of the Jail
   before its processes are just killed.

5. Bugfix: When killing the remaining Jail processes give the processes
   time to actually perform their termination sequence. Without this the
   subsequent umount(8) operations usually fail because the resources
   are still in use. Additionally, if after trying to TERM-inate the
   processes there are still processes hanging around, finally just KILL
   them.

6. Bugfix: In rc.shutdown, if running inside a Jail, skip the /etc/rc.d/*
   scripts which are flagged with the KEYWORD "nojail" to allow the
   correct operation of rc.shutdown under jail_<name>_exec_stop="/bin/sh
   /etc/rc.shutdown". This is analogous to what /etc/rc does inside a Jail.

Now the following typical host-configuration for two Jails works as
expected and correctly boots and shutdowns the Jails:

-----------------------------------------------------------
#  /etc/rc.conf:
jail_enable="YES"
jail_list="foo bar"
jail_foo_rootdir="/j/foo"
jail_foo_hostname="foo.example.com"
jail_foo_ip="192.168.0.1"
jail_foo_devfs_enable="YES"
jail_foo_mount_enable="YES"
jail_foo_exec_start="/bin/sh /etc/rc"
jail_foo_exec_stop="/bin/sh /etc/rc.shutdown"
jail_bar_rootdir="/j/bar"
jail_bar_hostname="bar.example.com"
jail_bar_ip="192.168.0.2"
jail_bar_devfs_enable="YES"
jail_bar_mount_enable="YES"
jail_bar_exec_start="/path/to/kjailer -v"
jail_bar_exec_stop="/bin/sh -c 'killall kjailer && sleep 60'"
-----------------------------------------------------------
#  /etc/fstab.foo
/v/foo /j/foo/v/foo nullfs rw 0 0
-----------------------------------------------------------
#  /etc/fstab.bar
/v/bar /j/bar/v/bar nullfs rw 0 0
-----------------------------------------------------------

Reviewed by:	freebsd-hackers
MFC after:	2 weeks
2004-12-14 14:36:35 +00:00
bin o Add a missed "." . 2004-12-02 13:13:27 +00:00
contrib This commit was generated by cvs2svn to compensate for changes in r138451, 2004-12-06 14:33:29 +00:00
crypto Better Xlist command line. 2004-10-28 16:13:28 +00:00
etc Improve the RC framework for the clean booting/shutdown of Jails: 2004-12-14 14:36:35 +00:00
games From Richard W. Hamming ``You and Your Research'' 2004-12-11 21:57:27 +00:00
gnu Add removal of MKTEMP_SH_FUNCTION to processing for cvsbug script. 2004-12-10 18:16:52 +00:00
include According to the information on: 2004-12-10 15:24:40 +00:00
kerberos5 Introduce the PRECIOUSPROG knob in bsd.prog.mk, similar 2004-11-03 18:01:21 +00:00
lib Be more careful about assembling/disassembling 2004-12-11 07:11:42 +00:00
libexec Never emit a message to stderr: use syslog instead. 2004-12-12 17:30:28 +00:00
release Add snd_audiocs(4). 2004-12-14 13:12:29 +00:00
rescue Replace GNU tar with BSD tar. 2004-12-04 08:24:36 +00:00
sbin Back the warnings down from 9 to 6, since that is the highest we have. If 2004-12-13 15:42:46 +00:00
secure Update for OpenSSH 3.9p1. 2004-10-28 16:04:23 +00:00
share Add NetBSD 2.0. 2004-12-14 12:30:43 +00:00
sys - Garbage collect several unused members of struct kse and struce ksegrp. 2004-12-14 10:53:55 +00:00
tools Make kttcp work in -stable (and -current) 2004-12-13 20:40:16 +00:00
usr.bin Add myself to the committers' birthday calendar 2004-12-13 12:22:28 +00:00
usr.sbin Handle select() returning -1/EINTR - fairly common in these KSE days. 2004-12-13 14:50:13 +00:00
COPYRIGHT
installworld_newk Commit the first set of files for changing time_t on freebsd/sparc64 2004-03-03 19:36:20 +00:00
installworld_oldk Commit the first set of files for changing time_t on freebsd/sparc64 2004-03-03 19:36:20 +00:00
MAINTAINERS add myself as the contact for the pkg_install tools 2004-11-30 20:04:47 +00:00
Makefile Unbreak the MAKEOBJDIRPREFIX variable check by avoiding bugs in make(1). 2004-12-13 00:49:52 +00:00
Makefile.inc1 Do not leave build droppings in /usr/src for usr.sbin/pcvt/keycap and 2004-12-01 23:23:14 +00:00
README
UPDATING Mention the necessity for ``enable echo'' in ppp(8). 2004-12-13 17:52:10 +00:00
UPDATING.64BTT Add a tip for people who are using database-related ports on a sparc64 2004-03-17 01:59:47 +00:00

This is the top level of the FreeBSD source directory.  This file
was last revised on:
$FreeBSD$

For copyright information, please see the file COPYRIGHT in this
directory (additional copyright information also exists for some
sources in this tree - please see the specific source directories for
more information).

The Makefile in this directory supports a number of targets for
building components (or all) of the FreeBSD source tree, the most
commonly used one being ``world'', which rebuilds and installs
everything in the FreeBSD system from the source tree except the
kernel, the kernel-modules and the contents of /etc.  The
``buildkernel'' and ``installkernel'' targets build and install
the kernel and the modules (see below).  Please see the top of
the Makefile in this directory for more information on the
standard build targets and compile-time flags.

Building a kernel is a somewhat more involved process, documentation
for which can be found at:
   http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html
And in the config(8) man page.
Note: If you want to build and install the kernel with the
``buildkernel'' and ``installkernel'' targets, you might need to build
world before.  More information is available in the handbook.

The sample kernel configuration files reside in the sys/<arch>/conf
sub-directory (assuming that you've installed the kernel sources), the
file named GENERIC being the one used to build your initial installation
kernel.  The file NOTES contains entries and documentation for all possible
devices, not just those commonly used.  It is the successor of the ancient
LINT file, but in contrast to LINT, it is not buildable as a kernel but a
pure reference and documentation file.


Source Roadmap:
---------------
bin		System/user commands.

contrib		Packages contributed by 3rd parties.

crypto		Cryptography stuff (see crypto/README).

etc		Template files for /etc.

games		Amusements.

gnu		Various commands and libraries under the GNU Public License.
		Please see gnu/COPYING* for more information.

include		System include files.

kerberos5	Kerberos5 (Heimdal) package.

lib		System libraries.

libexec		System daemons.

release		Release building Makefile & associated tools.

sbin		System commands.

secure		Cryptographic libraries and commands.

share		Shared resources.

sys		Kernel sources.

tools		Utilities for regression testing and miscellaneous tasks.

usr.bin		User commands.

usr.sbin	System administration commands.


For information on synchronizing your source tree with one or more of
the FreeBSD Project's development branches, please see:

  http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/synching.html