Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ An embedded signing authority issues short-lived workload certificates. It sits

A single static Go binary (`innerwall-agent`), structured as a few independent pieces sharing local state (ADR-0011):

1. **Sync daemon** — maintains the gRPC stream, applies each snapshot or delta strictly in order as one complete policy through the installed-policy store (enforcement, below, runs synchronously inside that apply), ACKs versions (FAILED with the reason when an apply is refused, staying on the last good version), reports inventory and heartbeats at the intervals the control plane sets (each heartbeat reading whether the owned table is still in the kernel, since the kill switch removes it without changing any version), and reconnects with jittered backoff, always from a fresh snapshot. A renewal timer beside it rotates the credential beginning by the two-thirds mark of its lifetime, by the wall clock or by monotonic time elapsed since the credential was obtained, whichever says so first; jitter moves the first attempt earlier, never later, so at least a third of the lifetime always remains for retries. The renewed credential is swapped in without dropping the stream. Expiry is never fatal: an agent whose credential lapsed (at start, or while the control plane was away) keeps enforcing from disk and keeps retrying renewal, which the control plane accepts within its renewal grace (ADR-0016 as amended).
1. **Sync daemon** — maintains the gRPC stream, applies each snapshot or delta strictly in order as one complete policy through the installed-policy store (enforcement, below, runs synchronously inside that apply), ACKs versions (FAILED with the reason when an apply is refused, staying on the last good version), reports inventory and heartbeats at the intervals the control plane sets (each heartbeat reading whether the owned table is still in the kernel, since the kill switch removes it without changing any version), and reconnects with jittered backoff, always from a fresh snapshot. A renewal timer beside it rotates the credential beginning by the two-thirds mark of its lifetime, by the wall clock or by monotonic time elapsed since the credential was obtained, whichever says so first; jitter moves the first attempt earlier, never later, so at least a third of the lifetime always remains for retries. A timer does not run while a host is suspended or its VM paused, so the daemon also reads the wall clock against the renewal point whenever the stream is established and on each heartbeat, and renews at once if the point has passed; that check sends nothing of its own and never moves the schedule. The renewed credential is swapped in without dropping the stream. Expiry is never fatal: an agent whose credential lapsed (at start, or while the control plane was away) keeps enforcing from disk and keeps retrying renewal, which the control plane accepts within its renewal grace (ADR-0016 as amended).
2. **Collector and reporter** — read inbound connections from the kernel's connection tracker (v1) behind a source interface, aggregate in memory over the reporting window the control plane configures, holding at most a bounded number of distinct keys in the open window (past it, observations for new keys are dropped and recorded as an evidence gap), hold closed windows in a buffer bounded in records (oldest dropped first, every drop counted into the heartbeat), and ship one window per `ReportFlows` stream on a connection of its own with its own backoff (ADR-0019). Every subscribe to the tracker listens first and then dumps the table on a second socket, so a connection that predates the subscription (at start, or after a restart) is seen like one that opens after it; a record's connection count is the connections opened, or found live at subscription, in its window, and a close the subscription never saw open counts its connection once, found at close. A kernel-side overrun of a source's socket is recovered at once (the tracker resubscribes and dumps again; the log source reads on) and never silenced, a source that fails outright restarts with jittered backoff that starts over after a healthy run, and every interval in which the agent knows it lost evidence (an overrun, a restart, a dump past its bound, a full open window, a window the buffer dropped, the time the owned table is gone from the kernel) is recorded as an evidence gap and shipped with the next window; a removed table's gap is cut and shipped with every window while it lasts. Buffering to local disk across restarts is additive behind the same buffer. eBPF-based collection is a later, additive backend behind the same source interface.
3. **Enforcement** — installs each policy the sync daemon applies, synchronously, into the host firewall. On Linux this means an **Innerwall-owned nftables table**, replaced atomically as a unit: rule application is all-or-nothing, never a partially applied ruleset, and never a mutation of tables owned by other software (ADR-0003). The table holds one named set per resolved rule and address family and one input chain: accept loopback, accept established and related (which is why the agent can never cut its own control-plane stream), one accept per rule that writes the rule's stable value, from an allocator persisted beside the policy so no version renumbers a rule, into the agent's claimed region of the connection mark (bits 16 through 31, the other bits untouched), each preceded by one that admits the same traffic unmarked when the kernel does not track it, as it never tracks IPv6 neighbor discovery, then a terminal rule that logs and drops (enforced) or logs, marks, and accepts (simulation). Visibility installs no sets and no verdict: one input chain whose one rule counts and accepts each new connection, which exists to engage the kernel's connection tracking, registered in a namespace only once a loaded ruleset references it, so the agent observes even on a host where nothing else engages it. Nothing logs in visibility; the log source is enforcement and simulation only. Peer-only changes to an enforced or simulated table are set element updates in one transaction; a visibility table holds no sets, so its peer-only changes are a full apply. Every apply persists the policy durably to disk before the kernel transaction runs and is acknowledged applied only when both succeeded, the daemon re-applies the persisted policy on start before dialing anything, and the rules stay in the kernel when the daemon exits; `innerwall-agent down` is the only thing that removes them (ADR-0020).
4. **Renewal** — a timer beside the sync daemon that rotates the credential (above). Heartbeats ride the sync stream; there is no separate health loop, and the agent's resource bounds live where the telemetry is held.
4. **Renewal** — a timer beside the sync daemon that rotates the credential, with the wall-clock check the sync daemon prompts (above). Heartbeats ride the sync stream; there is no separate health loop, and the agent's resource bounds live where the telemetry is held.

Safety properties (ADR-0011):

Expand Down
Loading