首页 > 解决方案 > 在 Istio 中为“set_current_client_cert_details”配置 EnvoyFilter

问题描述

我有一个场景,我在 Istio Ingress Gateway 处终止 TLS 流量并将其转发到相应的服务。还设置了 mTls 和 ISTIO_MUTUAL。我需要验证在集群中调用我们的 Ingress-Gateway 时发送的客户端证书,并且我计划在需要将整个证书转发到我的服务代码的代码中进行验证。

我尝试如下配置 EnvoyFilter:

apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
  name: xfcc-forward
  namespace: xfcc
spec:
  workloadSelector:
    labels:
      istio: ingressgateway
  configPatches:
  - applyTo: HTTP_FILTER
    match:
      context: GATEWAY
      listener:
        filterChain:
          sni: "*"
    patch:
      operation: MERGE
      value:
        set_current_client_cert_details:
            cert: true

申请时失败,我想可能是因为我没有正确配置它。有人可以帮助我为我的场景正确配置 EF。

标签: istioenvoyproxy

解决方案


我想我得到了使用这个的配置:

apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
  name: xfcc-forward
  namespace: xfcc
spec:
  configPatches:
  - applyTo: NETWORK_FILTER
    match:
      context: GATEWAY
      listener:
        filterChain:
          filter:
            name: "envoy.http_connection_manager"
    patch:
      operation: MERGE
      value:
        typed_config:
          "@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager"
          forward_client_cert_details: ALWAYS_FORWARD_ONLY
          set_current_client_cert_details:
            subject: true
            cert: true
            chain: true

我可以看到带有证书值的 XFCC 标头,但证书是 Citadel 为 mTls 传递的证书,而不是客户端在标头中发送的证书,我仍在查看。


推荐阅读