[roads] QA F-01: a service road grants only that service
A firewall sees an address and a port, never a hostname, so a road to photos.home.arpa compiled to home-server:443 and also opened git.home.arpa there. Rules are now per service: - devices.json services may carry their own mesh address (same rules as a device address, unique among all of them). A road to such a service compiles to that address only; the hosting device's plan lists it in the new field services[] so it answers on it, and DNS points there. - A road to a service that shares its address and a port with another service is refused (service.shared), naming the others, instead of opening both. Narrowing ports: to a port nobody else serves on that address is allowed. - A device: road reaches the whole device: its own address and its services' own addresses. No Ianitor identity check is needed for this. The home fixture gives photos its own address (100.96.1.2); tests that encoded the old host:port model are updated, three new snapshot fixtures cover the address rules, and the golden plans and pinned digest are regenerated. Mutation-checked: dropping the refusal, or ignoring the service address, each fails an F-01 test.
This commit is contained in:
+3
-1
@@ -57,7 +57,7 @@ is not `key: value`, or a bad quoted string, is `yaml.syntax`.
|
||||
| `id` | yes | 6 characters of `0123456789abcdefghjkmnpqrstvwxyz` (no `i l o u`), random | `id.format`; must equal the file name's prefix (`id.file-name`); unique in the store (`id.duplicate`, both files grant nothing) |
|
||||
| `subject` | yes | a reference (below): `person:`, `group:`, `device:` or `app:` | `ref.format`, `subject.kind` (not allowed for the verb), `subject.unknown` (not in the snapshots) |
|
||||
| `verb` | yes | `can-reach`, `exits-through`, `goes-direct`, `never-online-without`, `custom` | `verb.unknown` |
|
||||
| `object` | yes, except `custom` (where it is not allowed) | a reference: `device:`, `subnet:`, `service:` or `exit:` | `ref.format`, `object.kind`, `object.unknown`, `object.not-exit`, `subnet.not-canonical`, `subnet.unrouted`; a `goes-direct` subnet other than `/0` that holds a mesh address is `direct.mesh` (mesh traffic never goes direct, QA F-02) |
|
||||
| `object` | yes, except `custom` (where it is not allowed) | a reference: `device:`, `subnet:`, `service:` or `exit:` | `ref.format`, `object.kind`, `object.unknown`, `object.not-exit`, `subnet.not-canonical`, `subnet.unrouted`, `service.shared` (a service that shares its address and a port with another: its rule would open both, QA F-01); a `goes-direct` subnet other than `/0` that holds a mesh address is `direct.mesh` (mesh traffic never goes direct, QA F-02) |
|
||||
| `until` | no | RFC 3339 with an offset: `2026-11-29T23:59:59+01:00` or `…Z`; exclusive | `until.format`; `until <= now` makes the road *inactive* (`road.expired`) |
|
||||
| `ports` | no; only `can-reach` | a list of `tcp/443`, `udp/53`, `tcp/8000-8100`, `tcp`, `udp`, `icmp`; absent means all traffic | `ports.format`; for a service, every port must be one it serves (`ports.not-served`) |
|
||||
| `via` | no; only `can-reach` | `device:<key>` of a device with `relay` or `exit` | `via.format`, `via.unknown`, `via.not-relay` |
|
||||
@@ -184,6 +184,7 @@ what makes the snapshot unreadable: bad JSON, a wrong format, a malformed or dup
|
||||
| `routes` | `[]` | canonical subnets this device routes for the mesh: private only, so not `/0`, nothing that reaches the internet (use an exit), nothing loopback, link-local, multicast, reserved or IPv4-embedding; no overlap with another device's (`devices.route`, `devices.overlap`). This is also why two peers of one device can never hold the same prefix |
|
||||
| `services[].host` | — | an Ianitor hostname, unique across devices (`devices.service`) |
|
||||
| `services[].ports` | — | a non-empty port list (`devices.ports`) |
|
||||
| `services[].address` | none | the service's own mesh address on this device, under the same rules as a device `address` and unique among all of them (`devices.address`). A firewall sees addresses and ports, not hostnames: a road to a service compiles to its own address when it has one, else to the device's, and a road to a service that shares that address **and** a port with another service is refused (`service.shared`, QA F-01), because its rule would open the other one too |
|
||||
|
||||
## The plan
|
||||
|
||||
@@ -195,6 +196,7 @@ entry.
|
||||
|:--|:--|
|
||||
| `format` | `1` |
|
||||
| `device`, `name`, `address`, `classic` | this device |
|
||||
| `services[]` | `{host, address}`: the services this device hosts on an address of their own; it must answer on each (QA F-01). A road to such a service reaches that address only; a `device:` road reaches the device's address and all of these |
|
||||
| `expires` | the earliest `until` (UTC, `Z`) of every road this plan was built from, on the subject's plan and on the serving device's alike; the engine must stop applying the plan at that instant even if nothing recompiles (QA R-26); `null` if none |
|
||||
| `peers[]` | `key`, `name`, `address`, `classic` (*not post-quantum* when true), `allowed_ips` (sorted CIDRs), `via` (a path hint or `null`), `roads` |
|
||||
| `firewall.default` | always `"deny"` |
|
||||
|
||||
Reference in New Issue
Block a user