[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Starting jails early



Both the ezjail service and /etc/rc.d/jail start way too late for network services provided by a jail to be used by the jail host. In particular, this came up with a DNS server.

It appears that a plain FreeBSD jail can be started early like this, but an ezjail would be preferable for easier maintenance.

Of course, the basejail filesystem mount normally done by /etc/fstab.jailname has to be done before the jail can start. Other settings might be needed also.

It looks like ezjail will detect the already-running "early" jail, so it should not attempt to restart it when the actual /usr/local/etc/rc.d/ezjail script is run.

An additional /etc/rc.d/earlyjail script can be started at the right point with

# PROVIDE: earlyjail
# REQUIRE: netwait
# KEYWORD:
# BEFORE:  mountcritremote

Naturally, this needs to be synchronous, pausing startup until the jail is started.

Has anyone done this before? Is there an easier way to do it with ezjail?