将 self-signed 根证书添加到 Azure 应用服务

Adding self-signed root certificate to Azure App Service

我有一个基于 Azure 的 .NET Web 应用程序,我们正在尝试将其连接到客户端的本地 ADFS 环境。我们能够通过 Azure 混合连接访问资源,但是当我们尝试从 ADFS 获得身份验证 header 时,我们收到证书错误。

经过一些挖掘,我们发现他们没有使用来自受信任的根 CA 的证书,而是使用 self-signed 证书。客户已向我们发送了他们的根 CA(连同中间证书)并要求我们让我们的 Azure 应用程序信任这些证书。

1) 这可能吗?

2) 这样做有安全隐患吗?

我找到了这篇关于向您的应用程序服务添加证书的文档,但我认为这不会 'trust' 任何由其根 CA 证书签名的证书,而是仅信任该证书本身。 https://docs.microsoft.com/en-us/azure/app-service/app-service-web-ssl-cert-load

我也发现了这个问题,它是从 2015 年开始的,很好奇这个答案是否从那时起发生了变化。

当前尝试连接到他们的 ADFS 时出现的实际错误:

System.Net Information: 0 : [13800] SecureChannel#55196503 - Remote certificate has errors:

System.Net Information: 0 : [13800] SecureChannel#55196503 - A certificate chain could not be built to a trusted root authority.

System.Net Information: 0 : [13800] SecureChannel#55196503 - Remote certificate was verified as invalid by the user.

System.Net Error: 0 : [13800] Exception in HttpWebRequest#44115416:: - The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel..

不,仍然不能使用自签名证书。由于安全风险,要求没有改变。

引用自 MS 文档,以下是您的 SSL 证书的要求:

要在应用服务中使用证书,证书必须满足以下所有要求:

  • 由受信任的证书颁发机构签名
  • 导出为受密码保护的 PFX 文件
  • 包含至少 2048 位长的私钥
  • 包含证书链中的所有中间证书

查看来自 this June 2018 guide

的更多内容