代码:403。错误:权限被拒绝 - 在 API 调用 Hashicorp Vault 时

Code: 403. Errors: permission denied - while making API call to Hashicorp Vault

我正在关注 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 中创建 key-value 有变化。使用 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,

第一步:

set the 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