Support other means of vault authentication
SpringBoot: 2.0.0.M3 cloud: Finchley.M1
I need to use Config server with Git and vault . (application.properties) And another configuration on Configserver that will use Git(But will point to local file path) and Vault (application-local.properties). POM
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-vault-config</artifactId>
</dependency>
When I provide the properties for vault as below.
spring.profiles.active=vault, git
spring.cloud.config.server.vault.order=1
spring.cloud.config.server.git.order=2
spring.cloud.config.server.vault.host=192.168.33.10
spring.cloud.config.server.vault.port=8200
spring.cloud.config.server.vault.scheme=http
spring.cloud.config.server.vault.token=419113c3-d058-faca-4965-b6e03a918a28
#spring.cloud.config.token=419113c3-d058-faca-4965-b6e03a918a28
spring.cloud.config.server.vault.uri=http://192.168.33.10:8200
spring.cloud.config.server.vault.connection-timeout=5000
spring.cloud.config.server.vault.read-timeout=15000
It doesn't connect to vault server and i get an exception -
.lang.IllegalArgumentException: Token (spring.cloud.vault.token) must not be empty
springframework.util.Assert.hasText(Assert.java:276) ~[spring-core-5.0.0.RC3.jar!/:5.0.0.RC3]
springframework.cloud.vault.config.VaultBootstrapConfiguration.clientAuthentication(VaultBootstrapConf
springframework.cloud.vault.config.VaultBootstrapConfiguration$$EnhancerBySpringCGLIB$$937026be.CGLIB$
When i provide the values in bootstrap as below -
spring.cloud.vault.host=192.168.33.10
spring.cloud.vault.port=8200
spring.cloud.vault.scheme=http
spring.cloud.vault.token=419113c3-d058-faca-4965-b6e03a918a28
spring.cloud.vault.uri=http://192.168.33.10:8200
spring.cloud.vault.connection-timeout=5000
spring.cloud.vault.read-timeout=15000
It is then able to give me the required details when i hit the url - http://localhost:1010/ttt-microservice/default/develop/
However, if i do not give these values in bootstrap but provide the same in application.properties I again run in to the same error. Should these configurations not be handled automatically when I am providing them for spring.cloud.config.server...
Also, if i omit the spring.cloud.config.server.xxx configurations and just provide the spring.cloud.xx properties it keeps looking for the localhost for vault server
"timestamp": 1507102549084,
"status": 500,
"error": "Internal Server Error",
"message": "I/O error on GET request for \"http://127.0.0.1:8200/v1/secret/ttt-microservice\": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect",
"path": "/ttt-microservice/default/develop/"
Please clarify. Because this is bit different then the example for git and svn. thanks aakash
Related to https://github.com/spring-cloud/spring-cloud-vault/issues/164
@mp911de thanks for your prompt reply is there any provision/ticket so cloud config server supporting vault can handle the connections from clients dynamically instead of hardcoded token through xconfigtoken
Yes, you can pass X-Vault-Token with each HTTP request. I'm not sure whether that's also possible using Spring Cloud Config Client. Maybe @spencergibb or @ryanjbaxter can help.
Please learn how to properly format code and logs.
Config server doesn't recognize spring.cloud.vault.* properties.
The config client needs to set the vault token in spring.cloud.config.token in bootstrap.yml
@spencergibb thanks can you update is there any provision in future to move away from x-config-token to dynamic authentication at client side. As token may not be secured way and will have ttl and other issues to handle on restarts
hi @spencergibb can you please update so i will close the issue. thanks
I am also facing this issue when using Spring cloud config server with vault. Can you please provide some URL reference for complete configurations? I have referred https://spring.io/blog/2016/06/24/managing-secrets-with-vault .
Hi All,
Followed below URL and created a sample example of spring-cloud-vault locally.
https://github.com/gmarziou/demo-spring-cloud-vault
Showing below connection refused error.
main] LeaseEventPublisher$LoggingErrorListener : [RequestedSecret [path='secret/bootstrap/vault', mode=RENEW]] Lease [leaseId='null', leaseDuration=0, renewable=false] I/O error on GET request for "http://localhost:8200/v1/secret/bootstrap/vault": Connect to localhost:8200 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect; nested exception is org.apache.http.conn.HttpHostConnectException: Connect to localhost:8200 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:8200/v1/secret/bootstrap/vault": Connect to localhost:8200 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect; nested exception is org.apache.http.conn.HttpHostConnectException: Connect to localhost:8200 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
Tried with changing the above mentioned configuration still showing errors. It would be great help.
Thanks
Is the problem still there in Finchley.RELEASE?
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.