You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+45-1Lines changed: 45 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,9 +8,45 @@ A Kubernetes exec auth plugin using the SPIFFE Workload API to get JWTs for auth
8
8
## Building
9
9
10
10
```
11
-
go build .
11
+
go build -o k8s-spiffe-workload-jwt-exec-auth ./cmd
12
12
```
13
13
14
+
## Configuration
15
+
16
+
The plugin is configured entirely through environment variables, set via the `env:` list of the
17
+
kubeconfig `exec` block:
18
+
19
+
| Variable | Default | Description |
20
+
| --- | --- | --- |
21
+
|`SPIFFE_ENDPOINT_SOCKET`|`unix:///tmp/spire-agent/public/api.sock`| Address of the SPIFFE Workload API socket. |
22
+
|`SPIFFE_JWT_AUDIENCE`|`k8s`| Audience requested for the JWT-SVID. Must match an entry in the API server's `AuthenticationConfiguration`. |
23
+
|`SPIFFE_JWT_HINT`|*(unset)*| Selects which JWT-SVID to use by hint, when the Workload API returns more than one. See below. |
24
+
|`EXEC_CREDENTIAL_VERSION`|`v1`| The `client.authentication.k8s.io` version emitted. Use `v1beta1` for older clients. Must match the `apiVersion` in the `exec` block. |
25
+
26
+
There is also one flag, passed via `args:` rather than `env:`:
27
+
28
+
| Flag | Default | Description |
29
+
| --- | --- | --- |
30
+
|`-timeout`|`0`| Max time to wait for the JWT-SVID from the Workload API socket, e.g. `-timeout=5s`. `0` waits forever. |
31
+
32
+
### Selecting an identity with `SPIFFE_JWT_HINT`
33
+
34
+
Hints are operator-set strings on SPIRE registration entries, used "to provide guidance on how this
35
+
identity should be used by a workload when more than one SVID is returned". If the Workload API
36
+
returns several JWT-SVIDs — for example a SPIRE HA broker fronting multiple entry-scoped SVIDs — then
37
+
which one comes first is arbitrary, and the plugin may authenticate to the cluster as an identity you
38
+
did not intend.
39
+
40
+
Set `SPIFFE_JWT_HINT` to pin a specific one:
41
+
42
+
-**Unset or empty**: use the first JWT-SVID returned. This is the original behavior.
43
+
-**Set and matched**: use the JWT-SVID with that hint.
44
+
-**Set and unmatched**: exit non-zero with an error on stderr listing the hints that *were*
45
+
available, rather than silently authenticating as a different identity.
46
+
47
+
Matching is exact — no case folding or whitespace trimming. SPIRE keeps only the first SVID for each
48
+
non-empty hint, so hints are effectively unique.
49
+
14
50
## Usage
15
51
16
52
### Setup the Kubernetes cluster auth
@@ -50,6 +86,10 @@ Remove the "user" block from the "users" section and replace it with:
0 commit comments