gpt4 book ai didi

ssl - ServiceFabric 独立 : Failed to get private key file

转载 作者:太空宇宙 更新时间:2023-11-03 12:52:16 27 4
gpt4 key购买 nike

我有一个独立的 ServiceFabric 集群(3 个节点)。我为服务器和客户端授权创建了 SSL 证书。然后我将证书指纹分配给集群配置。一切正常(集群运行状况良好,我的应用程序也正常运行。但是 Microsoft-ServiceFabric/Admin 日志中有很多错误。以下警告和错误每分钟都会写入日志:

  • CryptAcquireCertificatePrivateKey 失败。错误:0x80090014
  • 无法获取证书的私钥文件名。错误:0x80090014
  • 所有获取私钥文件名的尝试都失败了。
  • 未能获得证书的私钥。指纹:{证书指纹}。错误:E_FAIL
  • 无法获取私钥文件。 x509FindValue:{证书指纹},x509StoreName:我的,findType:FindByThumbprint,错误 E_FAIL
  • SetCertificateAcls 失败。错误代码:E_FAIL 无法访问控制列表
  • FabricNode/ServerAuthX509FindValue,错误代码 E_FAIL

我为 NETWORK SERVICE 和 SYSTEM 分配了对私钥存储的写入许可。我还为 PK 存储分配了 gMSA 帐户。但是错误仍然出现在日志中。另一方面,一切看起来都很好,集群启动并运行......这是我的集群配置(安全部分):

“安全”:{
"ServerCredentialType":"X509", "ClusterCredentialType":"Windows", "WindowsIdentities":{
"ClustergMSAIdentity":"gMSAccountName@domain.com", “ClusterSPN”:“http/servicefabric” }, “证书信息”:{
“服务器证书”:{ “指纹”:“{证书指纹}”, "X509StoreName": "我的" }, “ClientCertificateThumbprints”:[
{
"CertificateThumbprint":"{证书指纹}", “是管理员”:真 } ], "X509StoreName": "我的" } },

对于 x509 认证创建,我使用 OpenSSL 1.0.2k-fips 2017 年 1 月 26 日。我按照本文中的步骤操作:https://gist.github.com/harishanchu/e82d759c0235379d1778f799992b5774谁能澄清这个问题?

最佳答案

MachineKeys 文件夹中似乎没有私钥文件。要验证文件夹中是否有物理文件,请运行此 powershell 命令:

$certThumb = "1D6523F622E33DF46382D081BCA9AE9A2D8D78CC"

Try
{
$WorkingCert = Get-ChildItem CERT:\LocalMachine\My |where {$_.Thumbprint -match $certThumb} | sort $_.NotAfter -Descending | select -first 1 -erroraction STOP
$TPrint = $WorkingCert.Thumbprint
$rsaFile = $WorkingCert.PrivateKey.CspKeyContainerInfo.UniqueKeyContainerName
}
Catch
{
"Error: unable to locate certificate for $($CertCN)"
Exit
}

if ($WorkingCert.PrivateKey) {
$WorkingCert.PrivateKey
}
else
{
"No private key found"
}

如果您收到 No private key found 消息,则表示 MachineKeys 文件夹中没有私钥。即使证书属性可以以其他方式声明(有一个 key 图标和消息您有一个与此证书相对应的私钥)。虽然我不知道为什么,但对于某些证书,上述情况会发生。

作为解决方法,请按照以下步骤操作:

  1. 转到本地机器证书存储并删除您的证书。
  2. 首先将您的证书导入本地用户存储
  3. 然后将您的证书导入本地机器商店。
  4. Network Service 用户设置访问权限。

如果您按照上述步骤操作,私钥将添加到 MachineKeys 文件夹中,错误将消失。显然,您必须为每个集群节点重复这些步骤。

关于ssl - ServiceFabric 独立 : Failed to get private key file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51134492/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com