Re: automatic creation of a chroot environment

Rozhuk Ivan <[email protected]> Sun, 19 Jul 2026 23:01:01 +0300
Newsgroups gmane.os.freebsd.devel.hackers
Message-ID <[email protected]>
On Fri, 17 Jul 2026 08:10:45 -0700
Adrian Chadd <[email protected]> wrote:

> I would really, REALLY like to see sandbox / capability extensions
> that let me do things such as "no you can't access the whole
> filesystem, only binaries/libraries and a sandbox directory, not my
> whole home directory" (which this kind of does?) as well as "why no
> you can't talk to the network directly" - without needing root to
> create a jail first.
> 
> Eg, there's no reason why a little AI agent, some CI test code or a
> shell process which is going to call a bunch of compiler stuff should
> have access to the network.
> 
> If we can figure out a way for users to be able to do this - whether
> it is changes to the kernel, or what apple did (a sandbox service that
> user processes use to request sandboxes be created) or something else?
> That'd be huge.
> 
> 

At least we can hook some libc syscalls like socket()/connect() with some
custom lib via LD_PRELOAD.
Probably MAC framework also can help with this, at least some custom module.
Some basic filtering is added with patch - PF+anchor filters traffic by UID.

In terms of this "framework" it is a bit hacky: many services run under "nobody" user,
and there is no good way to hook process start - it is out of scope for now.

I think I should add some "start" command, but it will not integrated with rc.d scripts, but will
nice to manual run and some other non rc.d usage.