From owner-dev-commits-src-main@freebsd.org Fri Sep 10 05:30:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F61C67ECEA; Fri, 10 Sep 2021 05:30:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H5PbX3BBlz4tlS; Fri, 10 Sep 2021 05:30:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 44F2527290; Fri, 10 Sep 2021 05:30:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18A5UW2R039706; Fri, 10 Sep 2021 05:30:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18A5UWGB039705; Fri, 10 Sep 2021 05:30:32 GMT (envelope-from git) Date: Fri, 10 Sep 2021 05:30:32 GMT Message-Id: <202109100530.18A5UWGB039705@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 7955efd574b9 - main - Add support for jail.conf.d MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7955efd574b98601a95da45d6d8e7f452631fddd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 05:30:32 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=7955efd574b98601a95da45d6d8e7f452631fddd commit 7955efd574b98601a95da45d6d8e7f452631fddd Author: Antranig Vartanian AuthorDate: 2021-09-08 07:07:49 +0000 Commit: Kyle Evans CommitDate: 2021-09-10 05:30:04 +0000 Add support for jail.conf.d 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. Reviewed by: kevans MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D24570 --- etc/mtree/BSD.root.dist | 2 ++ libexec/rc/rc.d/jail | 4 ++++ share/man/man5/rc.conf.5 | 9 ++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/etc/mtree/BSD.root.dist b/etc/mtree/BSD.root.dist index f734f7891429..8bea31212217 100644 --- a/etc/mtree/BSD.root.dist +++ b/etc/mtree/BSD.root.dist @@ -56,6 +56,8 @@ .. gss .. + jail.conf.d + .. kyua tags=package=tests .. mail diff --git a/libexec/rc/rc.d/jail b/libexec/rc/rc.d/jail index ff4336131bc9..1d544501e32b 100755 --- a/libexec/rc/rc.d/jail +++ b/libexec/rc/rc.d/jail @@ -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 diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index 57404b8c0e89..b9d22a789c3a 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 8, 2021 +.Dd September 10, 2021 .Dt RC.CONF 5 .Os .Sh NAME @@ -3883,6 +3883,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