HomeFreeBSD

jail: Add meta and env parameters

Description

jail: Add meta and env parameters

Each one is an arbitrary string associated with a jail. It can be set
upon jail creation or added/modified later:

> jail -cm ... meta="tag1=value1 tag2=value2" env="configuration"

The values are not inherited from the parent jail.

A parent jail can read both metadata parameters, while a child jail can
read only env via security.jail.env sysctl.

The maximum size of meta or env per jail is controlled by the
global security.jail.meta_maxbufsize sysctl. Decreasing it does not
alter the existing meta information.

Each metadata buffer can be handled as a set of key=value\n strings:

> jail -cm ... meta="$(echo k1=v1; echo k2=v2)" env.1=one
> jls meta.k2 env.1 meta.k1

While meta.k1= resets the value to an empty string, the meta.k1 without
the equal sign removes the given key.

Relnotes: yes
Reviewed by: jamie
Tested by: dch
Sponsored by: SkunkWerks GmbH
Differential Revision: https://reviews.freebsd.org/D47668

Details

Provenance
igoroAuthored on Mar 31 2025, 9:08 AM
Reviewer
jamie
Differential Revision
D47668: jail: Add meta and env parameters
Parents
rG197997a4c36d: file: Fix offset handling in kern_copy_file_range()
Branches
Unknown
Tags
Unknown