Replies: 3 comments 5 replies
-
We have to solve this anyway, but my only real concern here is that being able to get a list of available routes seems... very useful to an attacker (e.g. a hostile intermediary that's impersonating a node), especially given that they'd be able to forge whatever routes they need (and thus convince legitimate nodes to send messages they want along return routes and such). |
Beta Was this translation helpful? Give feedback.
-
This is a pretty exciting proposal in terms of what it'll allow us to do in the future. It feels like a weird cross-section between authentication and DNS.
Something that will have to factor into this is the way we implement access control mechanisms. I agree that relying on the implementation detail that any TCP handler would be accessible to the registered routes in not great. I think one way to approach this is to build a handshake mechanism with whatever system handles the access control to certain workers. So for example, if One thing I'd like to clarify is the relationship between the worker registry and the service discovery worker. From my understanding of this proposal:
Is that understanding accurate? |
Beta Was this translation helpful? Give feedback.
-
Remote nodes accessAs mentioned in the "Worker accessibility routes relativity" section above, worker routes are relative to the discovery service and all workers would be accessed through the access route and through the discovery service node. This also means that there would be some access channels from the discovery node to the registered worker node. This access channels would be reused for all "clients" using the registered worker and might create a bottleneck depending on how they're configured. This is just something to keep in mind when designing connections between the nodes. |
Beta Was this translation helpful? Give feedback.
-
Background
In order to send messages between workers they should know routes to each other. These routes may be known in advance or retrieved from messages. Addresses in these routes may be static or dynamic.
In simple setup workers are accessible via static routes which are known in advance, like in this transport example
In more complex cases some remote workers may be created dynamically without a static route leading there. In that case the calling worker needs to find out this remote route before sending a message, like in forwarding example
Also during development and integration, even the static routes to remote workers may not be known in advance. For example if you're developing an application which uses some cloud service worker, you would need to know a route to this worker.
Usually cloud service workers have static addresses, but depending on the deployment could be complex.
Worker registry
In order to simplify discovery, we can introduce a "registry" worker with well known address which can store routes to workers and provide them to other workers by request.
This worker could also have ability to add routes to the storage (register workers).
Registry worker would also contain some sort of identifiers for registered workers to have some meaningful distinction between them.
Registry might also contain some additional information about remote workers, some of which can be used to access them (e.g. public keys)
In general the registry worker API include operations like:
Where info contains route and potentially some additional metadata
Worker accessibility routes relativity
Important to note that routes registered in the registry are only accessible from the registry worker context, in order to access them from "local" workers (which get "remote" worker routes from the registry), they should construct a "full route" to the "remote" worker.
For example if registry is accessible via
[TCP#registry_node, 0#"registry"]
and remote route registered is[TCP#remote, 0#"service"]
, then the route to "service" worker that local worker can use should be:[TCP#registry_node, TCP#remote, 0#service]
, GIVEN THAT tcp addressTCP#remote
is accessible from tcp handler ofTCP#registry_node
.Relying on TCP handlers being able to access registered routes is not recommended but it's currently how things work.
Alternatively explicit channels can be used. A local worker would set up a channel which would have access to registry worker and registered workers:
In that case registry is accessible via
[channel, 0#"registry"]
and "full route" would be[channel, TCP#remote, 0#"service"]
We can call the first fraction of the route (
[TCP#registry_node]
or[channel]
) access_route or bridge_route and the second fraction ([0#registry]
or[TCP#remote, 0#"service"]
) target_routeCloud services discovery
On Ockam Cloud Nodes services are workers (or groups of workers) which perform certain functions and accessible to remote workers. Those workers can serve as integration with other cloud services (for example Apache Kafka)
Each service has an access point worker which implement some message API. To get the route to this access point from the perspective of the cloud node we can use a registry worker which will register services when they're started and be able to retrieve their routes on demand.
We can call this registry worker "Service discovery worker".
For simplicity since services currently don't provide cryptographic identity we can use a simple "name id".
Routes relativity concert applies to service discovery same as for any remote workers registry.
Service discovery implementation and API
Discovery service API is request-response and identifies requests by routes (meaning that there is no request IDs)
Request to the service is sending and empty binary.
NOTE: not an empty string, but
data<0>
in BARE termsResponse contains a list of routes encoded as following BARE type:
Name ID means that there cannot be multiple services with the same name
Service info might be extended in the future.
Future extension of this API can have different request formats corresponding to different response formats.
Discovery VS remote aliases
Service discovery serves two purposes:
Second issue can be addressed also by remote static aliases.
For example we can create a static alias worker
[0#"stream"]
which will forward all messages to the stream service access point. This allows client applications to communicate with this service by[TCP#cloud, 0#"stream"]
route without additional discovery step.This simplifies the client application code since it doesn't need to contain discovery step, but complicates route negotiation because alias worker would not be in the return route and routes in the further communication will not include the alias.
This may be fine for some communication, but workers need to be ready to handle that
Beta Was this translation helpful? Give feedback.
All reactions