Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Feb 2022 10:35:40 +0100
From:      Jon Clausen <freebsd-questions@ymmv.dk>
To:        Sysadmin Lists <sysadmin.lists@mailfence.com>
Cc:        freebsd-questions@freebsd.org, Jon Clausen <freebsd-questions@ymmv.dk>
Subject:   Re: jail.$jailname.conf not directly in /etc/ ?
Message-ID:  <20220220093540.f5jnbqbd7sfpkth7@c02qx0.local>
In-Reply-To: <1024790408.1118263.1645311258751@ichabod.co-bxl>
References:  <20220219092824.6qmzo33es3w73nj5@c02qx0.local> <1024790408.1118263.1645311258751@ichabod.co-bxl>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2022-02-19 23:54:18 (+0100), Sysadmin Lists wrote:

> > ...
> > I'm trying to keep things segregated from the base system, which basically
> > just means that I'm putting all of the datasets, config files and whatever
> > under /usr/local/ somewhere.

> Does it not work if you set up local_startup with /usr/local/rc.conf.d/jail as a directory?

Not as I might have hoped. Moving one of the jail config files from /etc/ 
into a newly created /usr/local/etc/rc.conf.d/jail/ and then issuing 
`service jail status` results on a bunch of errors.
The errors point to the file not being read as a config file, but being
sourced as a "script".
And indeed, this "script" does get sourced;

root@jh03:~ # cat /usr/local/etc/rc.conf.d/jail/local_jail_functions
echo "--- set:"
set

Also, this happens regardless of local_startup being set in rc.conf or not.

> From rc.conf (5): 
>      In addition to /etc/rc.conf.local you can also place smaller
>      configuration files for each rc(8) script in the /etc/rc.conf.d directory
>      or ⟨dir⟩/rc.conf.d directories specified in local_startup, which will be
>      included by the load_rc_config function.  For jail configurations you
>      could use the file /etc/rc.conf.d/jail to store jail specific
>      configuration options.  If local_startup contains /usr/local/etc/rc.d and
>      /opt/conf, /usr/local/rc.conf.d/jail and /opt/conf/rc.conf.d/jail will be
>      loaded.  If ⟨dir⟩/rc.conf.d/⟨name⟩ is a directory, all of files in the
>      directory will be loaded.  Also see the rc_conf_files variable below.

So first of all, it reads (to me at least) to mean that *scripts* or script 
*functions* will be read from (files in) the directory, not config files.
But aside from that, the directories listed seem inconsistent.

As you may have noticed, I put the "script" above in 
/usr/local/etc/rc.conf.d/jail/local_jail_functions

Moving it to (freshly created) /usr/local/rc.conf.d/jail/ results in the
file *not* being sourced, and once again this is independant of
local_startup being set in rc.conf or not.

So I don't think this would work the way I had hoped.
It has given me an idea though, which I will be exploring later...

...I'll unveil that hare-brained scheme once I figure out something about
the rc script sourcing sequence...

br
/jon

-- 
YMMV



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20220220093540.f5jnbqbd7sfpkth7>