[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:
@@ -267,6 +267,27 @@ fn generated(baseline: &[u8]) -> BTreeSet<String> {
|
||||
c.problems
|
||||
);
|
||||
hit.insert(rules::ROAD_FAMILY.into());
|
||||
// service.shared: without its own address, photos shares home-server:443 with git (QA F-01). The road
|
||||
// grants nothing: the plans equal those of the same store without it.
|
||||
let shared = Parts::home().edit_devices(|d| d.replace(r#", "address": "100.96.1.2""#, ""));
|
||||
let c = shared.compile();
|
||||
assert!(
|
||||
c.problems
|
||||
.iter()
|
||||
.any(|p| p.path == "roads/7tq0mz-jana-photos-until-sunday.md"
|
||||
&& p.code == rules::SERVICE_SHARED
|
||||
&& p.field.as_deref() == Some("object")
|
||||
&& p.is_error()),
|
||||
"{:?}",
|
||||
c.problems
|
||||
);
|
||||
let without = shared.without_road("7tq0mz").compile();
|
||||
assert_eq!(
|
||||
plans_bytes(&c),
|
||||
plans_bytes(&without),
|
||||
"a refused service road granted"
|
||||
);
|
||||
hit.insert(rules::SERVICE_SHARED.into());
|
||||
hit
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user