1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-17 10:26:15 +00:00
freebsd/etc
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
..
bluetooth Removed whitespace at BOF, EOL & EOF. 2004-06-06 11:46:29 +00:00
defaults Improve the RC framework for the clean booting/shutdown of Jails: 2004-12-14 14:36:35 +00:00
etc.alpha Add dumb console driver and related bits. 2003-10-24 15:44:10 +00:00
etc.amd64 Add dumb console driver and related bits. 2003-10-24 15:44:10 +00:00
etc.arm Add ttyu0 as a serial console, as we're using the uart(4) driver on arm. 2004-09-24 12:51:15 +00:00
etc.i386 Add dumb console driver and related bits. 2003-10-24 15:44:10 +00:00
etc.ia64 turn off getty(8) on ttyv[0-7]. We don't support syscons on ia64 and 2004-10-17 22:20:39 +00:00
etc.powerpc PowerPC ttys file. 2004-02-04 01:44:34 +00:00
etc.sparc64 Catch up with the new device name of sab(4). The entries for tty[a,b] 2004-12-04 14:03:45 +00:00
isdn Removed whitespace at BOF, EOL & EOF. 2004-06-06 11:46:29 +00:00
mail Add user _pflogd. 2004-06-30 16:47:08 +00:00
mtree Add more frequently-used locale directories. This is in preparation 2004-12-04 23:30:36 +00:00
namedb Create a separate directory for dynamic zones which is owned by the bind 2004-11-04 05:24:29 +00:00
pam.d For variables that are only checked with defined(), don't provide 2004-10-24 15:33:08 +00:00
periodic Teach periodic(8) security output to display information about blocked 2004-11-24 18:41:53 +00:00
ppp Catch up with PHK's sio(4) cuaa->cuad rework [sys/dev/sio/sio.c rev. 1.456]. 2004-11-19 17:12:56 +00:00
rc.d Improve the RC framework for the clean booting/shutdown of Jails: 2004-12-14 14:36:35 +00:00
root - Use absolute path for hostname(1) 2004-04-01 19:28:00 +00:00
sendmail Catch up with etc/Makefile,v 1.324 -- split "install" and "distribution" 2004-01-22 17:51:02 +00:00
amd.map
apmd.conf Use separate events for resume from standby and suspend in the apm(4) 2003-12-30 17:40:28 +00:00
auth.conf auth.conf seems to be being gradually subsumed by user classes 2003-07-28 02:28:51 +00:00
crontab
csh.cshrc
csh.login Removed whitespace at BOF, EOL & EOF. 2004-06-06 11:46:29 +00:00
csh.logout
devd.conf Move the purely device-name based entries for mice and ethernet 2004-11-28 23:16:00 +00:00
devfs.conf Removed whitespace at BOF, EOL & EOF. 2004-06-06 11:46:29 +00:00
dhclient.conf
disktab Removed whitespace at BOF, EOL & EOF. 2004-06-06 11:46:29 +00:00
fbtab
ftpusers Add user _pflogd. 2004-06-30 16:47:08 +00:00
gettytab Removed whitespace at BOF, EOL & EOF. 2004-06-06 11:46:29 +00:00
group Add "privsep" user/group _pflogd:_pflogd (64:64) to make pflogd(8) work 2004-06-23 01:32:28 +00:00
hosts Re-add information for applying for IP space from a registry since that 2003-01-28 21:29:23 +00:00
hosts.allow Use RFC 3849 address for examples. 2004-08-03 08:58:34 +00:00
hosts.equiv
hosts.lpd
inetd.conf Removed whitespace at BOF, EOL & EOF. 2004-06-06 11:46:29 +00:00
login.access Removed whitespace at BOF, EOL & EOF. 2004-06-06 11:46:29 +00:00
login.conf Removed whitespace at BOF, EOL & EOF. 2004-06-06 11:46:29 +00:00
mac.conf Add "socket" type to the list of default object types, and by 2003-11-15 02:08:01 +00:00
Makefile 1. Incorporate most of Ruslan's improvements to where and how the 2004-10-08 00:14:28 +00:00
man.alias
master.passwd UUCP's uucico(8) has not been in the base system for some time now, 2004-08-01 21:33:47 +00:00
minfree
motd s/man page/manual page/, to make the default announcement 2003-07-03 06:06:09 +00:00
netconfig
netstart Run /etc/rc.d/routing at the appropriate time. 2004-02-10 19:10:34 +00:00
network.subr 'all' argument for list_net_interfaces() is now unused, remove it. 2004-12-05 21:45:36 +00:00
networks
newsyslog.conf Style: 2004-04-03 17:52:29 +00:00
nls.alias Old-promised removing of deprecated locale names 2003-06-10 01:22:30 +00:00
nsmb.conf
opieaccess Back out previous commit now that pam_opieaccess(8) has an allow_local 2003-02-16 13:04:27 +00:00
pccard_ether Removed whitespace at BOF, EOL & EOF. 2004-06-06 11:46:29 +00:00
pf.conf Bring in some examples (and create space for future work here): 2004-09-14 01:07:19 +00:00
pf.os Update the passive OS fingerprint database from OpenBSD. 2004-09-14 00:30:14 +00:00
phones
printcap Removed whitespace at BOF, EOL & EOF. 2004-06-06 11:46:29 +00:00
profile Removed whitespace at BOF, EOL & EOF. 2004-06-06 11:46:29 +00:00
protocols Link pf to the build and install: 2004-03-08 22:03:29 +00:00
rc Remove an unused variable. 2004-10-08 14:23:49 +00:00
rc.bsdextended Give users the ability to load a mac_bsdextended(4) ruleset on boot (defaults 2004-09-29 00:12:28 +00:00
rc.firewall DNS should not necessarily be named(8), tweak the comment a bit. 2003-11-02 07:31:44 +00:00
rc.firewall6 Use RFC 3849 address for examples. 2004-08-03 08:58:34 +00:00
rc.initdiskless Use utils from /rescue vs. /stand. Also use pax rather than cpio & gzip. 2004-12-12 08:04:26 +00:00
rc.resume Fix a usage message. 2003-12-30 17:30:39 +00:00
rc.sendmail Before trying to restart/stop the MTA or MSP queue runner, make sure 2003-10-19 00:31:50 +00:00
rc.shutdown Improve the RC framework for the clean booting/shutdown of Jails: 2004-12-14 14:36:35 +00:00
rc.subr Add two new rc.conf options: tmpmfs_flags and varmfs_flags. 2004-11-09 10:03:17 +00:00
rc.suspend Make sure pid file creation doesn't complain if it can't create the file. 2004-01-21 03:03:40 +00:00
remote Reflect sio driver device name change cuaa -> cuad 2004-10-13 08:32:34 +00:00
rpc Removed whitespace at BOF, EOL & EOF. 2004-06-06 11:46:29 +00:00
services Add 3653/tcp and 3653/udp, since they were specifically requested. 2004-08-16 11:52:22 +00:00
shells
sysctl.conf Rework the wording of the comment for the security.bsd.see_other_uids 2003-03-13 18:43:50 +00:00
syslog.conf Make sure debug.log only gets debugging messages. 2003-04-23 13:08:31 +00:00
termcap.small Removed whitespace at BOF, EOL & EOF. 2004-06-06 11:46:29 +00:00
usbd.conf Move the purely device-name based entries for mice and ethernet 2004-11-28 23:16:00 +00:00