Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 19 Feb 2022 18:46:24 +0000 (UTC)
From:      doug <doug@safeport.com>
To:        Jon Clausen <freebsd-questions@ymmv.dk>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: jail.$jailname.conf not directly in /etc/ ?
Message-ID:  <f9882bc-3ae-b91f-5bbc-22b6a6485c19@safeport.com>
In-Reply-To: <20220219092824.6qmzo33es3w73nj5@c02qx0.local>
References:  <20220219092824.6qmzo33es3w73nj5@c02qx0.local>

next in thread | previous in thread | raw e-mail | index | archive | help


On Sat, 19 Feb 2022, Jon Clausen wrote:

> Hi
>
> I'm reworking my jails setup, transitioning from ezjail to a "manual" setup
> which involves vnet and some homegrown scripts to set up zfs, nullfs
> overlays, epairs, etc.
>
> 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.
>
> I'm making good progress, and am generally happy with everything except
> that I can't find a way to tell the "rc" system to look for the
> jail.$jailname.conf files someplace other than /etc/
>
> Basically, I think it's sort of messy and and impractical to have a bunch of
> individual jail config files laying directly in /etc/. I would prefer to
> have them all under, say, /usr/local/etc/jails/ or even /usr/local/etc/.
>
> But if the files aren't in /etc/, then `service` cannot find them, and jail
> start/stop/whatever operations fail.
>
> I assume that the functionality is there, but the manpages for jail.conf,
> rc.conf aren't making it obvious. And from an (admittedly superficial)
> glance at /etc/rc.d/jail I don't really see how it would work with a
> "global" path for the config files, other than the hardcoded /etc/.
>
> What I was hoping for would be some global setting in /etc/rc.conf,
> /etc/jail.conf or somewhere...
>
> For this round of jails I am working on both 12.3-RELEASE and 13.0-RELEASE,
> (both for the host systems and the jails) so it would be nice to find
> something that works on both versions.
>
> Am I just being dense?
>
> I'm not having much luck finding any discussions about this anywhere
> online either. But I can't believe that this topic has never come up
> before, so I must assume that it's just me failing to compose my search
> terms correctly...
>
> Any ideas?

Ezjail and iocage put the jail configuration in different places. Perhaps 
man jail is the answer:

     -f conf_file
              Use configuration file conf_file instead of the default
              /etc/jail.conf.

I've never done this. I've used the jail command, ezjail, and iocage I've 
always let the tool choose the location of the jail configuration. Moving 
it will mean, at a minimum you will have to rewrite the scripts for: 
starting, stoping, and console. You will also have to do something with 
/etc/rc.conf. If it were me, I'd let sleeping jail configs lie :)

Doug



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?f9882bc-3ae-b91f-5bbc-22b6a6485c19>