Additional antora migration

This commit is contained in:
spencergibb
2023-09-14 16:19:55 -04:00
parent 72b190c164
commit 6ea17a63d7
20 changed files with 113 additions and 541 deletions

View File

@@ -1,6 +1,4 @@
* xref:index.adoc[]
* xref:intro.adoc[]
* xref:_attributes.adoc[]
* xref:index.adoc[Introduction]
* xref:new-features.adoc[]
* xref:quickstart.adoc[]
* xref:config-data.adoc[]
@@ -8,6 +6,3 @@
* xref:secret-backends.adoc[]
* xref:other-topics.adoc[]
* xref:appendix.adoc[]
* xref:_configprops.adoc[]
* xref:README.adoc[]
* xref:spring-cloud-vault.adoc[]

View File

@@ -1,73 +0,0 @@
:docs: https://cloud.spring.io/spring-cloud-vault/spring-cloud-vault.html
[[features]]
= Features
[[spring-cloud-vault-config-client]]
== Spring Cloud Vault Config Client
Specifically for Spring applications:
* Retrieve secrets from Vault and initialize Spring Environment with remote property sources.
* Obtain {docs}#vault.config.backends.kv[Key-Value secrets] secured with SSL.
* Generate credentials for
{docs}#vault.config.backends.mysql[MySQL],
{docs}#vault.config.backends.postgresql[PostgreSQL],
{docs}#vault.config.backends.cassandra[Apache Cassandra],
{docs}#vault.config.backends.mongodb[MongoDB],
{docs}#vault.config.backends.consul[Consul],
{docs}#vault.config.backends.aws[AWS], and {docs}#vault.config.backends.rabbitmq[RabbitMQ].
* {docs}#vault.config.authentication.token[Token],
{docs}#vault.config.authentication.appid[AppId],
{docs}#vault.config.authentication.approle[AppRole],
{docs}#vault.config.authentication.clientcert[Client Certificate],
{docs}#vault.config.authentication.cubbyhole[Cubbyhole],
{docs}#vault.config.authentication.awsec2[AWS-EC2] authentication,
{docs}#vault.config.authentication.awsiam[AWS-IAM] authentication, and
{docs}#vault.config.authentication.kubernetes[Kubernetes] authentication.
* Bootstrap application context: a parent context for the main application that can be trained to do anything.
[[quick-start]]
= Quick Start
[[building]]
= Building
[[build-requirements-for-vault]]
== Build requirements for Vault
Spring Cloud Vault Config requires SSL certificates and a running Vault instance listening on `localhost:8200`.
Certificates and the Vault setup are scripted, the scripts are located in `src/test/bash`.
The following scripts need to be run prior to building the project for the tests to pass.
[source,bash]
----
$ ./src/test/bash/install_vault.sh
$ ./src/test/bash/create_certificates.sh
$ ./src/test/bash/local_run_vault.sh
----
Leave Vault uninitialized, the tests will initialize and unseal Vault.
They will also create a root token `00000000-0000-0000-0000-000000000000`.
Changes to the documentation should be made to the adocs found under `docs/src/main/asciidoc/`
`README.adoc` can be re-generated via the following
[source,bash]
----
$ ./docs/src/main/ruby/generate_readme.sh > README.adoc
----
This script requires ruby and the asciidoctor gem installed (`gem install asciidoctor`)
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/building.adoc[]
[[contributing]]
= Contributing
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/contributing.adoc[]

View File

@@ -11,3 +11,8 @@
:sc-ext: java
:project-full-name: Spring Cloud Vault
:github: https://github.com/spring-cloud/spring-cloud-vault
:githubmaster: {github}/tree/main
:revnumber: {project-version}
:docslink: {githubmaster}/docs/src/main/asciidoc

View File

@@ -1,9 +1,11 @@
:numbered!:
[appendix]
[[common-application-properties]]
= Common application properties
:page-section-summary-toc: 1
include::_attributes.adoc[]
Various properties can be specified inside your `application.properties` file, inside your `application.yml` file, or as command line switches.
This appendix provides a list of common {project-full-name} properties and references to the underlying classes that consume them.
@@ -11,3 +13,4 @@ This appendix provides a list of common {project-full-name} properties and refer
NOTE: Property contributions can come from additional jar files on your classpath, so you should not consider this an exhaustive list.
Also, you can define your own properties.
include::partial$_configprops.adoc[]

View File

@@ -16,14 +16,12 @@ NOTE: Token authentication is the default authentication method.
If a token is disclosed an unintended party gains access to Vault and can access secrets for the intended client.
.application.yml
====
[source,yaml]
----
spring.cloud.vault:
authentication: TOKEN
token: 00000000-0000-0000-0000-000000000000
----
====
* `authentication` setting this value to `TOKEN` selects the Token authentication method
* `token` sets the static token to use. If missing or empty, then an attempt will be made to retrieve a token from ~/.vault-token.
@@ -45,13 +43,11 @@ Spring Vault can send requests without the
Disable Spring Vault's authentication infrastructure to disable client authentication and session management.
.application.yml
====
[source,yaml]
----
spring.cloud.vault:
authentication: NONE
----
====
* `authentication` setting this value to `NONE` disables `ClientAuthentication`
and `SessionManager`.
@@ -72,7 +68,6 @@ The IP and Mac address are represented as Hex-encoded SHA256 hash.
IP address-based UserId's use the local host's IP address.
.application.yml using SHA256 IP-Address UserId's
====
[source,yaml]
----
spring.cloud.vault:
@@ -80,7 +75,6 @@ spring.cloud.vault:
app-id:
user-id: IP_ADDRESS
----
====
* `authentication` setting this value to `APPID` selects the AppId authentication method
* `app-id-path` sets the path of the AppId mount to use
@@ -102,7 +96,6 @@ The value of
`network-interface` is optional and can be either an interface name or interface index (0-based).
.application.yml using SHA256 Mac-Address UserId's
====
[source,yaml]
----
spring.cloud.vault:
@@ -111,7 +104,6 @@ spring.cloud.vault:
user-id: MAC_ADDRESS
network-interface: eth0
----
====
* `network-interface` sets network interface to obtain the physical address
@@ -137,7 +129,6 @@ This class must be on your classpath and must implement the `org.springframework
Spring Cloud Vault will obtain the UserId by calling `createUserId` each time it authenticates using AppId to obtain a token.
.application.yml
====
[source,yaml]
----
spring.cloud.vault:
@@ -145,10 +136,8 @@ spring.cloud.vault:
app-id:
user-id: com.examlple.MyUserIdMechanism
----
====
.MyUserIdMechanism.java
====
[source,yaml]
----
public class MyUserIdMechanism implements AppIdUserIdMechanism {
@@ -160,7 +149,6 @@ public class MyUserIdMechanism implements AppIdUserIdMechanism {
}
}
----
====
See also: https://www.vaultproject.io/docs/auth/app-id.html[Vault Documentation: Using the App ID auth backend]
@@ -175,7 +163,6 @@ Spring Vault supports various AppRole scenarios (push/pull mode and wrapped).
RoleId and optionally SecretId must be provided by configuration, Spring Vault will not look up these or create a custom SecretId.
.application.yml with AppRole authentication properties
====
[source,yaml]
----
spring.cloud.vault:
@@ -183,7 +170,6 @@ spring.cloud.vault:
app-role:
role-id: bde2076b-cccb-3cf0-d57e-bca7b1e83a52
----
====
The following scenarios are supported along the required configuration details:
@@ -225,7 +211,6 @@ Full pull mode is not yet supported.
Using Spring Cloud Vault with the Spring WebFlux stack enables Vault's reactive auto-configuration which can be disabled by setting `spring.cloud.vault.reactive.enabled=false`.
.application.yml with all AppRole authentication properties
====
[source,yaml]
----
spring.cloud.vault:
@@ -236,7 +221,6 @@ spring.cloud.vault:
role: my-role
app-role-path: approle
----
====
* `role-id` sets the RoleId.
* `secret-id` sets the SecretId.
@@ -255,13 +239,11 @@ Unlike most Vault authentication backends, this backend does not require first-d
Instead, it treats AWS as a Trusted Third Party and uses the cryptographically signed dynamic metadata information that uniquely represents each EC2 instance.
.application.yml using AWS-EC2 Authentication
====
[source,yaml]
----
spring.cloud.vault:
authentication: AWS_EC2
----
====
AWS-EC2 authentication enables nonce by default to follow the Trust On First Use (TOFU) principle.
Any unintended party that gains access to the PKCS#7 identity metadata can authenticate against Vault.
@@ -278,7 +260,6 @@ You can configure the authentication role by setting the
`spring.cloud.vault.aws-ec2.role` property.
.application.yml with configured role
====
[source,yaml]
----
spring.cloud.vault:
@@ -286,10 +267,8 @@ spring.cloud.vault:
aws-ec2:
role: application-server
----
====
.application.yml with all AWS EC2 authentication properties
====
[source,yaml]
----
spring.cloud.vault:
@@ -300,7 +279,6 @@ spring.cloud.vault:
identity-document: http://...
nonce: my-static-nonce
----
====
* `authentication` setting this value to `AWS_EC2` selects the AWS EC2 authentication method
* `role` sets the name of the role against which the login is being attempted.
@@ -326,16 +304,13 @@ When using the AWS-IAM authentication you must create a role in Vault and assign
An empty `role` defaults to the friendly name the current IAM role.
.application.yml with required AWS-IAM Authentication properties
====
[source,yaml]
----
spring.cloud.vault:
authentication: AWS_IAM
----
====
.application.yml with all AWS-IAM Authentication properties
====
[source,yaml]
----
spring.cloud.vault:
@@ -347,7 +322,6 @@ spring.cloud.vault:
server-name: some.server.name
endpoint-uri: https://sts.eu-central-1.amazonaws.com
----
====
* `region` sets the name of the AWS region. If not supplied, the region will be determined by AWS defaults.
* `role` sets the name of the role against which the login is being attempted.
@@ -370,7 +344,6 @@ Unlike most Vault authentication backends, this backend does not require first-d
Instead, it treats Azure as a Trusted Third Party and uses the managed service identity and instance metadata information that can be bound to a VM instance.
.application.yml with required Azure Authentication properties
====
[source,yaml]
----
spring.cloud.vault:
@@ -378,10 +351,8 @@ spring.cloud.vault:
azure-msi:
role: my-dev-role
----
====
.application.yml with all Azure Authentication properties
====
[source,yaml]
----
spring.cloud.vault:
@@ -392,7 +363,6 @@ spring.cloud.vault:
metadata-service: http://169.254.169.254/metadata/instance…
identity-token-service: http://169.254.169.254/metadata/identity…
----
====
* `role` sets the name of the role against which the login is being attempted.
* `azure-path` sets the path of the Azure mount to use
@@ -420,7 +390,6 @@ To enable `cert` authentication you need to:
3. Set the `spring.cloud.vault.authentication` to `CERT`
.application.yml
====
[source,yaml]
----
spring.cloud.vault:
@@ -431,7 +400,6 @@ spring.cloud.vault:
key-store-type: JKS
cert-auth-path: cert
----
====
See also: https://www.vaultproject.io/docs/auth/cert.html[Vault Documentation: Using the Cert auth backend]
@@ -449,7 +417,6 @@ The login token will be retrieved from a wrapped response stored at `/cubbyhole/
NOTE: Response Wrapping for token creation requires Vault 0.6.0 or higher.
.Creating and storing tokens
====
[source,shell]
----
$ vault token-create -wrap-ttl="10m"
@@ -460,17 +427,14 @@ wrapping_token_ttl: 0h10m0s
wrapping_token_creation_time: 2016-09-18 20:29:48.652957077 +0200 CEST
wrapped_accessor: 46b6aebb-187f-932a-26d7-4f3d86a68319
----
====
.application.yml
====
[source,yaml]
----
spring.cloud.vault:
authentication: CUBBYHOLE
token: 397ccb93-ff6c-b17b-9389-380b01ca2645
----
====
See also:
@@ -492,7 +456,6 @@ Unlike most Vault authentication backends, this backend does not require first-d
Instead, it treats GCP as a Trusted Third Party and uses the cryptographically signed dynamic metadata information that uniquely represents each GCP service account.
.application.yml with required GCP-GCE Authentication properties
====
[source,yaml]
----
spring.cloud.vault:
@@ -500,10 +463,8 @@ spring.cloud.vault:
gcp-gce:
role: my-dev-role
----
====
.application.yml with all GCP-GCE Authentication properties
====
[source,yaml]
----
spring.cloud.vault:
@@ -513,7 +474,6 @@ spring.cloud.vault:
role: my-dev-role
service-account: my-service@projectid.iam.gserviceaccount.com
----
====
* `role` sets the name of the role against which the login is being attempted.
* `gcp-path` sets the path of the GCP mount to use
@@ -540,7 +500,6 @@ environment variable, the Google Compute metadata service, or supplied externall
JSON is the preferred form as it carries the project id and service account identifier required for calling ``projects.serviceAccounts.signJwt``.
.application.yml with required GCP-IAM Authentication properties
====
[source,yaml]
----
spring.cloud.vault:
@@ -548,10 +507,8 @@ spring.cloud.vault:
gcp-iam:
role: my-dev-role
----
====
.application.yml with all GCP-IAM Authentication properties
====
[source,yaml]
----
spring.cloud.vault:
@@ -566,7 +523,6 @@ spring.cloud.vault:
role: my-dev-role
service-account-id: my-service@projectid.iam.gserviceaccount.com
----
====
* `role` sets the name of the role against which the login is being attempted.
* `credentials.location` path to the credentials resource that contains Google credentials in JSON format.
@@ -599,7 +555,6 @@ The authentication is role based and the role is bound to a service account name
A file containing a JWT token for a pods service account is automatically mounted at `/var/run/secrets/kubernetes.io/serviceaccount/token`.
.application.yml with all Kubernetes authentication properties
====
[source,yaml]
----
spring.cloud.vault:
@@ -609,7 +564,6 @@ spring.cloud.vault:
kubernetes-path: kubernetes
service-account-token-file: /var/run/secrets/kubernetes.io/serviceaccount/token
----
====
* `role` sets the Role.
* `kubernetes-path` sets the path of the Kubernetes mount to use.
@@ -630,7 +584,6 @@ Unlike most Vault authentication backends, this backend does not require first-d
Instead, it treats PCF as a Trusted Third Party and uses the managed instance identity.
.application.yml with required PCF Authentication properties
====
[source,yaml]
----
spring.cloud.vault:
@@ -638,10 +591,8 @@ spring.cloud.vault:
pcf:
role: my-dev-role
----
====
.application.yml with all PCF Authentication properties
====
[source,yaml]
----
spring.cloud.vault:
@@ -652,21 +603,20 @@ spring.cloud.vault:
instance-certificate: /etc/cf-instance-credentials/instance.crt
instance-key: /etc/cf-instance-credentials/instance.key
----
====
* `role` sets the name of the role against which the login is being attempted.
* `pcf-path` sets the path of the PCF mount to use.
* `instance-certificate` sets the path to the PCF instance identity certificate.
Defaults to `${CF_INSTANCE_CERT}` env variable.
Defaults to `$\{CF_INSTANCE_CERT}` env variable.
* `instance-key` sets the path to the PCF instance identity key.
Defaults to `${CF_INSTANCE_KEY}` env variable.
Defaults to `$\{CF_INSTANCE_KEY}` env variable.
NOTE: PCF authentication requires BouncyCastle (bcpkix-jdk15on) to be on the classpath for RSA PSS signing.
See also: https://www.vaultproject.io/docs/auth/pcf.html[Vault Documentation: Using the pcf auth backend]
[[vault.config.acl]]
= ACL Requirements
== ACL Requirements
This section explains which paths are accessed by Spring Vault so you can derive your policy declarations from the required capabilities.

View File

@@ -21,7 +21,7 @@ Spring Cloud Vault supports two config locations:
Using the default location mounts property sources for all enabled xref:secret-backends.adoc[Secret Backends].
Without further configuration, Spring Cloud Vault mounts the key-value backend at `/secret/${spring.application.name}`.
Each activated profile adds another context path following the form `/secret/${spring.application.name}/${profile}`.
Each activated profile adds another context path following the form `/secret/$\{spring.application.name}/$\{profile}`.
Adding further modules to the classpath, such as `spring-cloud-config-databases`, provides additional secret backend configuration options which get mounted as property sources if enabled.
If you want to control which context paths are mounted from Vault as `PropertySource`, you can either use a contextual location (`vault:///my/context/path`) or configure a xref:secret-backends.adoc#vault.config.backends.configurer[`VaultConfigurer`].
@@ -32,12 +32,10 @@ You can mix the default locations with contextual locations (or other config sys
This approach is useful in particular if you want to disable the default key-value path computation and mount each key-value backend yourself instead.
.application.yml
====
[source,yaml]
----
spring.config.import: vault://first/context/path, vault://other/path, vault://
----
====
Property names within a Spring `Environment` must be unique to avoid shadowing.
If you use the same secret names in different context paths and you want to expose these as individual properties you can distinguish them by adding a `prefix` query parameter to the location.
@@ -77,7 +75,6 @@ Spring Boot bootstraps the application before a Spring Context is available. The
You can customize the infrastructure used by Spring Cloud Vault by registering custom instances using the `Bootstrapper` API:
.Customizing `ClientHttpRequestFactory`
====
[source,java]
----
ClientOptions options = new ClientOptions();
@@ -90,10 +87,8 @@ new ClientFactoryWrapper(new HttpComponentsClientHttpRequestFactory(builder.buil
SpringApplication application = new SpringApplication(MyApplication.class);
application.addBootstrapRegistryInitializer(registry -> registry.register(ClientFactoryWrapper.class, supplier));
----
====
.Customizing `RestTemplateBuilder`
====
[source,java]
----
InstanceSupplier<RestTemplateBuilder> supplier = context -> {
@@ -107,6 +102,5 @@ InstanceSupplier<RestTemplateBuilder> supplier = context -> {
SpringApplication application = new SpringApplication(MyApplication.class);
application.addBootstrapRegistryInitializer(registry -> registry.register(RestTemplateBuilder.class, supplier));
----
====
See also xref:secret-backends.adoc#vault.config.backends.configurer[Customize which secret backends to expose as PropertySource] and the source of `VaultConfigDataLoader` for customization hooks.

View File

@@ -0,0 +1,6 @@
[[configuration-properties]]
= Configuration Properties
Below you can find a list of configuration properties.
include::partial$_configprops.adoc[]

View File

@@ -12,32 +12,28 @@ Some additional properties of the service may need to be configured in its servi
Service registries that do not provide details about transport layer security need to provide a `scheme` metadata entry to be set either to `https` or `http`.
If no scheme is configured and the service is not exposed as secure service, then configuration defaults to `spring.cloud.vault.scheme` which is `https` when it's not set.
====
[source,yaml]
----
spring.cloud.vault.discovery:
enabled: true
service-id: my-vault-service
----
====
[[vault.config.fail-fast]]
= Vault Client Fail Fast
== Vault Client Fail Fast
In some cases, it may be desirable to fail startup of a service if it cannot connect to the Vault Server.
If this is the desired behavior, set the bootstrap configuration property
`spring.cloud.vault.fail-fast=true` and the client will halt with an Exception.
====
[source,yaml]
----
spring.cloud.vault:
fail-fast: true
----
====
[[vault.config.namespaces]]
= Vault Enterprise Namespace Support
== Vault Enterprise Namespace Support
Vault Enterprise allows using namespaces to isolate multiple Vaults on a single Vault server.
Configuring a namespace by setting
@@ -47,24 +43,21 @@ Configuring a namespace by setting
Please note that this feature is not supported by Vault Community edition and has no effect on Vault operations.
====
[source,yaml]
----
spring.cloud.vault:
namespace: my-namespace
----
====
See also: https://www.vaultproject.io/docs/enterprise/namespaces/index.html[Vault Enterprise: Namespaces]
[[vault.config.ssl]]
= Vault Client SSL configuration
== Vault Client SSL configuration
SSL can be configured declaratively by setting various properties.
You can set either `javax.net.ssl.trustStore` to configure JVM-wide SSL settings or `spring.cloud.vault.ssl.trust-store`
to set SSL settings only for Spring Cloud Vault Config.
====
[source,yaml]
----
spring.cloud.vault:
@@ -75,7 +68,6 @@ spring.cloud.vault:
enabled-protocols: TLSv1.2,TLSv1.3
enabled-cipher-suites: TLS_AES_128_GCM_SHA256
----
====
* `trust-store` sets the resource for the trust-store.
SSL-secured Vault communication will validate the Vault SSL certificate with the specified trust-store.
@@ -87,7 +79,7 @@ SSL-secured Vault communication will validate the Vault SSL certificate with the
Please note that configuring `spring.cloud.vault.ssl.*` can be only applied when either Apache Http Components or the OkHttp client is on your class-path.
[[vault-lease-renewal]]
= Lease lifecycle management (renewal and revocation)
== Lease lifecycle management (renewal and revocation)
With every secret, Vault creates a lease:
metadata containing information such as a time duration, renewability, and more.
@@ -107,7 +99,6 @@ Lease renewal and revocation is enabled by default and can be disabled by settin
to `false`.
This is not recommended as leases can expire and Spring Cloud Vault cannot longer access Vault or services using generated credentials and valid credentials remain active after application shutdown.
====
[source,yaml]
----
spring.cloud.vault:
@@ -118,7 +109,6 @@ spring.cloud.vault:
lease-endpoints: Legacy
----
====
* `enabled` controls whether leases associated with secrets are considered to be renewed and expired secrets are rotated.
Enabled by default.
@@ -132,7 +122,7 @@ Legacy for vault versions before 0.8 and SysLeases for later.
See also: https://www.vaultproject.io/docs/concepts/lease.html[Vault Documentation: Lease, Renew, and Revoke]
[[vault-session-lifecycle]]
= Session token lifecycle management (renewal, re-login and revocation)
== Session token lifecycle management (renewal, re-login and revocation)
A Vault session token (also referred to as `LoginToken`) is quite similar to a lease as it has a TTL, max TTL, and may expire.
Once a login token expires, it cannot be used anymore to interact with Vault.
@@ -148,7 +138,6 @@ Session lifecycle is enabled by default and can be disabled by setting `spring.c
to `false`.
Disabling is not recommended as session tokens can expire and Spring Cloud Vault cannot longer access Vault.
====
[source,yaml]
----
spring.cloud.vault:
@@ -157,7 +146,6 @@ spring.cloud.vault:
refresh-before-expiry: 10s
expiry-threshold: 20s
----
====
* `enabled` controls whether session lifecycle management is enabled to renew session tokens.
Enabled by default.

View File

@@ -1,4 +1,5 @@
:docs: https://cloud.spring.io/spring-cloud-vault/reference/html/
[[quick-start]]
= Quick Start
*Prerequisites*
@@ -127,13 +128,12 @@ where the "application" is injected as the `spring.application.name` in the
Properties retrieved from Vault will be used "as-is" without further prefixing of the property names.
[[client-side-usage]]
= Client Side Usage
== Client Side Usage
To use these features in an application, just build it as a Spring Boot application that depends on `spring-cloud-vault-config` (e.g. see the test cases).
Example Maven configuration:
.pom.xml
====
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
----
<parent>
@@ -167,11 +167,9 @@ Example Maven configuration:
<!-- repositories also needed for snapshots and milestones -->
----
====
Then you can create a standard Spring Boot application, like this simple HTTP server:
====
[source,java]
----
@SpringBootApplication
@@ -188,13 +186,11 @@ public class Application {
}
}
----
====
When it runs it will pick up the external configuration from the default local Vault server on port `8200` if it is running.
To modify the startup behavior you can change the location of the Vault server using `application.properties`, for example
.application.yml
====
[source,yaml]
----
spring.cloud.vault:
@@ -207,7 +203,6 @@ spring.cloud.vault:
config:
spring.config.import: vault://
----
====
* `host` sets the hostname of the Vault host.
The host name will be used for SSL certificate validation
@@ -221,8 +216,8 @@ Supported schemes are `http` and `https`.
Enabling further integrations requires additional dependencies and configuration.
Depending on how you have set up Vault you might need additional configuration like
{docs}#vault.config.ssl[SSL] and
{docs}#vault.config.authentication[authentication].
xref:other-topics.adoc#vault.config.ssl[SSL] and
xref:authentication.adoc#vault.config.authentication[authentication].
If the application imports the `spring-boot-starter-actuator` project, the status of the vault server will be available via the `/health` endpoint.
@@ -237,19 +232,17 @@ You can enable the bootstrap context either by setting the configuration propert
Vault requires an https://www.vaultproject.io/docs/concepts/auth.html[authentication mechanism] to https://www.vaultproject.io/docs/concepts/tokens.html[authorize client requests].
Spring Cloud Vault supports multiple {docs}#vault.config.authentication[authentication mechanisms] to authenticate applications with Vault.
Spring Cloud Vault supports multiple xref:authentication.adoc#vault.config.authentication[authentication mechanisms] to authenticate applications with Vault.
For a quickstart, use the root token printed by the xref:quickstart.adoc#quickstart.vault.start[Vault initialization].
.application.yml
====
[source,yaml]
----
spring.cloud.vault:
token: 19aefa97-cccc-bbbb-aaaa-225940e63d76
spring.config.import: vault://
----
====
WARNING: Consider carefully your security requirements.
Static token authentication is fine if you want quickly get started with Vault, but a static token is not protected any further.

View File

@@ -45,7 +45,6 @@ Properties are exposed like they are stored (i.e. without additional prefixes).
NOTE: Spring Cloud Vault adds the `data/` context between the mount path and the actual context path depending on whether the mount uses the versioned key-value backend.
====
[source,yaml]
----
spring.cloud.vault:
@@ -57,7 +56,6 @@ spring.cloud.vault:
application-name: my-app
profiles: local, cloud
----
====
* `enabled` setting this value to `false` disables the secret backend config usage
* `backend` sets the path of the secret mount to use
@@ -81,7 +79,6 @@ The Consul integration requires the `spring-cloud-vault-config-consul`
dependency.
.pom.xml
====
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
----
<dependencies>
@@ -92,7 +89,6 @@ dependency.
</dependency>
</dependencies>
----
====
The integration can be enabled by setting
`spring.cloud.vault.consul.enabled=true` (default `false`) and providing the role name with `spring.cloud.vault.consul.role=…`.
@@ -101,7 +97,6 @@ The obtained token is stored in `spring.cloud.consul.token`
so using Spring Cloud Consul can pick up the generated credentials without further configuration.
You can configure the property name by setting `spring.cloud.vault.consul.token-property`.
====
[source,yaml]
----
spring.cloud.vault:
@@ -111,7 +106,6 @@ spring.cloud.vault:
backend: consul
token-property: spring.cloud.consul.token
----
====
* `enabled` setting this value to `true` enables the Consul backend config usage
* `role` sets the role name of the Consul role definition
@@ -129,7 +123,6 @@ The RabbitMQ integration requires the `spring-cloud-vault-config-rabbitmq`
dependency.
.pom.xml
====
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
----
<dependencies>
@@ -140,7 +133,6 @@ dependency.
</dependency>
</dependencies>
----
====
The integration can be enabled by setting
`spring.cloud.vault.rabbitmq.enabled=true` (default `false`) and providing the role name with `spring.cloud.vault.rabbitmq.role=…`.
@@ -150,7 +142,6 @@ and `spring.rabbitmq.password` so using Spring Boot will pick up the generated c
You can configure the property names by setting `spring.cloud.vault.rabbitmq.username-property` and
`spring.cloud.vault.rabbitmq.password-property`.
====
[source,yaml]
----
spring.cloud.vault:
@@ -161,7 +152,6 @@ spring.cloud.vault:
username-property: spring.rabbitmq.username
password-property: spring.rabbitmq.password
----
====
* `enabled` setting this value to `true` enables the RabbitMQ backend config usage
* `role` sets the role name of the RabbitMQ role definition
@@ -180,7 +170,6 @@ The AWS integration requires the `spring-cloud-vault-config-aws`
dependency.
.pom.xml
====
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
----
<dependencies>
@@ -191,7 +180,6 @@ dependency.
</dependency>
</dependencies>
----
====
The integration can be enabled by setting
`spring.cloud.vault.aws=true` (default `false`) and providing the role name with `spring.cloud.vault.aws.role=…`.
@@ -212,7 +200,6 @@ For STS security token, you can configure the property name by setting `spring.c
Example: iam_user
====
[source,yaml]
----
spring.cloud.vault:
@@ -223,10 +210,8 @@ spring.cloud.vault:
access-key-property: cloud.aws.credentials.accessKey
secret-key-property: cloud.aws.credentials.secretKey
----
====
Example: assumed_role (STS)
====
[source,yaml]
----
spring.cloud.vault:
@@ -241,7 +226,6 @@ spring.cloud.vault:
ttl: 3600s
role-arn: arn:aws:iam::${AWS_ACCOUNT}:role/sts-app-role
----
====
* `enabled` setting this value to `true` enables the AWS backend config usage
* `role` sets the role name of the AWS role definition
@@ -256,7 +240,7 @@ spring.cloud.vault:
See also: https://www.vaultproject.io/docs/secrets/aws/index.html[Vault Documentation: Setting up AWS with Vault]
[[vault.config.backends.database-backends]]
= Database backends
== Database backends
Vault supports several database secret backends to generate database credentials dynamically based on configured roles.
This means services that need to access a database no longer need to configure credentials: they can request them from Vault, and use Vault's leasing mechanism to more easily roll keys.
@@ -279,7 +263,6 @@ You can use that specific backend by using the generic database backend.
Make sure to specify the appropriate backend path, e.g. `spring.cloud.vault.mysql.role.backend=database`.
.pom.xml
====
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
----
<dependencies>
@@ -290,7 +273,6 @@ Make sure to specify the appropriate backend path, e.g. `spring.cloud.vault.mysq
</dependency>
</dependencies>
----
====
NOTE: Enabling multiple JDBC-compliant databases will generate credentials and store them by default in the same property keys hence property names for JDBC secrets need to be configured separately.
@@ -310,7 +292,6 @@ You can configure the property names by setting
`spring.cloud.vault.database.username-property` and
`spring.cloud.vault.database.password-property`.
====
[source,yaml]
----
spring.cloud.vault:
@@ -321,7 +302,6 @@ spring.cloud.vault:
username-property: spring.datasource.username
password-property: spring.datasource.password
----
====
[[vault.config.backends.databases]]
== Multiple Databases
@@ -331,7 +311,6 @@ Beginning with version 3.0.5, Spring Vault supports the configuration of multipl
The configuration accepts multiple database backends to materialize credentials into the specified properties. Make sure to configure `username-property` and `password-property` appropriately.
====
[source,yaml]
----
spring.cloud.vault:
@@ -349,7 +328,6 @@ spring.cloud.vault:
username-property: spring.secondary-datasource.username
password-property: spring.secondary-datasource.password
----
====
* `<name>` descriptive name of the database configuration.
* `<name>.enabled` setting this value to `true` enables the Database backend config usage
@@ -378,7 +356,6 @@ You can configure the property names by setting
`spring.cloud.vault.cassandra.username-property` and
`spring.cloud.vault.cassandra.password-property`.
====
[source,yaml]
----
spring.cloud.vault:
@@ -389,7 +366,6 @@ spring.cloud.vault:
username-property: spring.data.cassandra.username
password-property: spring.data.cassandra.password
----
====
* `enabled` setting this value to `true` enables the Cassandra backend config usage
* `role` sets the role name of the Cassandra role definition
@@ -412,7 +388,6 @@ You can configure the property names by setting
`spring.cloud.vault.couchbase.username-property` and
`spring.cloud.vault.couchbase.password-property`.
====
[source,yaml]
----
spring.cloud.vault:
@@ -423,7 +398,6 @@ spring.cloud.vault:
username-property: spring.couchbase.username
password-property: spring.couchbase.password
----
====
* `enabled` setting this value to `true` enables the Couchbase backend config usage
* `role` sets the role name of the Couchbase role definition
@@ -446,7 +420,6 @@ You can configure the property names by setting
`spring.cloud.vault.elasticsearch.username-property` and
`spring.cloud.vault.elasticsearch.password-property`.
====
[source,yaml]
----
spring.cloud.vault:
@@ -457,7 +430,6 @@ spring.cloud.vault:
username-property: spring.elasticsearch.rest.username
password-property: spring.elasticsearch.rest.password
----
====
* `enabled` setting this value to `true` enables the Elasticsearch database backend config usage
* `role` sets the role name of the Elasticsearch role definition
@@ -482,7 +454,6 @@ You can configure the property names by setting
`spring.cloud.vault.mongodb.username-property` and
`spring.cloud.vault.mongodb.password-property`.
====
[source,yaml]
----
spring.cloud.vault:
@@ -493,7 +464,6 @@ spring.cloud.vault:
username-property: spring.data.mongodb.username
password-property: spring.data.mongodb.password
----
====
* `enabled` setting this value to `true` enables the MongodB backend config usage
* `role` sets the role name of the MongoDB role definition
@@ -519,7 +489,6 @@ You can configure the property names by setting
`spring.cloud.vault.mysql.username-property` and
`spring.cloud.vault.mysql.password-property`.
====
[source,yaml]
----
spring.cloud.vault:
@@ -530,7 +499,6 @@ spring.cloud.vault:
username-property: spring.datasource.username
password-property: spring.datasource.password
----
====
* `enabled` setting this value to `true` enables the MySQL backend config usage
* `role` sets the role name of the MySQL role definition
@@ -556,7 +524,6 @@ You can configure the property names by setting
`spring.cloud.vault.postgresql.username-property` and
`spring.cloud.vault.postgresql.password-property`.
====
[source,yaml]
----
spring.cloud.vault:
@@ -567,7 +534,6 @@ spring.cloud.vault:
username-property: spring.datasource.username
password-property: spring.datasource.password
----
====
* `enabled` setting this value to `true` enables the PostgreSQL backend config usage
* `role` sets the role name of the PostgreSQL role definition
@@ -578,7 +544,7 @@ spring.cloud.vault:
See also: https://www.vaultproject.io/docs/secrets/postgresql/index.html[Vault Documentation: Setting up PostgreSQL with Vault]
[[vault.config.backends.configurer]]
= Customize which secret backends to expose as PropertySource
== Customize which secret backends to expose as PropertySource
Spring Cloud Vault uses property-based configuration to create ``PropertySource``s for key-value and discovered secret backends.
@@ -592,7 +558,6 @@ Default key-value and discovered backend registration is disabled if you provide
You can however enable default registration with
`SecretBackendConfigurer.registerDefaultKeyValueSecretBackends()` and `SecretBackendConfigurer.registerDefaultDiscoveredSecretBackends()`.
====
[source,java]
----
public class CustomizationBean implements VaultConfigurer {
@@ -612,10 +577,9 @@ public class CustomizationBean implements VaultConfigurer {
SpringApplication application = new SpringApplication(MyApplication.class);
application.addBootstrapper(VaultBootstrapper.fromConfigurer(new CustomizationBean()));
----
====
[[vault.config.backends.custom]]
= Custom Secret Backend Implementations
== Custom Secret Backend Implementations
Spring Cloud Vault ships with secret backend support for the most common backend integrations.
You can integrate with any kind of backend by providing an implementation that describes how to obtain data from the backend you want to use and how to surface data provided by that backend by providing a `PropertyTransformer`.

View File

@@ -1,25 +0,0 @@
[[spring-cloud-vault]]
= Spring Cloud Vault
:page-section-summary-toc: 1
:page-section-summary-toc: 1
:github: https://github.com/spring-cloud/spring-cloud-vault
:githubmaster: {github}/tree/master
:revnumber: {project-version}
:docslink: {githubmaster}/docs/src/main/asciidoc
:nofooter:
(C) 2016-2021 the original authors.
NOTE: _Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically._
[[quick-start]]
== Quick Start

View File

@@ -137,4 +137,4 @@
|spring.cloud.vault.token | | Static vault token. Required if {@link #authentication} is {@code TOKEN}.
|spring.cloud.vault.uri | | Vault URI. Can be set with scheme, host and port.
|===
|===