【问题标题】:Hashicorp Vault: failed to look up namespace from the tokenHashicorp Vault:无法从令牌中查找命名空间
【发布时间】:2020-12-06 08:07:12
【问题描述】:

我已在 AWS EC2 服务器中安装了 Hashicorp Vault,并尝试使用“AWS 身份验证”使用 AWS Lambda 函数访问存储在保险库中的密钥。但我收到以下错误。

{u'errors': [u'error performing token check: failed to look up namespace from the token: no namespace']}

我基本上是在做以下事情

  1. 在 EC2 服务器中安装 Hashicorp Vault,启用 AWS 身份验证

  2. 使用 AWS 角色在 Vault 中设置策略和角色

  3. 创建了一个基于 Python 的 AWS Lambda 函数来生成签名的 AWS STS 请求

  4. 使用签名请求,成功登录到保管库服务器。响应如下。

    {
    u'lease_id':  u'',
     u'warnings':  [
        u'TTL of "768h" exceeded the effective max_ttl of "500h"; TTL value is capped accordingly'
    ],
     u'wrap_info':  None,
     u'auth':  {
        u'token_policies':  [
            u'default',
             u'examplepolicy'
        ],
         u'orphan':  True,
         u'entity_id':  u'xxxxxxxxxxxxxx',
         u'token_type':  u'service',
         u'lease_duration':  1800000,
         u'policies':  [
            u'default',
             u'examplepolicy'
        ],
         u'client_token':  u'xxxxxxxxxxxxxx',
         u'accessor':  u'xxxxxxxxxxxxxx',
         u'renewable':  True,
         u'metadata':  {
            u'auth_type':  u'iam',
             u'account_id':  u'xxxxxxxxxxxxxx',
             u'role_id':  u'xxxxxxxxxxxxxx'
        }
    },
     u'lease_duration':  0,
     u'request_id':  u'xxxxxxxxxxxxxx',
     u'data':  None,
     u'renewable':  False
    

    }

  5. 现在使用上面响应中的客户端令牌尝试获取密钥,如下所示

    secretKey = requests.get(url1,headers = {"X-Vault-Token": clienttoken})

  6. 执行上述行后我立即收到以下错误。

    {u'errors': [u'error execution token check: failed to look up namespace from the token: no namespace']}

【问题讨论】:

  • 你试过不带引号的 X-Vault-Token 吗?那是我在 R 编程环境中遇到的问题。

标签: python amazon-web-services aws-lambda hashicorp-vault


【解决方案1】:

使用“Authorization: Bearer token”代替“X-Vault-Token: token”标头

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-05-24
    • 2020-10-28
    • 2019-07-20
    • 1970-01-01
    • 2022-01-22
    • 2021-09-19
    • 2021-05-07
    • 1970-01-01
    相关资源
    最近更新 更多