]> xenbits.xensource.com Git - people/royger/freebsd.git/commitdiff
Add support for jail.conf.d
authorAntranig Vartanian <antranigv@freebsd.am>
Wed, 8 Sep 2021 07:07:49 +0000 (02:07 -0500)
committerKyle Evans <kevans@FreeBSD.org>
Wed, 9 Mar 2022 21:21:49 +0000 (15:21 -0600)
Using /etc/jail.{jailname}.conf is nice, however it makes /etc/ very
messy if you have many jails.  This patch allows one to move these
config files out of the way into /etc/jail.conf.d/{jailname}.conf.

Note that the same caveat as /etc/jail.*.conf applies: the jail service
will not autodiscover all of these for starting 'all' jails.  This is
considered future work, since the behavior matches.

(cherry picked from commit 7955efd574b98601a95da45d6d8e7f452631fddd)

etc/mtree/BSD.root.dist
libexec/rc/rc.d/jail
share/man/man5/rc.conf.5

index f734f7891429103b2d78a5ac0487cc6493571590..8bea31212217d1d9aabe83f266d37eb36005d348 100644 (file)
@@ -56,6 +56,8 @@
         ..
         gss
         ..
+        jail.conf.d
+        ..
         kyua             tags=package=tests
         ..
         mail
index ff4336131bc9cb2229c47318a2f214955b92e409..1d544501e32ba0c0a361dc33f71efa5dfccc9a1b 100755 (executable)
@@ -120,12 +120,16 @@ parse_options()
        fi
        eval _jconf=\"\${jail_${_jv}_conf:-/etc/jail.${_j}.conf}\"
        eval _rootdir=\"\$jail_${_jv}_rootdir\"
+       eval _jconfdir=\"/etc/jail.conf.d/${_j}.conf\"
        eval _hostname=\"\$jail_${_jv}_hostname\"
        if [ -z "$_rootdir" -o \
             -z "$_hostname" ]; then
                if [ -r "$_jconf" ]; then
                        _conf="$_jconf"
                        return 0
+               elif [ -r "$_jconfdir" ]; then
+                       _conf="$_jconfdir"
+                       return 0
                elif [ -r "$jail_conf" ]; then
                        _conf="$jail_conf"
                        return 0
index fad969b008d8628ed00602d06d366320801e139a..ff9123163a1eaacbcfadc9b9ffb8f181247265e1 100644 (file)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 3, 2022
+.Dd March 9, 2022
 .Dt RC.CONF 5
 .Os
 .Sh NAME
@@ -3899,6 +3899,13 @@ The configuration filename used by
 utility.
 The default value is
 .Pa /etc/jail.conf .
+.Pa /etc/jail.  Ns Ao Ar jname Ac Ns Va .conf
+and
+.Pa /etc/jail.conf.d/ Ns Ao Ar jname Ac Ns Va .conf
+will also be used if
+.Va Ao Ar jname Ac Va
+is set in
+.Va jail_list .
 .It Va jail_parallel_start
 .Pq Vt bool
 If set to