在过去的几天里,我一直在尝试创建一个开发/测试环境,我可以使用DSC自动部署。
我一直在使用WMF5.1。
使用示例设置了pullserver:Sample_xDscWebServiceRegistrationWithSecurityBestPractices
来自xPSDesiredStateConfiguration 5.1.0.0。
configuration Sample_xDscWebServiceRegistrationWithSecurityBestPractices
{
param
(
[string[]]$NodeName = 'CORE-O-DSCPull.CORE.local',
[ValidateNotNullOrEmpty()]
[string] $certificateThumbPrint,
[Parameter(HelpMessage='This should be a string with enough entropy (randomness) to protect the registration of clients to the pull server. We will use new GUID by default.')]
[ValidateNotNullOrEmpty()]
[string] $RegistrationKey # A guid that clients use to initiate conversation with pull server
)
Import-DSCResource -ModuleName xPSDesiredStateConfiguration -ModuleVersion '5.1.0.0'
Node $NodeName
{
WindowsFeature DSCServiceFeature
{
Ensure = "Present"
Name = "DSC-Service"
}
xDscWebService PSDSCPullServer
{
Ensure = "Present"
EndpointName = "PSDSCPullServer"
Port = 8080
PhysicalPath = "$env:SystemDrive\inetpub\wwwroot\PSDSCPullServer"
CertificateThumbPrint = $certificateThumbPrint
ModulePath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules"
ConfigurationPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration"
State = "Started"
DependsOn = "[WindowsFeature]DSCServiceFeature"
RegistrationKeyPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService"
AcceptSelfSignedCertificates = $true
UseSecurityBestPractices = $true
}
File RegistrationKeyFile
{
Ensure = 'Present'
Type = 'File'
DestinationPath = "$env:ProgramFiles\WindowsPowerShell\DscService\RegistrationKeys.txt"
Contents = $RegistrationKey
}
}
}
我将MOF
文件应用到我的拉服务器而没有任何问题。我使用相同的示例创建了一个元MOF
:
[DSCLocalConfigurationManager()]
configuration Sample_MetaConfigurationToRegisterWithSecurePullServer
{
param
(
[ValidateNotNullOrEmpty()]
[string] $NodeName = 'CORE-O-DSCPull.CORE.local',
[ValidateNotNullOrEmpty()]
[string] $RegistrationKey, #same as the one used to setup pull server in previous configuration
[ValidateNotNullOrEmpty()]
[string] $ServerName = 'CORE-O-DSCPull.CORE.local' #node name of the pull server, same as $NodeName used in previous configuration
)
Node $NodeName
{
Settings
{
RefreshMode = 'Pull'
}
ConfigurationRepositoryWeb CORE-O_PullSrv
{
ServerURL = "https://$ServerName`:8080/PSDSCPullServer.svc" # notice it is https
RegistrationKey = $RegistrationKey
ConfigurationNames = @('Basic')
}
}
}
我将LCM设置应用到我的pull-server而没有任何问题。 我可以创建一个简单的basic.mof并使用DSC来应用它。这一切都很好。
接下来,我为另一个节点创建另一个meta.mof文件,让它注册到我的pull-server。除了nodename
之外,我使用与上面相同的配置,我将其更改为其他节点的名称。我使用命令:
Set-DscLocalConfigurationManager -ComputerName <nodename> -path <pathtonewmetamof>
此命令正常工作。然后,该机器可以使用DSC同时应用相同的basic.mof
。
问题出现了: 我重新启动我的pull服务器和节点,创建一个新的basic.mof并尝试将其应用于我的两台机器。这个过程在pull服务器本身上工作正常,但是我的节点不能再应用basic.mof了,因为它将不再向我的pull-server注册。我已经复制了很多次,我将从头开始安装两台机器并配置它们。每次重新启动机器时,注册都会停止工作。请参阅以下错误:
Registration of the Dsc Agent with the server https://CORE-O-DSCPull.CORE.local:8080/PSDSCPullServer.svc failed. The underlying error is: Failed to register Dsc
Agent with AgentId 1FE837AA-C774-11E6-80B5-9830B2A0FAC0 with the server
https://core-o-dscpull.core.local:8080/PSDSCPullServer.svc/Nodes(AgentId='1FE837AA-C774-11E6- 80B5-9830B2A0FAC0'). .
+ CategoryInfo : InvalidResult: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : RegisterDscAgentCommandFailed,Microsoft.PowerShell.DesiredStateConfiguration.Commands.RegisterDscAgentCommand
+ PSComputerName : CORE-O-DC.CORE.local
所以,我的问题是注册似乎工作正常,直到我重新启动拉服务器。有谁知道什么会导致这个问题?
答案 0 :(得分:1)
对于那些想知道我是否设法解决这个问题的人,是的,我做到了。 它似乎是WMF5.0中的一个错误,我只在pullserver上使用WMF5.1。不在节点上。所以我必须更新它,现在它正在工作。
答案 1 :(得分:1)
如本blog entry中所述,低级问题是WMF 5.0使用TLS 1.0与服务器进行通信,而WFM 5.1不再支持TLS 1.0。
在上述条目中,您将找到两种解决方案:一种意味着在每个节点中升级WMF,另一种则意味着通过修改服务器中的寄存器来允许不太安全的连接。