API 管理 (APIM) 是一种为现有后端服务创建一致且现代化的 API 网关的方法。

问题描述

在设置了APIM客户端证书,用户保护后端API,让请求更安全。 但是,最近发现使用客户端证书的API全部出现错误,无法收到客户端证书,通过浏览器中查看,发现证书也是无效的。

在API请求的Trace中,错误消息为:

            {
"source": "client-certificate-handler",
"timestamp": "2021-07-13T12:23:51.8172847Z",
"elapsed": "00:00:00.00053",
"data": "Requesting client certificate because next handler requires access to it."
}, {
"source": "client-certificate-handler",
"timestamp": "2021-07-13T12:23:51.8172847Z",
"elapsed": "00:00:00.00048",
"data": "No client certificate received."
}

在浏览器中查看证书发现无效:

问题验证

根据消息提示,第一反应检查APIM的客户端证书是否有效,是否过期

第二步当证书并无异常(没有过期)时,则调查APIM是否有变动,通过配置的Git存储库(APIM Repository), Clone最新的文件后发现版本有变动。发现前后有版本变动()

第三步:从APIM的证书设置入手,发现有新功能 ”协商客户端证书(Negotiate client certificate)“ 功能,在通过启用它之后,APIM的"No client certificate received" 问题消失

问题原因

因为在设置APIM时候,有一句提示消息为:”若要在开发人员层、基本层、标准层或高级层中通过 HTTP/2 接收和验证客户端证书,必须在“自定义域”边栏选项卡上启用“协商客户端证书”设置“” 。也就是说:如果不使用HTTP/2则不用启用"协商客户端证书"设置。这也是为什么在最初设置时,没有启用该功能的原因。

但是现在验证了问题的关键就是APIM升级后,必须启用"协商客户端证书", 通过对APIM的版本改动所发布的Release Notification(新版通知)看,是因为:

附录一:使用APIM Repository获取当前APIM中的所有文件,包含根目录的configuration.json文件

第一步:在APIM中启用Repository

第二步:通过 git clone https://username:password@{name}.scm.azure-api.cn/  下载APIM所有文件到本地

详细操作步骤:https://docs.azure.cn/zh-cn/api-management/api-management-configuration-repository-git#to-clone-the-repository-to-your-local-machine

第三步:查看configuration.json文件 IntegrationModuleBitsVersion 信息

{
"settings": {
"RegistrationEnabled": "True",
"UserRegistrationTerms": null,
"UserRegistrationTermsEnabled": "False",
"UserRegistrationTermsConsentRequired": "False",
"DelegationEnabled": "False",
"DelegationUrl": "",
"DelegatedSubscriptionEnabled": "False"
},
"$ref-policy": "api-management/policies/global.xml",
"IntegrationModuleVersion": "17",
"IntegrationModuleBitsVersion": "0.20.1220.0",
"ExportDate": "2021-06-09T22:08:15.530921Z"
}

参考文档

将存储库克隆到本地计算机:https://docs.azure.cn/zh-cn/api-management/api-management-configuration-repository-git#to-clone-the-repository-to-your-local-machine

如何使用 API 管理中的客户端证书身份验证确保 API 安全:https://docs.azure.cn/zh-cn/api-management/api-management-howto-mutual-certificates-for-clients

APIM Release:https://github.com/Azure/API-Management/releases/tag/release-service-2021-05

A regular Azure API Management service update was started on May 5, 2021, and included the following new features, bug fixes, and other improvements. It may take several weeks for your API Management service to receive the update.

Featured

  1. Open-source API Portal is now generally available.
  2. Azure API Management's support for Availability Zones is now generally available.
  3. Request and response validation policies are now generally available.

New

  1. You can now validate the client certificate with the new <validate-client-certificate> policy. Documentation and support in the Azure portal are coming soon.
  2. The Visual Studio Code extension now supports policy debugging for self-hosted gateways running locally.
  3. The Visual Studio Code extension now supports Dapr and validation policies.
  4. The developer portal now supports resource owner password grant flow.
  5. The new Ciphers + Protocols page in the Azure portal lets you manage API gateways' cipher and protocol configuration and displays a warning if a weak cipher or protocol is enabled.
  6. The Locations page in the Azure portal lets you now configure Availability Zones.
  7. You can now apply validation policies with the visual policy editors in the Azure portal, without writing any policy code.
  8. The timeout attribute of the send-request policy now supports policy expressions.

Fixed

  1. Caching issues, which might have resulted in a broken developer portal's administrative interface, are now resolved.

Changed

  1. The client certificate renegotiation feature is now disabled for all new and existing API Management services, except for the services that relied on it in the last 30 days (services with at least one API call that resulted in a client certificate request from a policy, not as part of an initial TLS handshake). The API gateway will request a client certificate only if HostnameConfiguration's property negotiateClientCertificate is set to true. If the property is set to false, the client certificate won't be available in the context.Request.Certificate property.

【END】

【Azure API 管理】在APIM中使用客户端证书验证API的请求,但是一直提示错误"No client certificate received."的更多相关文章

  1. 【Azure API 管理】APIM 配置Validate-JWT策略,验证RS256非对称(公钥/私钥)加密的Token

    问题描述 在APIM中配置对传入的Token进行预验证,确保传入后端被保护的API的Authorization信息正确有效,可以使用validate-jwt策略.validate-jwt 策略强制要求 ...

  2. 【Azure API 管理】APIM CORS策略设置后,跨域请求成功和失败的Header对比实验

    在文章"从微信小程序访问APIM出现200空响应的问题中发现CORS的属性[terminate-unmatched-request]功能"中分析了CORS返回空200的问题后,进一 ...

  3. 【Azure API 管理】APIM集成内网虚拟网络后,启用自定义路由管理外出流量经过防火墙(Firewall),遇见APIs加载不出来问题

    问题描述 使用 Azure 虚拟网络,Azure APIM 可以管理无法通过 Internet 访问的 API,达到以保护企业内部的后端API的目的.在虚拟网络中,启用网络安全组(NSG:Networ ...

  4. ASP.NET Core的身份认证框架IdentityServer4(7)- 使用客户端证书控制API访问

    前言 今天(2017-9-8,写于9.8,今天才发布)一口气连续把最后几篇IdentityServer4相关理论全部翻译完了,终于可以进入写代码的过程了,比较累.目前官方的文档和Demo以及一些相关组 ...

  5. node.js – 服务器端的客户端证书验证,DEPTH_ZERO_SELF_SIGNED_CERT错误

    我正在使用节点0.10.26并尝试建立与客户端验证的https连接. 服务器代码: var https = require('https'); var fs = require('fs'); proc ...

  6. Asp.Net Web API 2第三课——.NET客户端调用Web API

    详情请查看http://aehyok.com/Blog/Detail/70.html 个人网站地址:aehyok.com QQ 技术群号:206058845,验证码为:aehyok 本文文章链接:ht ...

  7. SVN 错误:Error validating server certificate for 'https://xxxxxxx':443... Mac os svn客户端证书验证缓存 解决

    mac上的SVN今天突然间 不好使了 在进行SVN操作是报出警告信息 Error validating server certificate for 'https://xxxxxxx':443 - T ...

  8. 详解 UWP (通用 Windows 平台) 中的两种 HttpClient API

    UWP (通用 Windows 平台) 应用开发者在构建通过 HTTP 与 Web 服务或服务器断点交互的应用时,有多种 API 可以选择.要在一个托管 UWP 应用中实现 HTTP 客户端角色,最常 ...

  9. API 管理在云原生场景下的机遇与挑战

    作者 | 张添翼 来源 | 尔达Erda公众号 ​ 云原生下的机遇和挑战 标准和生态的意义 自从 Kubernetes v1.0 于 2015 年 7 月 21 日发布,CNCF 组织随后建立以来,其 ...

随机推荐

  1. 基于Android平台的图书管理系统的制作(2)

    上一篇讲解了制作图书管理系统的初衷与要求,和app首页的代码. 下面来介绍图书管理系统的服务对象:学生 学生类的设计: 个人信息:账号.密码.姓名.学号.邮箱.年龄. 借阅信息:借阅总数(不超过十本) ...

  2. Docker 版 3分钟部署 .net core 开源在线客服系统,他来了

    我在博客园发表了一系列文章,开始介绍基于 .net core 的在线客服系统开发过程. 前些天又应朋友的要求,发了一篇 CentOS 版本的安装部署教程:https://www.cnblogs.com ...

  3. TensorFlow入门实操课程第一章教程笔记

    神经元网络深度学习的起步程序 Hello World 第一个应用程序总是应该从超级简单的东西开始,这样可以看到代码如何产生和运作的整体框架. 就创建神经网络而言,我喜欢使用的例子是一个能够学习两组数字 ...

  4. 学习响应式编程 Reactor (4) - reactor 转换类操作符(1)

    Reactor 操作符 数据在响应式流中的处理,就像流过一条装配流水线.Reactor 既是传送带,又是一个个的装配工或机器人.原材料从源头(最初的 Publisher )流出,经过一个个的装配线中装 ...

  5. JAVA微服务应用(1)--SpringBoot中的REST API调用(学习笔记)

    好长时间没有写学习小结了,最近宁正好看了小马哥的微服务系列之<Spring Boot>系列,颇有收获,并且公司也布置一个课题就是关于Spring中的REST API调用.于是乎回归本行,再 ...

  6. 【NLP学习其二】什么是隐马尔可夫模型HMM?

    概念 隐马尔可夫模型描述的是两个时序序列联合分布p(x,y)的概率模型,其中包含了两个序列: x序列外界可见(外界指的是观测者),称为观测序列(obsevation seuence) y序列外界不可见 ...

  7. C#异步迭代 IAsyncEnumerable 应用

    最近用WPF做金税盘开发中有这样一个需求,批量开票每次开票都需要连接一次金税盘. 比如我有发票 a, b ,c ,d e 这五张发票,每次开具发票都需要调用金税盘底层,才能正常开票. 首先,尝试写第一 ...

  8. 9、make和make install的区别

    简单来说,make 是编译,make install 是安装. 9.1.configure: 这一步一般用来生成 Makefile,为下一步的编译做准备,你可以通过在 configure 后加上参数来 ...

  9. 4、saltstack的使用

    官方文档地址:http://repo.saltstack.com/#rhel 4.1.saltstatck介绍: 用户要一致,这里使用的是root用户: 用于批量管理成百上千的服务器: 并行的分发,使 ...

  10. Oracle数据库——Mybatis在一个update标签下执行多更新语句

    begin update table table1 set com1 ='1' ; update table table2 set com1 ='1' ; end;