我正在尝试将Spring boot config server与git和vault一起使用,我的所有Spring boot客户端应用程序都将通过config server通过传递vault config令牌来检索vault属性。
我使用的是Spring靴2.1.8。发布和下方是POM。我的Spring Boot配置服务器的xml文件。
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.8.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.ps.psc</groupId>
<artifactId>psc-config-server</artifactId>
<version>0.0.1</version>
<name>psc-config-server</name>
<description>Spring configuration server</description>
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>Greenwich.SR2</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
<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>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-monitor</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
bootstrap.yml文件
spring:
profiles:
active:
- git
- vault
cloud:
config:
enabled: true
server:
git:
order: 2
username: ********
password: ********
uri: https://*******@bitbucket.org/krushna/configuration.git
search-paths:
- payment*
vault:
host: 127.0.0.1
port: 8200
scheme: http
order: 1
skip-ssl-validation: true
kv-version: 1
vault:
authentication: TOKEN
token: s.PB5cAJ9WhOuWamIOuFVkzpbl
scheme: http
host: 127.0.0.1
port: 8200
config:
order: 1
我的申请。yml文件
server:
port: 7000
spring:
application:
name: configserver
通过上述配置,我的配置服务器只能从GIT而不是vault读取属性。
在vault中,我编写了如下属性。
vault write secret/payment password=test@123
如果我像下面这样打curl电话
curl -X "GET" "http://127.0.0.1:7000/payment/default" -H "X-Config-Token: s.PB5cAJ9WhOuWamIOuFVkzpbl"
我只从git获取属性,下面有回复。
{
"name": "payment",
"profiles": ["default"],
"label": null,
"version": "e9b941d22f6b7cd3083a731d168f78fa4ec0fc42",
"state": null,
"propertySources": [{
"name": "https://******@bitbucket.org/krushna/configuration.git/application.properties",
"source": {
"foofromGit": "bar"
}
}]
}
我在这里做什么?我尝试了多个选项,如不同的KV版本,只配置Spring cloud de config vault等。
编辑:
我使用了如下vault conf。
backend "file" {
path = "vault"
}
listener "tcp" {
tls_disable = 1
}
并做卷曲跳马干我现在能够读取值。
curl -X GET -H "X-Vault-Token:s.PB5cAJ9WhOuWamIOuFVkzpbl" http://127.0.0.1:8200/v1/secret/payment/
答复:
{
"request_id": "35c8793e-3530-81c1-7917-3e922ef4065b",
"lease_id": "",
"renewable": false,
"lease_duration": 2764800,
"data": {
"password": "test@123"
},
"wrap_info": null,
"warnings": null,
"auth": null
}
我能够通过移动git和Spring cloud de配置库配置细节从bootstrap.ymlapplication.yml如下所示来解决这个问题。
独自创立yml公司
spring:
application:
name: configserver
cloud:
vault:
authentication: TOKEN
token: s.jyFarEyroi5pJNOxPnhT4f3D
scheme: http
host: 127.0.0.1
port: 8200
config:
order: 1
应用yml公司
server:
port: 7000
spring:
profiles:
active: git, vault
cloud:
config:
server:
git:
uri: https://krushna@bitbucket.org/krushna/configuration.git
search-paths:
- payment*
vault:
port: 8200
host: 127.0.01
skip-ssl-validation: true
scheme: http
我还不清楚这是如何解决问题的?,我只知道引导程序将首先加载,我正在从vault读取git凭据,然后从应用程序读取。yml提供了spring cloud config vault和git的其他详细信息。
欢迎对此进行任何解释
我是Vault的新手。我正在尝试使用APPROLE作为身份验证方法将Vault与Spring引导集成。我的bootstrap.yml配置如下: 当我使用此配置运行时。我出错了 org.springframework.beans.factory。BeanCreationException:创建名为“vaultTemplate”的bean时出错,该bean在类路径资源[org/springframew
Ansible 1.5的新版本中, “Vault” 作为 ansible 的一项新功能可将例如passwords,keys等敏感数据文件进行加密,而非存放在明文的 playbooks 或 roles 中. 这些 vault 文件可以分散存放也可以集中存放. 通过`ansible-vault` 来编辑文件,经常用到的命令如 –ask-vault-pass , –vault-password-file
Vault 是秘密访问私密信息的工具,可以帮你管理一些私密的信息,比如 API 密钥,密码,验证等等。Vault 提供一个统一的接口来访问所有隐私信息,同时提供严格的访问控制和记录详细的审计日志。 一个现代化系统需要访问多种多样的隐私信息:数据库凭证,外部服务 API 密钥;面向服务架构通讯验证等等。那么知道谁在什么时候访问了这些隐私信息是重要的,Vault 就提供了这些功能,可以安全的存储所有隐
我看到的关于获取访问令牌以访问Azure密钥库的所有示例都涉及到使用ClientId和ClientSecret为众所周知的https://Vault.Azure.NET资源请求一个令牌。 这工作很好...但我希望能够使用集成安全获得一个访问令牌,以访问密钥库。 例如,我有 如何更新RequiredResourceAccessList? 更新:下面是如何配置应用程序的
AWS Vault AWS Vault is a tool to securely store and access AWS credentials in a development environment. AWS Vault stores IAM credentials in your operating system's secure keystore and then generates
Porn Vault Manage your ever-growing porn collection For more info, guides, etc. check the official web page There's a Discord channel! Join in to the discussion: Discord Support Support on Patreon Con