我正在关注以下引用的Vault配置示例:https://spring.io/guides/gs/vault-config/。我已经使用Windows机启动了服务器。
vault server --dev --dev-root-token-id="00000000-0000-0000-0000-000000000000"
两个环境变量,用于将Vault CLI指向Vault端点并提供身份验证令牌。
set VAULT_TOKEN="00000000-0000-0000-0000-000000000000"
set VAULT_ADDR=http://127.0.0.1:8200
我收到以下错误:
C:\Softwares\vault_1.0.1_windows_amd64>vault write secret/gs-vault-config example.username=demouser example.password=demopassword
Error writing data to secret/gs-vault-config: Error making API request.
URL: PUT http://127.0.0.1:8200/v1/secret/gs-vault-config
Code: 403. Errors:
* permission denied
我能够解决简单使用set VAULT_TOKEN=00000000-0000-0000-0000-000000000000
现在,在Hashicorp Vault
创建键值有变化。使用kv put
而不是write
。
>vault kv put secret/gs-vault-config example.username=demouser example.password=demopassword
Key Value
--- -----
created_time 2018-12-26T14:25:07.5400739Z
deletion_time n/a
destroyed false
version 1
>vault kv put secret/gs-vault-config/cloud example.username=clouduser example.password=cloudpassword
Key Value
--- -----
created_time 2018-12-26T14:25:53.0980305Z
deletion_time n/a
destroyed false
version 1
在Windows中,Step1:设置VAULT_TOKEN和VAULT_ADDR
SET VAULT_TOKEN = 00000000-0000-0000-0000-000000000000
SET VAULT_ADDR = http://127.0.0.1:8200
第2步:使用kv put放入密钥和密码
vault kv put secret / gs-vault-config example.username = hello example.password = world