本文介绍部署传输层安全性(TLS)检查策略时的常见故障排除方案。
证书问题:无法获取本地颁发者证书
发生此错误的原因是,默认情况下,Git 和 Python 等开发人员工具不使用作系统的证书存储。 相反,它们维护自己的证书存储,并且不识别 TLS 检查证书。
Git 故障排除
您可以将 Git 配置为使用 Windows 的证书存储:
git config --global http.sslbackend schannel
或者,可以将自定义 TLS 检查根证书追加到 Git 的证书颁发机构捆绑包,以便 Git 信任内部证书颁发机构。
$certPath = "./myTLSInspectionRootCA.crt"
$gitCAPath = git config --get http.sslcainfo
if ($gitCAPath) {
Get-Content $certPath | Add-Content -Path $gitCAPath
Write-Host "Certificate appended to Git CA bundle"
} else {
Write-Host "Git CA bundle path not found"
}
Python 故障排除
基于 Python 的工具(如 Azure CLI)在没有正确的证书颁发机构的情况下失败。 可以安装 pip-system-certs ,以便 Python 信任 Windows 证书存储:
Azure CLI
"C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe" -m pip install pip-system-certs
系统 Python
python -m pip install pip-system-certs
或者,可以将自定义 TLS 检查根证书追加到 Python 的 CA 捆绑包,以便 Python 信任内部证书颁发机构。
$certPath = "./myTLSInspectionRootCA.crt"
$pythonCertPath = python -c "import certifi; print(certifi.where())"
Get-Content $certPath | Add-Content -Path $pythonCertPath
Write-Host "Certificate appended to Python's CA bundle"
Docker 故障排除
如果 TLS 检查证书不受信任,Docker 容器可能会失败 TLS 连接。 通过将以下命令添加到 Dockerfile,将证书添加到 Docker 的受信任证书列表:
基于 Debian 或 Ubuntu 的映像
COPY myTLSInspectionRootCA.crt /usr/local/share/ca-certificates/
RUN update-ca-certificates
基于 Alpine 的图像
COPY myTLSInspectionRootCA.crt /usr/local/share/ca-certificates/
RUN apk update && apk add ca-certificates && update-ca-certificates
应用程序在移动平台上不起作用
启用 TLS 检查时,移动应用程序可能会失败,因为证书固定会限制应用程序仅信任特定证书。
故障排除步骤
创建 TLS 绕过规则以从 TLS 检查中排除应用程序的目标 FQDN。 有关详细步骤,请参阅 配置传输层安全检查策略。
内部证书已存在
对于使用旧版 TLS 配置的预览版客户,在创建证书签名请求(CSR)时,可能会看到此错误: Cannot create external certificate, an internal certificate already exists for tenant.
故障排除步骤
若要解决此问题,请执行下列操作:
- 以全局安全访问管理员身份使用自定义 TLS 检查设置登录到 Microsoft Entra 管理中心。
- 浏览到 全局安全访问>设置>会话管理。
- 选择 “TLS 检查 ”选项卡。
- 选择并删除证书 URL。
- 选择“保存”。