same-box-edge-fence
Same-box calls through the edge (#990)
Since v0.28.17 (#367) nested instances are denied every address of their own box. systemd's IPAddressDeny= has no ports, so that also blocks the edge: an app cannot call another app by hostname when both are on the same box, though it can when they are on different boxes. Jelly on console.carlos.exciting.io is held at v0.28.11 for this.
This branch lets instances reach the box's own global addresses on TCP 80 and 443 only, and keeps everything else #367 closed:
internal/edgefencerenders, loads and reads back an nft table,carlos_edge_fence, one output chain scoped bysocket cgroupv2tocarlos.slice/carlos-instances.slice: 80/443 accept, other TCP reset, everything else dropped.- instance-control takes an address out of the slice deny only while that table reads back exactly as rendered; every failure applies the whole deny. Every unit start checks the fence first (one wrapper on systemctl, guarded by a source-scan test); the deny refresh re-reads it every 10 s and reloads it after an nftables flush or a slice recreation.
- Units:
AF_NETLINKfor instance-control;RefuseManualStoponcarlos.sliceandcarlos-instances.slice. - Probe:
box-addr-ports(TCP 22 must not connect on any box address) andbox-addr-edge(the edge answers on fenced addresses; never fails readiness). carlos status --layoutprints one line per box:same-box calls: on,off (reason),not needed (reason)orunknown.- Off on group boxes (the region HA hairpin applies), in claims mode, with
CARLOS_EDGE_FENCE=off, and where the public address is not on the box.
Plan, evidence, build notes and drill: docs/superpowers/plans/2026-11-13-same-box-calls-edge-fence.md.
Tested
- Unit tests for the table, the readback (fixture from a real kernel), every failure path, the start guard, the refresh and retry, the probe lines and the CLI line; key tests mutation-checked.
- Two namespace experiments on hal, and a drill on the load-test box (Debian 13, public v4 /32 and global v6 on eth0): the edge went from timeout to HTTP 303 on both families, :22 refused at once, UDP EPERM; a recreated slice, an nft table deletion and a control restart each ended with the fence reloaded or the whole deny in place within one tick. The drill found two issues, both fixed on the branch. The box was restored afterwards.
Review and census
- Branch review round 1 (Codex): brief
docs/superpowers/reviews/CODEX-REVIEW-BRIEF-same-box-edge-fence.md; pending. - Census card:
docs/superpowers/notes/census-proposal-same-box-edge-fence.md; the same reviewer approves it.
Commits
13
Discussions
0
0 open
Tasks
0/0
done
Discussions
- No discussions on this branch yet.
Tasks
- No tasks yet.
Activity
- james@keymail.dev pushed 8ef21e04f census: re-propose the edge fence overlay on main 26272c99d
- james@keymail.dev pushed 6bbab0ba8 Merge amadan main 26272c99d into same-box-edge-fence
- james@keymail.dev pushed 093898346 plan: edge fence review round 2 READY; P3 follow-up (#990)
- james@keymail.dev pushed e467f44fe review brief: same-box-edge-fence round 2 (#990)
- james@keymail.dev pushed cbf450cc3 edge fence: check the fence when the box's addresses cannot be read (review R1)
- james@keymail.dev pushed 7aad44ce7 review brief: same-box-edge-fence round 1 (#990)
- james@keymail.dev pushed e3787898d census, plan: edge fence census proposal and drill results (#990)
- james@keymail.dev pushed 5c1fc42e6 status --layout: say per box whether same-box calls are on (#990)
- james@keymail.dev pushed f1469742f plan: edge fence build notes and the reporting trace (#990)
- james@keymail.dev pushed 0eb4e9ef2 units, probe: switch the edge fence on and check it from inside (#990)
- james@keymail.dev pushed 01eb46011 instancectl: exempt the box's global addresses only behind a verified edge fence (#990)
- james@keymail.dev pushed abf9a7a8c edgefence: render, load and read back the same-box fence table (#990)
- james@keymail.dev pushed 23b01bcde plan: same-box calls through the edge (edge fence, #990)