Azure APIM:将客户端证书发送到后端进行身份验证

Azure APIM: sending client certificate to backend for authentication

我们有一个 APIM,它根据不同的策略将请求转发到不同的后端服务器。我想将对后端服务器的请求限制为仅来自该 APIM(而不是其他实体)。手头的两个选择是:

  1. IP 过滤 backend-servers 仅接受来自 APIM IP 地址的请求 - 不想走这条路,因为 APIM IP 地址可能会更改,而且更新列表很麻烦。
  2. client-certificate 身份验证机制 - APIM 将发送一个证书,然后可以由 backend-server 验证。

一直想不明白的是APIM是怎么发送证书的?证书是在 HTTP header 中发送的,还是在 HTTP 下面的 TLS 层中发送的?

问这个是因为:我正在寻找一种方法不强制后端服务器进行 APIM 证书身份验证;即 APIM 应该发送证书,但不同的 backend-server 如何处理它取决于他们(他们可以选择验证客户端证书或只允许请求而不进行验证)。为此,我的理解是最好从 APIM 发送 client-certificate 作为自定义 header 的一部分。如果authentication-certificate policy in APIM sends the certificate in the TLS layer, then its not necessary that the certificate will reach the backend server's application logic. For instance, in the case where the backend is a Azure app web service, then the TLS termination happens at a frontend load balancer which then forwards the certificate to the app code in a custom header X-ARR-ClientCert。由于我正在处理不同类型的 backend-servers(不仅是 Azure App Service),因此在自定义 header 中发送证书(这将在相同的 header 中发送到 app-code =] 无论后端服务器类型如何)更有意义。

对这种方法有什么想法吗?如果我对 APIM 中 client-certificate 的工作方式的理解有误?

不知道这个回答对你有没有帮助。几个月前我做了一些调查。据我了解,入站和出站 客户端证书 是在 TLS 级别处理的,并且只有 Azure 中的一些原语,例如Front DoorApplication GatewayApp Service 可以将客户端证书从 TLS 级别转换为 HTTP header 由后端处理。由于此解决方案 不够通用 对于我的情况,并且一个第 3 方后端无论如何都是有限的,我设计了 server-to-server 证书。