diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf --- a/libexec/rc/rc.conf +++ b/libexec/rc/rc.conf @@ -735,6 +735,7 @@ ############################################################## jail_enable="NO" # Set to NO to disable starting of any jails jail_conf="/etc/jail.conf" # Configuration file for jail(8) +jail_conf_dir="/etc/jail.conf.d" # Configuration directory for jail(8) jail_confwarn="YES" # Prevent warning about obsolete per-jail configuration jail_parallel_start="NO" # Start jails in the background jail_list="" # Space separated list of names of jails diff --git a/libexec/rc/rc.d/jail b/libexec/rc/rc.d/jail --- a/libexec/rc/rc.d/jail +++ b/libexec/rc/rc.d/jail @@ -455,12 +455,14 @@ _ALL) command=$jail_program rc_flags=$jail_flags - command_args="-f $jail_conf -c" + command_args='-f - -c' if ! checkyesno jail_parallel_start; then command_args="$command_args -p1" fi _tmp=`mktemp -t jail` || exit 3 - if $command $rc_flags $command_args >> $_tmp 2>&1; then + if cat $jail_conf $jail_conf_dir/*.conf \ + /etc/jail.*.conf 2>/dev/null | \ + $command $rc_flags $command_args >> $_tmp 2>&1; then $jail_jls jid name | while read _id _name; do startmsg -n " $_name" echo $_id > /var/run/jail_${_name}.id @@ -485,10 +487,12 @@ eval rc_flags=\${jail_${_jv}_flags:-$jail_flags} eval command=\${jail_${_jv}_program:-$jail_program} - command_args="-i -f $_conf -c $_j" + command_args="-i -f - -c $_j" ( _tmp=`mktemp -t jail_${_j}` || exit 3 - if $command $rc_flags $command_args \ + if cat $jail_conf $_conf $jail_conf_dir/*.conf \ + /etc/jail.*.conf 2>/dev/null | \ + $command $rc_flags $command_args \ >> $_tmp 2>&1 /dev/null | \ + $command $rc_flags $command_args $_j) \ >> $_tmp 2>&1 /dev/null | \ $command $rc_flags $command_args $_j >> $_tmp 2>&1 if $jail_jls -j $_j > /dev/null 2>&1; then cat $_tmp @@ -574,7 +582,9 @@ eval command=\${jail_${_jv}_program:-$jail_program} echo -n " ${_hostname:-${_j}}" _tmp=`mktemp -t jail` || exit 3 - $command -q -f $_conf -r $_j >> $_tmp 2>&1 + cat $_conf $jail_conf $jail_conf_dir/*.conf \ + /etc/jail.*.conf 2>/dev/null | \ + $command -q -f - -r $_j >> $_tmp 2>&1 if $jail_jls -j $_j > /dev/null 2>&1; then cat $_tmp else