Index: usr.sbin/jail/command.c =================================================================== --- usr.sbin/jail/command.c +++ usr.sbin/jail/command.c @@ -147,8 +147,8 @@ } 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: Index: usr.sbin/jail/config.c =================================================================== --- usr.sbin/jail/config.c +++ usr.sbin/jail/config.c @@ -73,6 +73,7 @@ [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", Index: usr.sbin/jail/jail.8 =================================================================== --- usr.sbin/jail/jail.8 +++ usr.sbin/jail/jail.8 @@ -706,6 +706,9 @@ .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 Index: usr.sbin/jail/jail.c =================================================================== --- usr.sbin/jail/jail.c +++ usr.sbin/jail/jail.c @@ -98,6 +98,7 @@ IP_MOUNT_PROCFS, IP_EXEC_PRESTART, IP__OP, + IP_EXEC_CREATED, IP_VNET_INTERFACE, IP_EXEC_START, IP_COMMAND, Index: usr.sbin/jail/jailp.h =================================================================== --- usr.sbin/jail/jailp.h +++ usr.sbin/jail/jailp.h @@ -88,6 +88,7 @@ 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 */