Articles

Projects are boundaries

How JailOps separates projects: what a project keeps apart, why another project is treated like an external host, how the firewall closes projects to each other, and how two projects are connected with addresses on both sides. What a project is not.

What a project separates

Names, quotas, networks, firewall.

A project is the unit you give to a team, a customer or an application. It has its own jails, its own networks and storage grants, its own address sets and firewall policies, and its own quotas and access. A name in one project means nothing in another: two projects can each have a jail called web.

There is no default project. Every command acts in one project that you choose with --project or jailops project switch, so what a command touches is never implicit.

Closed to each other

One rule, no exceptions.

Every jail gets a PF anchor, jailops/PROJECT/JAIL. Each project also has an anchor with the project's mandatory policies and a table of the subnets of the other projects, and each network has its own. A jail without a policy still gets an anchor with the isolation in it. Traffic between projects is let through only by a rule you wrote.

That rule has a consequence that makes the model small: another project is treated exactly like an external host. A rule or an address set can name a jail of its own project (jail:web), but never a jail of another project. What crosses the boundary is an address, nothing else.

The project can also have mandatory policies, a floor: a jail's own policies can add rules but cannot weaken the project's defaults.

Connecting two projects

Addresses, written on both sides.

The web jail of project blog (10.30.0.5) needs the database in project shop (10.20.0.10). Each project says its own half, with the address of the other:

project shop: the database lets the web jail in
$ jailops firewall address-set create blog --address 10.30.0.5 \
    --comment "the web jail of project blog"
$ jailops firewall policy create db --default-in deny --default-out allow
$ jailops firewall rule add db in --from set:blog --port 5432 \
    --comment "the web jail of blog"
project blog: the web jail may go out to the database
$ jailops firewall policy create out-db --default-in deny --default-out allow
$ jailops firewall rule add out-db out --to 10.20.0.10 --port 5432 \
    --comment "the shop database"

It is two commands where one could have been, and that is the point. Each project's firewall can be read and reviewed on its own. Nothing in one project changes when someone edits the other, and no command writes a rule into a project it was not asked about. The comments say why each address is there.

For a PostgreSQL jail from the catalog, jailops app allow db --from set:blog takes the same set: the app's project lets the addresses in, and the grant adds the role and the pg_hba.conf lines.

Or put them together

The question to ask first.

Do the two things need to talk to each other as one system, a web jail and its database, a forge and its runners? Then they belong in the same project. In one project they reach each other by name (jail:web), the rules follow the jails when their addresses change, and nothing has to be written out. Use two projects when the two are separate on purpose: different teams, a customer, a test setup next to production.

What a project is not

Be exact about the boundary.

  • Not a kernel boundary. Jails share the host kernel. A tenant that needs isolation judged on its own terms needs a host of its own: a separate pool splits storage and operations, not the kernel.
  • Not isolated from storage a jail was given. A jail with zfs_delegation or a host directory reaches that storage.
  • IP traffic is what the firewall filters. Jails hold single addresses behind the host and the host pins their ARP and neighbor entries, so forged ARP or router advertisements from a jail change nothing; the firewall article has how policies and address sets are written and read.

More articles

Try it on one server.

Try the console from the screenshots, install on a clean FreeBSD 15.1 machine, or add JailOps to a host you already run.