- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有一个 WMF5 下的 Windows 2012R2 DSC Pull 服务器和一个 WMF5.1 下的 Windows 2008R2 客户端。由于需要访问网络资源,凭据由 Pull 服务器编码到 MOF 中,并使用驻留在 Cert:\LocalMachine\My
中的证书进行加密基于 https://msdn.microsoft.com/en-us/powershell/dsc/securemof key 是使用以下方法创建的:
New-SelfsignedCertificateEx `
-Subject "CN=${ENV:ComputerName}.${ENV:UserDnsDomain}" `
-EKU 'Document Encryption' `
-KeyUsage 'KeyEncipherment, DataEncipherment' `
-SAN ${ENV:ComputerName}.${ENV:UserDnsDomain} `
-FriendlyName 'DSC Credential Encryption certificate' `
-Exportable `
-StoreLocation 'LocalMachine' `
-StoreName 'My' `
-KeyLength 2048 `
-ProviderName 'Microsoft Enhanced Cryptographic Provider v1.0' `
-AlgorithmName 'RSA' `
-SignatureAlgorithm 'SHA256' `
-NotBefore $effDate `
-NotAfter $expiryDate
我已导出此证书,并将其导入到客户端计算机中,也在 Cert:\LocalMachine\My 中使用此命令
certutil -addstore My C:\DSC\DscPublicKey.cer
两台机器都可以通过以下代码找到证书(以交互式管理员用户运行)
$Cert = Get-ChildItem -Path cert:\LocalMachine\My | Where-Object {
(
($_.Issuer -eq $IssuerCN) -and ($_.Subject -eq $IssuerCN)
)
}
Write-Host " Thumbprint : " $Cert.Thumbprint
我可以在 Pull 服务器上的 MOF 中看到加密的凭据。加密似乎按预期工作。
在客户端,MOF 处理日志显示了一个 MSFT_DSCMetaConfiguration 实例,该实例具有用于加密的匹配 CertificateID,并且 LCM 已使用拉取正确证书的函数进行了初始化。
function Get-LocalEncryptionCertificateThumbprint
{
(dir Cert:\LocalMachine\my) | %{
# Verify the certificate is for Encryption and valid
If (($_.Issuer -eq $encryCertCN ) -and ($_.Subject -eq $encryCertCN ) )
{
return $_.Thumbprint
}
}
}
但是,Get-DSCConfigurationStatus 显示失败状态。当我查看日志时,我看到了错误
Status = "Failure";
Error = "The private key could not be acquired.";
我所有的管道阶段最终都从 InDesiredState = False; 切换到 InDesiredState = True;(我假设 DSC 这样做是为了避免永久尝试做一些它没有希望实现的事情)。
此时我唯一的想法是客户端的证书不在 SYSTEM 用户可以访问的位置 - 但我无法确定这是原因。
如果 Cert:\LocalMachine\My 位置不正确 - 证书应该安装在哪里?
编辑:
证书在 PULL 服务器上创建,.CER 文件导出并手动导入到目标节点(目前 - 最终将在 AD 中处理)。我还尝试导出完整的 PFX 并将其导入目标节点,结果相同。
在这一点上,我怀疑生成的证书是自签名的,不足以达到目的...
最佳答案
基于一些假设,您正在 Pull 服务器上创建证书,包括公钥和私钥。然后只在目标节点上导入公钥(.cer
文件)。问题是 Pull Server 不是需要私钥的机器。目标节点需要私钥。该过程应该更像这样。
这被认为是一种不好的做法,但如果您想拥有一个证书,该过程将如下所示:
Export-PfxCertificate
导出完整证书关于ssl - DSC - 客户端错误 - 无法获取私钥,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42033834/
我正在探索 DSC 并想知道将 DSC 资源复制到目标主机的最佳方法是什么? 当我尝试将我的配置推送到目标主机时,它提示缺少 DSC 资源。 The PowerShell DSC resource x
我有一个为 Web 服务器配置创建的 DSC。我的网站将使用 HTTPS,这意味着我必须在商店中获得证书。我没有看到任何旨在执行此操作的模块,所以我想知道如何在 DSC 中运行常规 Powershel
这两种通过 PowerShell 的 Desired State Configuration 配置虚拟机的方法有何优缺点? 我听说 Azure Automation DSC 的初始学习曲线更陡峭,但从
我正在尝试将 VM 载入 Azure Automation DSC。我们可以添加来自不同订阅的虚拟机作为 DSC 节点吗? 最佳答案 您将无法使用 Register-AzureRMAutomation
以下 DSC 声明写入注册表项 HKEY_USERS.DEFAULT\Console 而不是 HKEY_CURRENT_USER\Console。为什么? Registry ConsoleFaceNa
有人知道如何获取当前 DSC 工作文件夹吗? 在服务器上,当 DSC 运行时,它会生成如下文件夹结构: C:\Packages\Plugins\Microsoft.Powershell.DSC\2.1
我正在尝试使用此基本模板 http://4c74356b41.com/post5775 使用 SQL Server 2016 AlwaysOn 可用性组创建 Azure RM 模板我链接的模板对我来说
我正在尝试使用此基本模板 http://4c74356b41.com/post5775 使用 SQL Server 2016 AlwaysOn 可用性组创建 Azure RM 模板我链接的模板对我来说
我正在尝试通过 DSC 配置目标节点。 我创建了一个带有虚拟配置的 .ps1 文件;你可以在下面看到它;这只是您在 DSC 站点中找到的首批示例之一。 现在我想把它编译成 .mof 文件。 我已经执行
我已成功创建 DSC 配置并将它们部署到服务器上。作为下一步,我尝试将服务器中常见的配置 block 的部分分解为可重用的部分,或者用 DSC 的说法“复合资源”。经过大量研究后,我仍然无法使用复合资
我正在使用 PowerShell 4.0 并配置了 DSC Pull Server。很少有客户端连接到 Pull Server,并且这些客户端正在正确获取配置。以下是客户端计算机中的 LCM 详细信息
是否可以从互联网上下载一些软件,然后使用 DSC 在我的一些服务器上安装它? Chrome ,例如?所有 DSC 教程都很难理解(至少对我而言)。我只想看一个简单的例子,类似于我的用例。 最佳答案 您
我正在尝试使用PowerShell DSC将我们的软件部署到客户端PC。在我所见过的大多数DSC教程或示例中,DSC似乎都用于部署服务器软件。 在客户端 PC上使用DSC是否有意义? 注意事项: 我已
这似乎无法正常工作 我有以下脚本资源。 Script RDGatewayCreateRAP { SetScript = { $
我有一个安装 nodejs 的 DSC 配置,将 npm 添加到环境路径变量,然后安装一个 npm 模块。 xPackage InstallNodeJs { Name = 'N
我正在尝试在 PowerShell 中使用 DSC 来部署服务。根据Microsoft Documentation ,服务资源有以下可以设置的属性: 姓名 确保 内置帐户 凭据 取决于 参数 启动类型
我的 LocalConfigurationManager 设置如下: [DSCLocalConfigurationManager()] Configuration LCMConfig { No
我尝试先卸载某个软件包,然后安装该软件包的最新版本。您可能会认为很简单,但是当我在 DSC 配置中包含以下代码时: ### remove old product setup Packa
我在存档 DSC 模块 (MSFT_ArchiveResource.psm1) 中发现了一个错误。复制代码、在 ISE 中调试并找出需要修复的两行后,我想对真实文件进行更改并使用 Puppet 和 m
我有一个 DSC 资源,它安装 dotnet 功能,然后安装 dotnet 更新。 在本地配置管理器中,我设置了 RebootNodeIfNeeded至$true . dotnet 安装后,它不会请求
我是一名优秀的程序员,十分优秀!