node "" {
policy = "read"
}
node "app1" {
policy = "write"
}
node "" {
policy = "read"
}
node "$NODENAME" {
policy = "write"
}I don’t know if I really understand your problem.
Where do deploy your policies? Why you cant use a script to generate the rules and deploy them via curl?
If you only want to have a prefix wildcard you can use your rule:
node "app1" {
policy = "write"
}All nodes dedicated
to “app1” have to use a nodename like “app1-nodename” and the acl token of this policy.
Maybe I understand your intention still not yet.
But I think wildcards within a rule definition will make no sense.
Will all clients have different acl-tokens or the same?
If it is the same, it make no sense to use different policies and you can use a node prefix and a static YAML for your policies.
If you want to use a different acl token and you don’t know the client node name before it is created you have to create its rule after the node name is known. Here you can use the same ansible playbook to register the node with its credentials at the consul server.
If all client node names and tokens are static and known before the nodes are created, you can easily generate your YAML with bash and using the placeholder $NODENAME.
If your intention is a backup and restore of the acl policies you can use snapshot or save all policies via the API.
node "$self" {
policy = "write"
}I think you will be sure that nodes don’t overwrite the same namespaces accidentally and not to be secure against hackers or sth. like that. If that is correct you can ensure by your node (nodename) configuration, that the different clients not overwriting their spaces.
node "webserver" {
policy = "write"
}
At the client node - config.json: