← The specification

Repo: lemonfiber-fence

Rendered from spec at179b4ba (2026-11-23) · its source · Edit this page

Status: Accepted

The image of the fence: a small container that holds a fenced service’s network namespace and refuses every connection that service opens to a private address. One Dockerfile and the program that installs the rules.

Implements: ARCH-R363, and the reading of the render group ARCH-R237 asks for. Its place in the organisation is ADR-0033.


What this repo is

The source of ghcr.io/lemonfiber/fence, which lemonfiber runs beside each service that declares network.fenced. At start it installs nftables rules in the namespace it holds and reports healthy once every rule is in place. The rules refuse new connections to each range the core’s lemonfiber-outward classes as internal, read from that crate, to every IPv6 range whose addresses carry an IPv4 one, and to each address of the engine’s host lemonfiber hands it. They pass the engine’s resolver on port 53 and the answers to connections other services opened. It then holds the namespace and does nothing else. It exits, and so reports unhealthy, where it is handed no host address or any rule cannot be installed, so the service behind it never starts unfenced.

Run as fence addresses, it prints each address of the host whose network it is on, one to a line, and installs nothing. lemonfiber runs it that way on the host’s network, with every capability dropped, to learn the addresses it then hands each fence.

Run as fence render-group, it prints the id of the group that owns the host’s render device under /dev/dri, or nothing where there is none, and installs nothing. lemonfiber runs it that way with the host’s /dev/dri mounted read-only and every capability dropped, to learn the group it adds to a service taking render.

Run as fence ask <method> <port> <path>, it asks 127.0.0.1 at that port on that path, follows no redirect, reads at most 64 KiB of the answer and prints its status, its content-type and its body, and installs nothing. lemonfiber runs it that way in a throwaway container joined to the network namespace of a service that publishes no port, with every capability dropped and a read-only root, to ask that service’s request proofs (ARCH-R430).

What it holds, and what it does not

Holds Does not hold
One Dockerfile, from a base image pinned by digest Any plugin’s manifest, recordings or adapter
The program that installs the rules and holds the namespace Any credential
Tests that start it and prove each range refused and the resolver passed The ranges themselves, which are lemonfiber-outward’s, at the core commit the train releases it with

Releasing

It is on the release train, as every image lemonfiber builds for the stack is (ADR-0033). Its release workflow calls spec’s rust-service-release with pins: bundle, because no plugin’s manifest declares the fence. Every commit on main publishes a commit image under main-<commit>, and bundle-image-pin moves the bundle’s [fence] table to it, writing the table where the bundle holds none, on one rolling pull request in lemonfiber-plugins. A tag the train cuts publishes the tag, and the same pull request moves the table to the image it published, which the core’s release requires (OPS-R94). Each image is built for linux/amd64 and linux/arm64 under one index, with a software bill of materials and a provenance attestation. Its entry in repos.toml carries service = "fence", which is how the train knows it.