aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/jail/jail.8
diff options
context:
space:
mode:
authorRyan Moeller <freqlabs@FreeBSD.org>2020-05-14 23:38:11 +0000
committerRyan Moeller <freqlabs@FreeBSD.org>2020-05-14 23:38:11 +0000
commit66005c453d5b4f229e469b8a6a92e95f813989d7 (patch)
treebaf6e9b3694ac8c627db8698fbee707ec9f6913e /usr.sbin/jail/jail.8
parent1d2e31af148a42bde25a82dec38de3992a0ee5aa (diff)
downloadsrc-66005c453d5b4f229e469b8a6a92e95f813989d7.tar.gz
src-66005c453d5b4f229e469b8a6a92e95f813989d7.zip
jail: Add exec.prepare and exec.release command hooks
This change introduces new jail command hooks that run before and after any other actions. The exec.prepare hook can be used for example to invoke a script that checks if the jail's root exists, creating it if it does not. Since arbitrary variables in jail.conf can be passed to the command, it can be pretty useful for templating jails. An example use case for exec.release would be to remove the filesystem of an ephemeral jail. The names "prepare" and "release" are borrowed from the names of similar hooks in libvirt. Reviewed by: jamie, manpages, mmacy Approved by: mmacy (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D24829
Notes
Notes: svn path=/head/; revision=361066
Diffstat (limited to 'usr.sbin/jail/jail.8')
-rw-r--r--usr.sbin/jail/jail.812
1 files changed, 11 insertions, 1 deletions
diff --git a/usr.sbin/jail/jail.8 b/usr.sbin/jail/jail.8
index b813daff3b53..b43eb765292b 100644
--- a/usr.sbin/jail/jail.8
+++ b/usr.sbin/jail/jail.8
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 17, 2020
+.Dd May 14, 2020
.Dt JAIL 8
.Os
.Sh NAME
@@ -726,6 +726,11 @@ not be created or removed, as appropriate.
.Pp
The pseudo-parameters are:
.Bl -tag -width indent
+.It Va exec.prepare
+Command(s) to run in the system environment to prepare a jail for creation.
+These commands are executed before assigning IP addresses and mounting
+filesystems, so they may be used to create a new jail filesystem if it does
+not already exist.
.It Va exec.prestart
Command(s) to run in the system environment before a jail is created.
.It Va exec.created
@@ -760,6 +765,11 @@ A typical command to run is
.Dq sh /etc/rc.shutdown jail .
.It Va exec.poststop
Command(s) to run in the system environment after a jail is removed.
+.It Va exec.release
+Command(s) to run in the system environment after all other actions are done.
+These commands are executed after unmounting filesystems and removing IP
+addresses, so they may be used to remove a jail filesystem if it is no longer
+needed.
.It Va exec.clean
Run commands in a clean environment.
The environment is discarded except for