diff --git a/sys/sys/param.h b/sys/sys/param.h index e1a04568b8de..d9ea39a31a93 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200077 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200078 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, diff --git a/usr.sbin/jail/command.c b/usr.sbin/jail/command.c index 330328accfb8..53f4f80862ce 100644 --- a/usr.sbin/jail/command.c +++ b/usr.sbin/jail/command.c @@ -147,8 +147,8 @@ next_command(struct cfjail *j) } if (j->comstring == NULL || j->comstring->len == 0 || (create_failed && (comparam == IP_EXEC_PRESTART || - comparam == IP_EXEC_START || comparam == IP_COMMAND || - comparam == IP_EXEC_POSTSTART))) + comparam == IP_EXEC_CREATED || comparam == IP_EXEC_START || + comparam == IP_COMMAND || comparam == IP_EXEC_POSTSTART))) continue; switch (run_command(j)) { case -1: diff --git a/usr.sbin/jail/config.c b/usr.sbin/jail/config.c index cb353ed4563e..8a33168999b8 100644 --- a/usr.sbin/jail/config.c +++ b/usr.sbin/jail/config.c @@ -73,6 +73,7 @@ static const struct ipspec intparams[] = { [IP_EXEC_POSTSTOP] = {"exec.poststop", PF_INTERNAL}, [IP_EXEC_PRESTART] = {"exec.prestart", PF_INTERNAL}, [IP_EXEC_PRESTOP] = {"exec.prestop", PF_INTERNAL}, + [IP_EXEC_CREATED] = {"exec.created", PF_INTERNAL}, [IP_EXEC_START] = {"exec.start", PF_INTERNAL}, [IP_EXEC_STOP] = {"exec.stop", PF_INTERNAL}, [IP_EXEC_SYSTEM_JAIL_USER]= {"exec.system_jail_user", diff --git a/usr.sbin/jail/jail.8 b/usr.sbin/jail/jail.8 index f5ea5d1fce75..6b2d55c49f62 100644 --- a/usr.sbin/jail/jail.8 +++ b/usr.sbin/jail/jail.8 @@ -706,6 +706,9 @@ The pseudo-parameters are: .Bl -tag -width indent .It Va exec.prestart Command(s) to run in the system environment before a jail is created. +.It Va exec.created +Command(s) to run in the system environment right after a jail has been +created, but before commands (or services) get executed in the jail. .It Va exec.start Command(s) to run in the jail environment when a jail is created. A typical command to run is diff --git a/usr.sbin/jail/jail.c b/usr.sbin/jail/jail.c index c5f04fe8b9aa..ee0bb7c4212f 100644 --- a/usr.sbin/jail/jail.c +++ b/usr.sbin/jail/jail.c @@ -98,6 +98,7 @@ static const enum intparam startcommands[] = { IP_MOUNT_PROCFS, IP_EXEC_PRESTART, IP__OP, + IP_EXEC_CREATED, IP_VNET_INTERFACE, IP_EXEC_START, IP_COMMAND, diff --git a/usr.sbin/jail/jailp.h b/usr.sbin/jail/jailp.h index 399d0b886955..82d31c65a337 100644 --- a/usr.sbin/jail/jailp.h +++ b/usr.sbin/jail/jailp.h @@ -88,6 +88,7 @@ enum intparam { IP_EXEC_POSTSTOP, /* Commands run outside jail after removing */ IP_EXEC_PRESTART, /* Commands run outside jail before creating */ IP_EXEC_PRESTOP, /* Commands run outside jail before removing */ + IP_EXEC_CREATED, /* Commands run outside jail right after it was started */ IP_EXEC_START, /* Commands run inside jail on creation */ IP_EXEC_STOP, /* Commands run inside jail on removal */ IP_EXEC_SYSTEM_JAIL_USER,/* Get jail_user from system passwd file */