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
Adds support for using job-specific policies (#223)
* Fixes#214, adds support for separating job policies
* Add configuration to credentials to enable using limited policies
* Fix handling of TTL in child tokens
* Add ability to disable folders or jobs from overriding policies
* Use StringSubstitutor for templating policies
* Fix flaky test
---------
Co-authored-by: saville <[email protected]>
Copy file name to clipboardexpand all lines: README.md
+18
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,24 @@ When registering the approle backend you can set a couple of different parameter
21
21
* many more
22
22
23
23
This is just a short introduction, please refer to [Hashicorp itself](https://www.vaultproject.io/docs/auth/approle.html) to get detailed information.
24
+
25
+
### Isolating policies for different jobs
26
+
It may be desirable to have jobs or folders with separate Vault policies allocated. This may be done
27
+
with the optional `policies` configuration option combined with authentication such as the AppRole
28
+
credential. The process is the following:
29
+
* The Jenkins job attempts to retrieve a secret from Vault
30
+
* The AppRole authentication is used to retrieve a new token (if the old one has not expired yet)
31
+
* The Vault plugin then uses the `policies` configuration value with job info to come up with a list of policies
32
+
* If this list is not empty, the AppRole token is used to retrieve a new token that only has the specified policies applied
33
+
* This token is then used for all Vault plugin operations in the job
34
+
35
+
The policies list may be templatized with values that can come from each job in order to customize
36
+
policies per job or folder. See the `policies` configuration help for more information on available
37
+
tokens to use in the configuration. The `Limit Token Policies` option must also be enabled on the
38
+
auth credential. Please note that the AppRole (or other authentication method) should have all policies
39
+
configured as `token_policies` and not `identity_policies`, as job-specific tokens inherit all
40
+
`identity_policies` automatically.
41
+
24
42
### What about other backends?
25
43
Hashicorp explicitly recommends the AppRole Backend for machine-to-machine authentication. Token based auth is mainly supported for backward compatibility.
26
44
Other backends that might make sense are the AWS EC2 backend, the Azure backend, and the Kubernetes backend. But we do not support these yet. Feel free to contribute!
0 commit comments