[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:
2026-11-25 09:01:18 +01:00
parent 80f73a0154
commit 69e3a9377d
23 changed files with 380 additions and 60 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
{ "key": "AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgI", "name": "home-server", "owner": "mark", "address": "100.96.0.2", "exit": true, "relay": true,
"routes": ["192.168.100.0/24"],
"services": [
{ "host": "photos.home.arpa", "ports": ["tcp/443"] },
{ "host": "photos.home.arpa", "ports": ["tcp/443"], "address": "100.96.1.2" },
{ "host": "git.home.arpa", "ports": ["tcp/443", "tcp/22"] }
] },
{ "key": "AwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwM", "name": "jana-phone", "owner": "jana", "address": "100.96.0.3" },
@@ -3,6 +3,7 @@
"device": "BgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgY",
"name": "friend-node",
"address": "100.96.0.6",
"services": [],
"classic": false,
"expires": null,
"peers": [
+64 -2
View File
@@ -3,6 +3,12 @@
"device": "AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgI",
"name": "home-server",
"address": "100.96.0.2",
"services": [
{
"host": "photos.home.arpa",
"address": "100.96.1.2"
}
],
"classic": false,
"expires": "2026-11-29T22:59:59Z",
"peers": [
@@ -76,6 +82,16 @@
"k3f9q2"
]
},
{
"direction": "in",
"src": "100.96.0.1/32",
"dst": "100.96.1.2/32",
"proto": "any",
"ports": null,
"roads": [
"k3f9q2"
]
},
{
"direction": "in",
"src": "100.96.0.3/32",
@@ -89,7 +105,17 @@
{
"direction": "in",
"src": "100.96.0.3/32",
"dst": "100.96.0.2/32",
"dst": "100.96.1.2/32",
"proto": "any",
"ports": null,
"roads": [
"k3f9q2"
]
},
{
"direction": "in",
"src": "100.96.0.3/32",
"dst": "100.96.1.2/32",
"proto": "tcp",
"ports": [
443,
@@ -112,7 +138,17 @@
{
"direction": "in",
"src": "100.96.0.4/32",
"dst": "100.96.0.2/32",
"dst": "100.96.1.2/32",
"proto": "any",
"ports": null,
"roads": [
"k3f9q2"
]
},
{
"direction": "in",
"src": "100.96.0.4/32",
"dst": "100.96.1.2/32",
"proto": "tcp",
"ports": [
443,
@@ -148,6 +184,32 @@
"r8m2tg"
]
},
{
"direction": "in",
"src": "100.96.0.5/32",
"dst": "100.96.1.2/32",
"proto": "tcp",
"ports": [
22,
22
],
"roads": [
"r8m2tg"
]
},
{
"direction": "in",
"src": "100.96.0.5/32",
"dst": "100.96.1.2/32",
"proto": "udp",
"ports": [
53,
53
],
"roads": [
"r8m2tg"
]
},
{
"direction": "forward",
"src": "100.96.0.1/32",
+6 -3
View File
@@ -3,6 +3,7 @@
"device": "BAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQ",
"name": "jana-laptop",
"address": "100.96.0.4",
"services": [],
"classic": false,
"expires": "2026-11-29T22:59:59Z",
"peers": [
@@ -12,7 +13,8 @@
"address": "100.96.0.2",
"classic": false,
"allowed_ips": [
"100.96.0.2/32"
"100.96.0.2/32",
"100.96.1.2/32"
],
"via": null,
"roads": [
@@ -28,7 +30,7 @@
"dns": [
{
"host": "photos.home.arpa",
"address": "100.96.0.2",
"address": "100.96.1.2",
"roads": [
"7tq0mz"
]
@@ -41,7 +43,8 @@
"app": "steam",
"subnet": "0.0.0.0/0",
"except": [
"100.96.0.2/32"
"100.96.0.2/32",
"100.96.1.2/32"
],
"roads": [
"e5yj1s"
+6 -3
View File
@@ -3,6 +3,7 @@
"device": "AwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwM",
"name": "jana-phone",
"address": "100.96.0.3",
"services": [],
"classic": false,
"expires": "2026-11-29T22:59:59Z",
"peers": [
@@ -12,7 +13,8 @@
"address": "100.96.0.2",
"classic": false,
"allowed_ips": [
"100.96.0.2/32"
"100.96.0.2/32",
"100.96.1.2/32"
],
"via": null,
"roads": [
@@ -28,7 +30,7 @@
"dns": [
{
"host": "photos.home.arpa",
"address": "100.96.0.2",
"address": "100.96.1.2",
"roads": [
"7tq0mz"
]
@@ -41,7 +43,8 @@
"app": "steam",
"subnet": "0.0.0.0/0",
"except": [
"100.96.0.2/32"
"100.96.0.2/32",
"100.96.1.2/32"
],
"roads": [
"e5yj1s"
@@ -3,6 +3,7 @@
"device": "AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE",
"name": "mark-pc",
"address": "100.96.0.1",
"services": [],
"classic": false,
"expires": null,
"peers": [
@@ -14,6 +15,7 @@
"allowed_ips": [
"0.0.0.0/0",
"100.96.0.2/32",
"100.96.1.2/32",
"192.168.100.0/24",
"::/0"
],
@@ -3,6 +3,7 @@
"device": "BwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwc",
"name": "petr-phone",
"address": "100.96.0.7",
"services": [],
"classic": false,
"expires": null,
"peers": [
+5 -2
View File
@@ -3,6 +3,7 @@
"device": "BQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQU",
"name": "router",
"address": "100.96.0.5",
"services": [],
"classic": true,
"expires": null,
"peers": [
@@ -12,7 +13,8 @@
"address": "100.96.0.2",
"classic": false,
"allowed_ips": [
"100.96.0.2/32"
"100.96.0.2/32",
"100.96.1.2/32"
],
"via": null,
"roads": [
@@ -32,7 +34,8 @@
"app": "steam",
"subnet": "0.0.0.0/0",
"except": [
"100.96.0.2/32"
"100.96.0.2/32",
"100.96.1.2/32"
],
"roads": [
"e5yj1s"
+3
View File
@@ -75,3 +75,6 @@ devices route-link-local.devices.json devices.route devices[1].routes[0]
devices route-overlap.devices.json devices.overlap devices.friend-node.routes
devices service-host.devices.json devices.service devices[1].services[0].host
devices service-no-ports.devices.json devices.ports devices[1].services[0].ports
devices service-address-twice.devices.json devices.address devices[1].services[0].address
devices service-address-public.devices.json devices.address devices[1].services[0].address
devices service-address-in-route.devices.json devices.address devices.home-server.address
@@ -0,0 +1,17 @@
{
"format": 1,
"devices": [
{ "key": "AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE", "name": "mark-pc", "owner": "mark", "address": "100.96.0.1" },
{ "key": "AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgI", "name": "home-server", "owner": "mark", "address": "100.96.0.2", "exit": true, "relay": true,
"routes": ["192.168.100.0/24"],
"services": [
{ "host": "photos.home.arpa", "ports": ["tcp/443"], "address": "192.168.100.9" },
{ "host": "git.home.arpa", "ports": ["tcp/443", "tcp/22"] }
] },
{ "key": "AwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwM", "name": "jana-phone", "owner": "jana", "address": "100.96.0.3" },
{ "key": "BAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQ", "name": "jana-laptop", "owner": "jana", "address": "100.96.0.4" },
{ "key": "BQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQU", "name": "router", "address": "100.96.0.5", "classic": true },
{ "key": "BgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgY", "name": "friend-node", "owner": "petr", "address": "100.96.0.6", "exit": true },
{ "key": "BwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwc", "name": "petr-phone", "owner": "petr", "address": "100.96.0.7" }
]
}
@@ -0,0 +1,17 @@
{
"format": 1,
"devices": [
{ "key": "AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE", "name": "mark-pc", "owner": "mark", "address": "100.96.0.1" },
{ "key": "AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgI", "name": "home-server", "owner": "mark", "address": "100.96.0.2", "exit": true, "relay": true,
"routes": ["192.168.100.0/24"],
"services": [
{ "host": "photos.home.arpa", "ports": ["tcp/443"], "address": "203.0.114.9" },
{ "host": "git.home.arpa", "ports": ["tcp/443", "tcp/22"] }
] },
{ "key": "AwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwM", "name": "jana-phone", "owner": "jana", "address": "100.96.0.3" },
{ "key": "BAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQ", "name": "jana-laptop", "owner": "jana", "address": "100.96.0.4" },
{ "key": "BQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQU", "name": "router", "address": "100.96.0.5", "classic": true },
{ "key": "BgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgY", "name": "friend-node", "owner": "petr", "address": "100.96.0.6", "exit": true },
{ "key": "BwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwc", "name": "petr-phone", "owner": "petr", "address": "100.96.0.7" }
]
}
@@ -0,0 +1,17 @@
{
"format": 1,
"devices": [
{ "key": "AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE", "name": "mark-pc", "owner": "mark", "address": "100.96.0.1" },
{ "key": "AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgI", "name": "home-server", "owner": "mark", "address": "100.96.0.2", "exit": true, "relay": true,
"routes": ["192.168.100.0/24"],
"services": [
{ "host": "photos.home.arpa", "ports": ["tcp/443"], "address": "100.96.0.1" },
{ "host": "git.home.arpa", "ports": ["tcp/443", "tcp/22"] }
] },
{ "key": "AwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwM", "name": "jana-phone", "owner": "jana", "address": "100.96.0.3" },
{ "key": "BAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQ", "name": "jana-laptop", "owner": "jana", "address": "100.96.0.4" },
{ "key": "BQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQU", "name": "router", "address": "100.96.0.5", "classic": true },
{ "key": "BgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgY", "name": "friend-node", "owner": "petr", "address": "100.96.0.6", "exit": true },
{ "key": "BwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwc", "name": "petr-phone", "owner": "petr", "address": "100.96.0.7" }
]
}