使用盐为hashicorp-vault
创建令牌时遇到问题。
创建令牌:
$ curl --header "X-Vault-Token: f3821c23-4558-72db-8739-bbf7ac4b90d1" \
--request POST \
--data @create_token.json \
http://127.0.0.1:8200/v1/auth/token/create
{"request_id":"72ba8117-fcb8-506d-f1c4-fe0e5e0f5cbf","lease_id":"","renewable":false,"lease_duration":0,"data":null,"wrap_info":null,"warnings":["Policy \"saltstack/minion/myhost\" does not exist"],"auth":{"client_token":"96bfd0f2-a10a-d966-2d46-3f803fb1d995","accessor":"8a0a296f-d19a-e01c-4782-0fbab06a6ebe","policies":["default","saltstack/minion/admin.p13","saltstack/minions"],"metadata":null,"lease_duration":2764800,"renewable":true,"entity_id":""}}
使用第一个操作的client_token
创建一个子令牌。
$ curl --header "X-Vault-Token: 96bfd0f2-a10a-d966-2d46-3f803fb1d995" \
--request POST \
--data @test.json \
http://127.0.0.1:8200/v1/auth/token/create
{"errors":["parent token lookup failed"]}
使用的有效载荷:
文件create_token.json
{"policies": ["saltstack/minion/myhost", "saltstack/minions"], "num_uses":1}
文件test.json
{"num_uses": 0, "policies": ["default", "myapp"], "ttl": "1h", "no_parent": true, "renewable": true, "metadata": {"user": "root"}}
答案 0 :(得分:1)
只能创建孤立令牌:
auth/token/create-orphan
端点sudo
时具有auth/token/create
功能或根策略,并且将孤立参数设置为true 这暗示您的初始令牌没有与之关联的根策略。正如您在下面的策略列表中看到的那样,
"policies":["default","saltstack/minion/admin.p13","saltstack/minions"],"metadata":null,"lease_duration":2764800,"renewable":true,"entity_id":""}}
在旁边,
如果您使用盐,则您的主令牌必须具有在小黄人中创建新令牌的特权,然后可以使用vault.write_secret