我们使用 SSL 检查器来调试我们的证书安装。我们已经使用 SSL 证书相当长一段时间了,没有任何问题,直到一两周前。
只有部分请求会因缺少中间证书而引发 SSL 验证错误。我已经重新导出了证书文件 (.pfx),并确保也导出了证书路径/链(如 this answer 中所述),但错误仍然发生。我已与DigiCert Util确认中间证书包含在 .pfx 文件中。
浏览器访问网站和验证 SSL 证书没有任何问题,但编程连接只是有时会失败,SSL 检查实用程序也是如此。
例如,运行这段Python:
for i in range(0, 20):
requests.get('https://........com')
导致随机数量的成功请求和失败的请求,但出现以下异常:
requests.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)
Azure Web App 作为 1 个标准小型实例运行。
我开始认为服务器没有为所有请求返回正确的证书,但这些失败的请求不会显示在任何服务器日志中。我希望有人能帮我解决这个问题!
[更新] 我收集了成功和失败请求的 Wireshark 捕获。您可以清楚地看到,有时其中一张证书会丢失。这很奇怪,因为我只将一个证书上传到 Azure。请参见下图。我希望它有助于解决这个问题。
这是我们的 Azure 证书设置,它清楚地显示只有 1 个证书可供 IIS 返回:
最佳答案
最终发现 Azure 内部状态不佳。解释如下:
The problem was that the certificates configuration for two of our frontends had gotten in a bad state. Because of that the frontends were not serving the intermediate certificates. That's why it worked for majority of requests but failed for few. Also it worked for browsers because browsers have a backup mechanism for obtaining intermediate certificates if they are not included on the response from web server.
In the next update to our service we will include a check and auto-correction logic to prevent and fix this problem if it still occurs on frontends.
关于azure - 为什么此 Azure 网站“仅有时”无法显示中间 SSL 证书?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31702830/