Service Fabric 集群节点无法从证书中获取私钥
Service Fabric Cluster nodes can't get private key from certificate
我有一个 5 节点服务结构集群 运行 一个应用程序。我使用自签名证书对我的应用程序设置进行了加密。此证书已上传到 keyvault,我已将此 URL 填入我的应用程序。我可以看到证书正在我的 VM 上安装,并且 运行 Invoke-ServiceFabricDecryptText 也 returns 给我正确的解密值。但是,在查看我的管理控制台时,我看到了这个错误:
Error event: SourceId='System.Hosting', Property='Activation:1.0'.
There was an error during activation.Failed to ACL folders or certificates required by application. Error:0x80090014
查看节点日志,我看到这些条目与上述错误相对应:
2016-9-7 20:09:44.541,Informational,2148,2580,Common.CryptoUtility,GetCertificate(LocalMachine, MY, FindByThumbprint:)
2016-9-7 20:09:44.541,Informational,2148,2580,Common.CryptoUtility,GetCertificate: match found: thumbprint = [thumbprint], expiration = 2017-09-02 16:08:04.000
2016-9-7 20:09:44.541,Error,2148,2580,Common.CryptoUtility,CryptAcquireCertificatePrivateKey failed. Error:0x80090014
2016-9-7 20:09:44.541,Error,2148,2580,Common.SecurityUtility,Failed to get the Certificate's private key. [thumbprint]. Error: 0x80090014
2016-9-7 20:09:44.541,Warning,2148,2580,Hosting.ProcessActivationManager,ACLing private key filename for thumbprint [thumbprint]. ErrorCode=0x80090014
我很茫然
最终成为一个错误的证书。我最初上传到 Keyvault 的是一个使用 New-SelfSignedCertificate in posh 的现有证书。然后,我通过使用带有 -CreateSelfSignedCertificate 开关的 Invoke-AddCertToKeyVault 命令即时将第二个添加到 Key Vault,并且它起作用了。
这通常意味着当前未创建集群证书。因为它的私钥是不可取回的。
如果您使用 ServiceFabricRPHelpers.psm1(Invoke-AddCertToKeyVault 和 -CreateSelfSignedCertificate)创建自签名证书 - 您应该知道它会创建此类无效证书,除非安装了 PSPKI 版本 3.2.5。即使您使用 PSPKI 版本 3.2.6(或未安装 PSPKI),它也会创建无效证书,因为 ServiceFabricRPHelpers.psm1 中存在错误。
我在这里解决了这个问题(但它还没有合并)
https://github.com/ChackDan/Service-Fabric/pull/31
作为解决方法,
1. 从 https://pspki.codeplex.com/releases/view/625365 安装最新的 PSPKI
2. 在 运行 Invoke-AddCertToKeyVault 之前,将此处 https://github.com/ChackDan/Service-Fabric/pull/31 的修复应用到 ServiceFabricRPHelpers.psm1
修复合并后我将更新此线程...
我有一个 5 节点服务结构集群 运行 一个应用程序。我使用自签名证书对我的应用程序设置进行了加密。此证书已上传到 keyvault,我已将此 URL 填入我的应用程序。我可以看到证书正在我的 VM 上安装,并且 运行 Invoke-ServiceFabricDecryptText 也 returns 给我正确的解密值。但是,在查看我的管理控制台时,我看到了这个错误:
Error event: SourceId='System.Hosting', Property='Activation:1.0'.
There was an error during activation.Failed to ACL folders or certificates required by application. Error:0x80090014
查看节点日志,我看到这些条目与上述错误相对应:
2016-9-7 20:09:44.541,Informational,2148,2580,Common.CryptoUtility,GetCertificate(LocalMachine, MY, FindByThumbprint:)
2016-9-7 20:09:44.541,Informational,2148,2580,Common.CryptoUtility,GetCertificate: match found: thumbprint = [thumbprint], expiration = 2017-09-02 16:08:04.000
2016-9-7 20:09:44.541,Error,2148,2580,Common.CryptoUtility,CryptAcquireCertificatePrivateKey failed. Error:0x80090014
2016-9-7 20:09:44.541,Error,2148,2580,Common.SecurityUtility,Failed to get the Certificate's private key. [thumbprint]. Error: 0x80090014
2016-9-7 20:09:44.541,Warning,2148,2580,Hosting.ProcessActivationManager,ACLing private key filename for thumbprint [thumbprint]. ErrorCode=0x80090014
我很茫然
最终成为一个错误的证书。我最初上传到 Keyvault 的是一个使用 New-SelfSignedCertificate in posh 的现有证书。然后,我通过使用带有 -CreateSelfSignedCertificate 开关的 Invoke-AddCertToKeyVault 命令即时将第二个添加到 Key Vault,并且它起作用了。
这通常意味着当前未创建集群证书。因为它的私钥是不可取回的。
如果您使用 ServiceFabricRPHelpers.psm1(Invoke-AddCertToKeyVault 和 -CreateSelfSignedCertificate)创建自签名证书 - 您应该知道它会创建此类无效证书,除非安装了 PSPKI 版本 3.2.5。即使您使用 PSPKI 版本 3.2.6(或未安装 PSPKI),它也会创建无效证书,因为 ServiceFabricRPHelpers.psm1 中存在错误。 我在这里解决了这个问题(但它还没有合并) https://github.com/ChackDan/Service-Fabric/pull/31
作为解决方法, 1. 从 https://pspki.codeplex.com/releases/view/625365 安装最新的 PSPKI 2. 在 运行 Invoke-AddCertToKeyVault 之前,将此处 https://github.com/ChackDan/Service-Fabric/pull/31 的修复应用到 ServiceFabricRPHelpers.psm1
修复合并后我将更新此线程...