Potential bug with using numeric Jail names in /etc/jail.conf

Hi All,

I didn't know where to post this because I could not find a specific jail forum so figured I would post it here as a base system general thread :)

Am no expert so really after some opinions from experienced users and anyone who has seen this happen.
It would be great to know if this is how FreeBSD jails are meant to work or if am not configuring /etc/jails.conf right before posting a bug report.


My server uses -
FreeBSD 12.0-RELEASE-p10, Generic Kernel, ZFS, 64 bit

I noticed two odd things when creating jail definitions in /etc/jails.conf with only numeric names -

1) The jid becomes the same as the jail name, for example a jail called 3434 will have the jid 3434 even without the jid parameter in the jail definition.

I also made a jail with a ridiculously long numeric name of 8888888888888888888888888888888888888888888 just to see what would happen when starting it, this was the result -

/etc/jail.conf -
Code:
8888888888888888888888888888888888888888888 {
$name=8888888888888888888888888888888888888888888;
exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
exec.clean;
mount.devfs;
path="/jails/$name";
host.hostname="$name.jail";
ip4.addr=192.168.1.2;
persist;
}

service jail onestart 8888888888888888888888888888888888888888888

Starting jails: cannot start jail "8888888888888888888888888888888888888888888":
jail: 8888888888888888888888888888888888888888888: negative jid



2) The name parameter does not work, though the jail.conf(5) says "Note the name parameter is implicitly set to the name in the jail definition." I had to define a name variable in the jail definition.

Code:
3434 {
$name=3434;
exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
exec.clean;
mount.devfs;
path="/jails/$name";
host.hostname="$name.jail";
ip4.addr=192.168.1.2;
persist;
}


I made more jails and tested with alpha jail names and alpha-numeric jail names and found no issues with the name parameter and the jails with alpha and alpha-numeric names got a random jid assigned to them.

Not tested wildcards in jail definitions using numeric jail names yet.

Thanks for taking the time to read my thread, any help is much appreciated :)
 
Last edited:
Back
Top