Create a new Consul service called app1 is permitted by the following rule since it's explicitly permitting it by name and the rule is allowing a write.
- service "app1" {
- policy = "write"
- }
Run the consul members command to view server and client nodes in the cluster is permitted by the following command since consul members would require you to read information from any node in the cluster
- node_prefix "" {
- policy = "read"
- }
Query any service registered to Consul to list the active clients for the service is permitted by the following rule since it permits a read on any service registered to Consul. If the rule was written as service_prefix ="web", you'd only be able to query a service named web.
- service_prefix "" {
- policy = "read"
- }
Incorrect Answer:
Register any service on Consul would not be permitted unless there was a rule that allowed a write on service_prefix. This would likely be a bad idea since you wouldn't want just anybody to register a service with Consul. Bad actors with this permission could register a node with an existing service as an attempt to direct traffic to a compromised host.