【问题标题】:How to present correct openid-configuration when running HCP Vault behind a reverse proxy?在反向代理后面运行 HCP Vault 时如何呈现正确的 openid 配置?
【发布时间】:2022-11-10 20:42:20
【问题描述】:

我在 Hashicorp 云平台上运行了 Vault,我正在尝试使用 OIDC provider。由于防火墙规则之类的,我在它前面放了一个 Nginx 反向代理,这给 OIDC 发现带来了问题。

openid-configuration 在https://my-reverse-proxy.example.com/v1/admin/identity/oidc/provider/my-provider/.well-known/openid-configuration 上是可读的。但是该文件中的端点都属于集群本身:

{
  "issuer": "https://my-vault-cluster.hashicorp.cloud:8200/v1/admin/identity/oidc/provider/my-provider",
  "jwks_uri": "https://my-vault-cluster.hashicorp.cloud:8200/v1/admin/identity/oidc/provider/my-provider/.well-known/keys",
  "authorization_endpoint": "https://my-vault-cluster.hashicorp.cloud:8200/ui/vault/admin/identity/oidc/provider/my-provider/authorize",
  "token_endpoint": "https://my-vault-cluster.hashicorp.cloud:8200/v1/admin/identity/oidc/provider/my-provider/token",
  "userinfo_endpoint": "https://my-vault-cluster.hashicorp.cloud:8200/v1/admin/identity/oidc/provider/my-provider/userinfo",
  ...
}

我怎样才能解决这个问题?我需要在 Nginx 中设置一些标头吗?或者我可以在 Vault 中进行一些配置吗?请注意,这是 HCP,因此我无法完全控制 Vault Configuration

【问题讨论】:

    标签: nginx reverse-proxy openid-connect saas hashicorp-vault


    【解决方案1】:

    原来这在 nginx 中是相当标准的,我需要做的就是将它添加到 location 块中:

    sub_filter_types application/json;
    sub_filter_once off;
    sub_filter "https://my-vault-cluster.hashicorp.cloud:8200" "https://my-reverse-proxy.example.com";
    
    

    【讨论】:

      猜你喜欢
      • 2020-06-07
      • 1970-01-01
      • 2020-02-22
      • 2012-03-18
      • 2023-03-25
      • 1970-01-01
      • 2019-10-15
      • 1970-01-01
      • 2016-05-05
      相关资源
      最近更新 更多