Skip to content

Commit 9c62c3f

Browse files
Backport of docs: clarify requirements for Consul token policies and TTLs into release/1.7.x (#24172)
Co-authored-by: Tim Gross <[email protected]>
1 parent 2e2321e commit 9c62c3f

File tree

2 files changed

+63
-4
lines changed

2 files changed

+63
-4
lines changed

website/content/docs/configuration/consul.mdx

+57-3
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,10 @@ agents.
116116

117117
- `token` `(string: "")` - Specifies the token used to provide a per-request ACL
118118
token. This option overrides the Consul Agent's default token. If the token is
119-
not set here or on the Consul agent, it will default to Consul's anonymous policy,
120-
which may or may not allow writes. Will default to the `CONSUL_HTTP_TOKEN`
121-
environment variable if set.
119+
not set here or on the Consul agent, it defaults to Consul's anonymous policy,
120+
which may or may not allow writes. Defaults to the `CONSUL_HTTP_TOKEN`
121+
environment variable if set. Nomad cannot refresh this token; if the token is
122+
deleted, Nomad is not able to communicate with Consul.
122123

123124
- `verify_ssl` `(bool: true)`- Specifies if SSL peer verification should be used
124125
when communicating to the Consul API client over HTTPS. Will default to the
@@ -334,6 +335,58 @@ consul {
334335
}
335336
```
336337

338+
### Consul ACL policy for Nomad
339+
340+
Nomad agents need access to Consul in order to register themselves in the
341+
service catalog and discover other Nomad agents via service discovery for
342+
automatic clustering. Nomad clients use Consul tokens from Workload Identity to
343+
register services and checks but need permissions on their own token to
344+
deregister. Nomad servers also create [configuration
345+
entries][consul_config_entry] for Consul Service Mesh, so the specific
346+
permissions vary slightly between Nomad servers and clients. The following
347+
Consul ACL policies represent the minimal permissions Nomad servers and clients
348+
need.
349+
350+
<Tabs>
351+
<Tab heading="Nomad Servers">
352+
353+
```hcl
354+
agent_prefix "" {
355+
policy = "read"
356+
}
357+
358+
node_prefix "" {
359+
policy = "write"
360+
}
361+
362+
service_prefix "" {
363+
policy = "write"
364+
}
365+
366+
acl = "write"
367+
mesh = "write"
368+
```
369+
370+
</Tab>
371+
<Tab heading="Nomad Clients">
372+
373+
```hcl
374+
agent_prefix "" {
375+
policy = "read"
376+
}
377+
378+
node_prefix "" {
379+
policy = "write"
380+
}
381+
382+
service_prefix "" {
383+
policy = "write"
384+
}
385+
```
386+
387+
</Tab>
388+
</Tabs>
389+
337390
### Consul Namespace <EnterpriseAlert inline/>
338391

339392
Consul does not allow ACL policies associated with namespaces to use agent
@@ -383,3 +436,4 @@ namespace "nomad-ns" {
383436
[taskuser]: /nomad/docs/job-specification/task#user "Nomad task Block"
384437
[consul_bound_aud]: /consul/docs/security/acl/auth-methods/jwt#boundaudiences
385438
[`consul.namespace`]: /nomad/docs/job-specification/consul#namespace
439+
[consul_config_entry]: /consul/docs/connect/config-entries

website/content/docs/integrations/consul/acl.mdx

+6-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ running in Nomad.
1818

1919
Nomad agents need access to Consul in order to register themselves in the
2020
service catalog and discover other Nomad agents via service discovery for
21-
automatic clustering. Nomad servers also create [configuration
21+
automatic clustering. Nomad clients use Consul tokens from Workload Identity to
22+
register services and checks but need permissions on their own token to
23+
deregister. Nomad servers also create [configuration
2224
entries][consul_config_entry] for Consul Service Mesh, so the specific
2325
permissions vary slightly between Nomad servers and clients. The following
2426
Consul ACL policies represent the minimal permissions Nomad servers and clients
@@ -106,6 +108,9 @@ URL][nomad_jwks_url]. Consul servers call this URL to retrieve the public keys
106108
Nomad uses to sign workload identities. With these keys, Consul is able to
107109
validate their origin and confirm that they were actually created by Nomad.
108110

111+
Nomad cannot recreate Consul tokens that have been deleted. The auth method
112+
configuration should never set the `MaxTokenTTL` field.
113+
109114
<CodeBlockConfig highlight="2" filename="auth-method.json">
110115

111116
```json

0 commit comments

Comments
 (0)