Allow for configurable keystore / truststore type in ssl options
We've introduced two new configuration properties (spring.cloud.vault.ssl.key-store-type=…/spring.cloud.vault.ssl.trust-store-type=…) to configure the keystore type including PEM support. Resolves gh-387.
This commit is contained in:
@@ -411,6 +411,7 @@ spring.cloud.vault:
|
||||
ssl:
|
||||
key-store: classpath:keystore.jks
|
||||
key-store-password: changeit
|
||||
key-store-type: JKS
|
||||
cert-auth-path: cert
|
||||
----
|
||||
====
|
||||
|
||||
@@ -7,3 +7,4 @@ This section briefly covers items that are new and noteworthy in the latest rele
|
||||
|
||||
* Migration of `PropertySource` initialization from Spring Cloud's Bootstrap Context to Spring Boot's <<vault.configdata,ConfigData API>>.
|
||||
* Support for the <<vault.config.backends.couchbase>> backend.
|
||||
* Configuration of keystore/truststore types through `spring.cloud.vault.ssl.key-store-type=…`/`spring.cloud.vault.ssl.trust-store-type=…` including PEM support.
|
||||
|
||||
@@ -70,12 +70,14 @@ spring.cloud.vault:
|
||||
ssl:
|
||||
trust-store: classpath:keystore.jks
|
||||
trust-store-password: changeit
|
||||
trust-store-type: JKS
|
||||
----
|
||||
====
|
||||
|
||||
* `trust-store` sets the resource for the trust-store.
|
||||
SSL-secured Vault communication will validate the Vault SSL certificate with the specified trust-store.
|
||||
* `trust-store-password` sets the trust-store password
|
||||
* `trust-store-type` sets the trust-store type. Supported values are all supported `KeyStore` types including `PEM`.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
@@ -81,6 +81,10 @@ final class VaultConfiguration {
|
||||
else {
|
||||
keyStore = KeyStoreConfiguration.of(ssl.getKeyStore());
|
||||
}
|
||||
|
||||
if (StringUtils.hasText(ssl.getKeyStoreType())) {
|
||||
keyStore = keyStore.withStoreType(ssl.getKeyStoreType());
|
||||
}
|
||||
}
|
||||
|
||||
if (ssl.getTrustStore() != null) {
|
||||
@@ -91,6 +95,10 @@ final class VaultConfiguration {
|
||||
else {
|
||||
trustStore = KeyStoreConfiguration.of(ssl.getTrustStore());
|
||||
}
|
||||
|
||||
if (StringUtils.hasText(ssl.getTrustStoreType())) {
|
||||
trustStore = trustStore.withStoreType(ssl.getTrustStoreType());
|
||||
}
|
||||
}
|
||||
|
||||
return new SslConfiguration(keyStore, trustStore);
|
||||
|
||||
@@ -971,6 +971,13 @@ public class VaultProperties implements EnvironmentAware {
|
||||
*/
|
||||
private String keyStorePassword;
|
||||
|
||||
/**
|
||||
* Type of the key store.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
private String keyStoreType;
|
||||
|
||||
/**
|
||||
* Trust store that holds SSL certificates.
|
||||
*/
|
||||
@@ -981,6 +988,13 @@ public class VaultProperties implements EnvironmentAware {
|
||||
*/
|
||||
private String trustStorePassword;
|
||||
|
||||
/**
|
||||
* Type of the trust store.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
private String trustStoreType;
|
||||
|
||||
/**
|
||||
* Mount path of the TLS cert authentication backend.
|
||||
*/
|
||||
@@ -991,38 +1005,54 @@ public class VaultProperties implements EnvironmentAware {
|
||||
return this.keyStore;
|
||||
}
|
||||
|
||||
public String getKeyStorePassword() {
|
||||
return this.keyStorePassword;
|
||||
}
|
||||
|
||||
public Resource getTrustStore() {
|
||||
return this.trustStore;
|
||||
}
|
||||
|
||||
public String getTrustStorePassword() {
|
||||
return this.trustStorePassword;
|
||||
}
|
||||
|
||||
public String getCertAuthPath() {
|
||||
return this.certAuthPath;
|
||||
}
|
||||
|
||||
public void setKeyStore(Resource keyStore) {
|
||||
this.keyStore = keyStore;
|
||||
}
|
||||
|
||||
public String getKeyStorePassword() {
|
||||
return this.keyStorePassword;
|
||||
}
|
||||
|
||||
public void setKeyStorePassword(String keyStorePassword) {
|
||||
this.keyStorePassword = keyStorePassword;
|
||||
}
|
||||
|
||||
public String getKeyStoreType() {
|
||||
return this.keyStoreType;
|
||||
}
|
||||
|
||||
public void setKeyStoreType(String keyStoreType) {
|
||||
this.keyStoreType = keyStoreType;
|
||||
}
|
||||
|
||||
public Resource getTrustStore() {
|
||||
return this.trustStore;
|
||||
}
|
||||
|
||||
public void setTrustStore(Resource trustStore) {
|
||||
this.trustStore = trustStore;
|
||||
}
|
||||
|
||||
public String getTrustStorePassword() {
|
||||
return this.trustStorePassword;
|
||||
}
|
||||
|
||||
public void setTrustStorePassword(String trustStorePassword) {
|
||||
this.trustStorePassword = trustStorePassword;
|
||||
}
|
||||
|
||||
public String getTrustStoreType() {
|
||||
return this.trustStoreType;
|
||||
}
|
||||
|
||||
public void setTrustStoreType(String trustStoreType) {
|
||||
this.trustStoreType = trustStoreType;
|
||||
}
|
||||
|
||||
public String getCertAuthPath() {
|
||||
return this.certAuthPath;
|
||||
}
|
||||
|
||||
public void setCertAuthPath(String certAuthPath) {
|
||||
this.certAuthPath = certAuthPath;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user