Skip to content

Commit 34d4764

Browse files
authored
Remove K8s Auth Requirement From Docs (#1058)
We no longer plan to require audiences in the kubernetes auth plugin. It was later discovered that doing so could break some valid configurations of our customers (more details [here](hashicorp/vault-plugin-auth-kubernetes#300 (comment))). Instead, we plan to simply recommend that customers specify an`audience` if it does not break their workflow. We log a warning in Vault when an audience is not configured so that customers will be aware.
2 parents 2501ad2 + a3962d2 commit 34d4764

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

content/vault/v1.20.x/content/api-docs/auth/kubernetes.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ entities attempting to login.
146146
[LabelSelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#labelselector-v1-meta). Currently, label selectors with `matchExpressions` are not supported.
147147
To use label selectors, **Vault must have permission to read namespaces** on the Kubernetes
148148
cluster. If set with `bound_service_account_namespaces`, the conditions are `OR`ed.
149-
- `audience` `(string: "")` - Audience claim to verify in the JWT. Will be required in Vault 1.21+.
149+
- `audience` `(string: "")` - Audience claim to verify in the JWT.
150150
- `alias_name_source` `(string: "serviceaccount_uid")` - Configures how identity aliases are generated.
151151
Valid choices are: `serviceaccount_uid` and `serviceaccount_name`.
152152

content/vault/v1.20.x/content/docs/auth/kubernetes.mdx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,6 @@ management tool.
111111
ttl=1h
112112
```
113113

114-
!> **Note:** `audience` will be a required field in Vault 1.21+. This field is used
115-
to verify the JWT token's audience claim.
116-
117114
This role authorizes the "myapp" service account in the default
118115
namespace and it gives it the default policy.
119116

content/vault/v1.20.x/content/docs/updates/important-changes.mdx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,19 +206,30 @@ audience.
206206

207207
#### Recommendation
208208

209-
We recommend updating your policies before Vault makes the audience value
210-
required for all Kubernetes authentication roles so Vault can explicitly
211-
validate that the audience claim in JWT tokens (`aud`) is intended for Vault and
212-
not another service. For example:
209+
There are cases where configuring audience details can interfere with your
210+
workflow. For example, tokens created using `kubernetes.io/service-account-token`
211+
do not include an aud claim. But we recommend configuring an audience value for
212+
Kubernetes authentication roles whenever possible. Setting explicit audience
213+
details is best practice because it reduces the risk of token misuse by other
214+
services. Vault can use the configured values to validate that the `aud`
215+
(audience) claim in JWT tokens is intended for Vault.
216+
217+
For example:
213218

214219
```shell-session
215220
$ vault write auth/kubernetes/role/demo \
216221
bound_service_account_names=myapp \
217222
bound_service_account_namespaces=default \
218223
policies=default \
224+
audience="my_audience" \
219225
ttl=1h
220226
```
221227

228+
You would then authenticate with the command below.
229+
230+
```shell-session
231+
$ vault write auth/kubernetes/login role=demo audience="my_audience" jwt=...
232+
```
222233

223234
---
224235

0 commit comments

Comments
 (0)