Bug 228066

Summary: Jail hook missing between launch and exec.start
Product: Base System Reporter: gronke <stefan>
Component: binAssignee: freebsd-jail mailing list <jail>
Status: Closed FIXED    
Severity: Affects Some People CC: allanjude, crest, gonzo, jamie, netchild
Priority: --- Keywords: patch
Version: CURRENT   
Hardware: Any   
OS: Any   

Description gronke 2018-05-08 10:54:59 UTC
There currently is no jail launch hook available between the launch of a jail and the internal execution of exec.start.

When there is a task that needs to be done on host side that requires the jail to be running (or needs to know its JID), another hook is required.

Right now vnet.interface does only allow to specify one vnet interface that is attached to the jail, but it would be need to have a generic hook that allows adding them manually.

More tasks that require another jail hook on host-side:

- Attaching ZFS storage before the exec.start or command executes
- Attaching multiple VNET interfaces
- Configuring the firewall on the host
Comment 1 gronke 2018-05-08 10:55:41 UTC
This patch adds another hook called exec.started:

https://reviews.freebsd.org/D15330
Comment 2 commit-hook freebsd_committer 2018-08-15 18:35:52 UTC
A commit references this bug:

Author: netchild
Date: Wed Aug 15 18:35:43 UTC 2018
New revision: 337863
URL: https://svnweb.freebsd.org/changeset/base/337863

Log:
  - Add exec hook "exec.created". This is called when the jail is
    created and before exec.start is called.			[1]
  - Bump __FreeBSD_version.

  This allows to attach ZFS datasets and various other things to be
  done before any command/service/rc-script is started in the new
  jail.

  PR:			228066					[1]
  Reviewed by:		jamie					[1]
  Submitted by:		Stefan Gr?nke <stefan@gronke.net>	[1]
  Differential Revision:	https://reviews.freebsd.org/D15330	[1]

Changes:
  head/sys/sys/param.h
  head/usr.sbin/jail/command.c
  head/usr.sbin/jail/config.c
  head/usr.sbin/jail/jail.8
  head/usr.sbin/jail/jail.c
  head/usr.sbin/jail/jailp.h
Comment 3 Oleksandr Tymoshenko freebsd_committer freebsd_triage 2019-01-21 22:04:09 UTC
There is a commit referencing this PR, but it's still not closed and has been inactive for some time. Closing the PR as fixed but feel free to re-open it if the issue hasn't been completely resolved.

Thanks