DSC Https Pull服务器-发送请求时发生错误

时间:2018-08-11 08:19:16

标签: powershell dsc

我一直在努力使用DSC Pull Server配置两个星期。我没有使用 ConfigurationId 方法或使用 ConfigurationNames 配置 http / https拉取服务器都没有成功

Smb Pull服务器是唯一适用于我的服务器配置,但我渴望使用https。

我排除了我在powershell.org帖子,文档和论坛中读到的一些常见错误:

        
  • 启用了远程检查功能
  •     
  • 避免使用自签名的证书。(我使用IIS管理控制台和Root CA证书来颁发适当的服务器证书)
  •     
  • 检查 Windows管理框架 [(WFM)版本的节点服务器不兼容] [1]
  •     在Server 2012上安装了
  • 正在检查 .net Framework 4.5.2 或更高版本,以使[WMF 5.1正常工作] [2]。
  •     
  • 验证Web服务或使用[Verify-DSCPullServer函数] [3]或在浏览器中粘贴URL https:// [pullserver]:8080 / PSDSCPullServer.svc,然后检查是否没有SSL警告和证书有效

以下是我的服务器和节点的机器配置:

服务器2012 + WMF 5.1

Name Value
—- —–
PSVersion 5.1.14409.1012
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14409.1012
CLRVersion 4.0.30319.36440
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

客户端Windows 10 Pro 1709

Name Value
—- —–
PSVersion 5.1.16299.547
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.16299.547
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

配置ID方法

        
  1. 服务器配置

    我正在使用xPSDesiredConfiguration 8.4.0.0和xDscWebService资源以这种方式配置服务器

        
        configuration HTTPSPullServer
        {
    
            param
            (
                [string[]]$NodeName = 'localhost',
    
                [ValidateNotNullOrEmpty()]
                [string] $certificateThumbPrint
            )
    
            # Modules must exist on target pull server
            Import-DSCResource -ModuleName xPSDesiredStateConfiguration
    
            Node $NodeName
            {
                WindowsFeature DSCServiceFeature
                {
                    Ensure = "Present"
                    Name   = "DSC-Service"
                }
    
                #IIS Console
                WindowsFeature IISConsole {
                    Ensure = "Present"
                    Name   = "Web-Mgmt-Console"
                }
    
                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"
                    UseSecurityBestPractices = $true
                }
            }
        }
    
        HTTPSPullServer -NodeName vmdt01 -certificateThumbPrint '712FCD316ED524F785186DD144DD445A47CB66A5' -OutputPath E:\DSC\HTTPS\
    
        Start-DscConfiguration -ComputerName vmdt01 -Path E:\DSC\HTTPS -Verbose -Wait -Force
        
    (我曾尝试在 UseSecurityBestPractices DisableSecurityBestPractices 属性上尝试不同的组合,但均未成功)
  2.     
  3. 客户端LCM配置(使用ConfigurationId方法)  
    
        [DSCLocalConfigurationManager()]
        Configuration PullW10ClientsConfigId 
        {
           param
            (
                    [Parameter(Mandatory=$true)]
                    [string[]]$ComputerName,
    
                    [Parameter(Mandatory=$true)]
                    [string]$guid
            )
    
            Node $ComputerName {
    
                Settings {
    
                    RefreshMode = 'Pull'
                        RefreshFrequencyMins = 30
                                ConfigurationMode = 'ApplyAndAutoCorrect'
                                RebootNodeIfNeeded = $true
                    ConfigurationID = $guid
                }
    
                    ConfigurationRepositoryWeb DSCHTTPS {
                        ServerURL = 'https://vmdt01.dggh.es:8080/PSDSCPullServer.svc'
                        CertificateID = '712FCD316ED524F785186DD144DD445A47CB66A5'
                    }
    
                    ReportServerWeb ReportServer {
                        ServerURL = 'https://vmdt01.dggh.es:8080/PSDSCPullServer.svc'
                        CertificateID = '712FCD316ED524F785186DD144DD445A47CB66A5'
                        AllowUnsecureConnection = $True
    
                    }
    
            }
        }
    
  4.     
  5. 重命名MOF文件以匹配configurationId并应用
    `New-DSCChecsum`
  6.     
  7. 当我尝试去做
    `Update-StartDscConfiguration -Computer vcontab1-w10 -Wait -Verbose`
    我在事件查看器上遇到以下错误并进行堆栈跟踪: 特拉巴霍{B3C00709-9C7A-11E8-ACE3-000C2991FEC5}: WebDownloadManager的Comando Do-DscAction配置文件e2665f67-3a61-4989-9870-616a065298d6,结果为lalamada GET: + FullyQualifiedErrorId:WebDownloadManagerGetActionFailed + CategoryInfo:InvalidResult:(:) [],InvalidOperationException + ExceptionMessage:没有服务提供者的https://vmdt01.dggh.es:8080/PSDSCPullServer.svc/Action(ConfigurationId='e2665f67-3a61-4989-9870-616a065298d6')/GetAction。 + InnerException:System.AggregateException:由于产品错误而导致的产品错误。 ---> System.Net.Http.HttpRequestException:征求错误。 ---> System.Net.WebException:终止条件:错误inesperado deenvío。 ---> System.IO.IOException:否传输文件,请按照以下说明进行操作:。 ---> System.Net.Sockets.SocketException:主机重命名存在的问题 zh-cn System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult) zh-cn System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult) ---国际金融时报》 --- zh-cn System.Net.TlsStream.EndWrite(IAsyncResult asyncResult) zh-cn System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar) ---国际金融时报》 --- zh-cn System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult,TransportContext和上下文) zh-cn System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar) ---国际金融时报》 --- ---国际金融时报》 --- zh-cn System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification) zh-cn Microsoft.PowerShell.DesiredStateConfiguration.Commands.GetDscActionCommand.IssueRequest(IHttpClient客户端,String子链接,String&responseStatus,ErrorRecord&errorRecord) --->(内部编号0)System.Net.Http.HttpRequestException:引发错误。 ---> System.Net.WebException:发生错误:错误inesperado deenvío。 ---> System.IO.IOException:否传输文件,请确保没有传输主机:存储主机名。 ---> System.Net.Sockets.SocketException:主机存在的问题 zh-cn System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult) zh-cn System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult) ---国际金融时报》 --- zh-cn System.Net.TlsStream.EndWrite(IAsyncResult asyncResult) zh-cn System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar) ---国际金融时报》 --- zh-cn System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult,TransportContext和上下文) zh-cn System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar) ---国际金融时报》 --- <--- 英文错误是:      System.Net.Http.HttpRequestException:发送请求时发生错误     System.Net.WebException:基础连接已关闭:意外错误     System.IO.IOException:无法将数据写入传输连接:远程主机强制中断现有连接

虽然我使用配置名称方法,但在节点注册期间却更早收到错误消息。

配置名称方法

        
  1. 服务器配置     
        configuration HTTPSPullServer
        {
            param
            (
                [string[]]$NodeName = 'localhost',
    
                [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
            )
    
            # Modules must exist on target pull server
            Import-DSCResource -ModuleName xPSDesiredStateConfiguration
    
            Node $NodeName
            {
                WindowsFeature DSCServiceFeature
                {
                    Ensure = "Present"
                    Name   = "DSC-Service"
                }
    
                #Consola de IIS
                WindowsFeature IISConsole {
                    Ensure = "Present"
                    Name   = "Web-Mgmt-Console"
                    DependsOn = '[File]RegistrationKeyFile'
                }
    
                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"
                    RegistrationKeyPath      = "$env:PROGRAMFILES\WindowsPowerShell\DscService"
                    State                   = "Started"
                    DependsOn               = "[WindowsFeature]DSCServiceFeature"
                    UseSecurityBestPractices = $true          
                }
    
                File RegistrationKeyFile
                {
                    Ensure          = 'Present'
                    Type            = 'File'
                    DestinationPath = "$env:ProgramFiles\WindowsPowerShell\DscService\RegistrationKeys.txt"
                    Contents        = $RegistrationKey
                }
            }
        }
    
        # Generate MOF
        HTTPSPullServer -NodeName vmdt01 -certificateThumbPrint '9F00EDBDFB791C7AAD9200E9E0BA8FD59684B419' -RegistrationKey 'e2665f67-3a61-4989-9870-616a065298d6' -OutputPath E:\DSC\HTTPS\
    
        Start-DscConfiguration -ComputerName vmdt01 -Path E:\DSC\HTTPS -Verbose -Wait -Force
  2.     
  3. 客户端LCM(配置名称方法)     
        [DSCLocalConfigurationManager()]
        Configuration PullW10ClientsConfigNames 
        {
           param
            (
                [ValidateNotNullOrEmpty()]
                [string] $NodeName = 'localhost',
    
                [ValidateNotNullOrEmpty()]
                [string] $RegistrationKey #same as the one used to setup pull server in previous configuration
    
            )
            Node $NodeName {
    
                Settings {
    
                    RefreshMode = 'Pull'
                        RefreshFrequencyMins = 30
                                ConfigurationMode = 'ApplyAndAutoCorrect'
                                RebootNodeIfNeeded = $true
                }
    
                    ConfigurationRepositoryWeb DSCHTTPS {
                        ServerURL = 'https://vmdt01.dggh.es:8080/PSDSCPullServer.svc'
                        RegistrationKey = $RegistrationKey
                        ConfigurationNames = @('w10client')
                        AllowUnsecureConnection = $false
                    }
    
                    ReportServerWeb ReportServer {
                        ServerURL = 'https://vmdt01.dggh.es:8080/PSDSCPullServer.svc'
                        CertificateID = '712FCD316ED524F785186DD144DD445A47CB66A5'
                        AllowUnsecureConnection = $false
                    }
            }
        }
    
        # Create the Computer.Meta.Mof in folder
        PullW10ClientsConfigNames -NodeName vcontab1-w10 -RegistrationKey 'e2665f67-3a61-4989-9870-616a065298d6' -OutputPath E:\DSC\HTTPS
    
        Set-DscLocalConfigurationManager -ComputerName vcontab1-w10 -Path E:\DSC\HTTPS -Verbose
    此时,我收到一条错误消息,提示无法在服务器上注册具有特定AgentId的DSC代理。 这是事件日志引发与ConfigurationId方法相同的错误 Trabajo {0EE9AD70-9C80-11E8-ACE3-000C2991FEC5}: 客户端HTTP 3A1CC07C-9BC1-11E8-ACE3-000C2991FEC5没有伪装的Dsc代理: + FullyQualifiedErrorId:RegisterDscAgentCommandFailed + CategoryInfo:InvalidResult:(:) [],InvalidOperationException + ExceptionMessage:没有代理代理的虚拟伪注册器ID 3A1CC07C-9BC1-11E8-ACE3-000C2991FEC5代理服务器https://vmdt01.dggh.es:8080/PSDSCPullServer.svc/Nodes(AgentId='3A1CC07C -9BC1-11E8-ACE3-000C2991FEC5')。 + InnerException:System.AggregateException:由于产品错误而导致的产品错误。 ---> System.Net.Http.HttpRequestException:引发错误。 ---> System.Net.WebException:发生错误:错误inesperado deenvío。 ---> System.IO.IOException:否传输文件,请确保没有传输主机:存储主机名。 ---> System.Net.Sockets.SocketException:主机远程访问存在的问题 zh-cn System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult) zh-cn System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult) ---国际金融时报》 --- zh-cn System.Net.TlsStream.EndWrite(IAsyncResult asyncResult) zh-cn System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar) ---国际金融时报》 --- zh-cn System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult,TransportContext和上下文) zh-cn System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar) ---国际金融时报》 --- ---国际金融时报》 --- zh-cn System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification) zh-cn Microsoft.PowerShell.DesiredStateConfiguration.Commands.RegisterDscAgentCommand.IssueRequest(DotNetHttpClient客户端,字符串子链接,ErrorRecord&errorRecord) --->(内部编号0)System.Net.Http.HttpRequestException:引发错误。 ---> System.Net.WebException:发生错误:错误inesperado deenvío。 ---> System.IO.IOException:否传输文件,请确保没有传输主机:存储主机名。 ---> System.Net.Sockets.SocketException:主机存在的问题 zh-cn System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult) zh-cn System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult) ---国际金融时报》 --- zh-cn System.Net.TlsStream.EndWrite(IAsyncResult asyncResult) zh-cn System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar) ---国际金融时报》 --- zh-cn System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult,TransportContext和上下文) zh-cn System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar) ---国际金融时报》 --- <---

有人可以告诉我这可能是怎么回事吗? 安全协议有问题吗?可能与Server 2012 OS有关,后者是第一个支持DSC的版本?非常感谢您的帮助。

建议我使用 Wireshark 检查是否是 TLS版本问题。我不能保证或否认它必须与TLS一起使用,但是可以肯定的是,这是一个安全问题。嗅探对节点注册请求的响应,有这样的消息:

  

MIME多部分媒体封装,类型:多部分/加密,   边界:“加密边界”多部分解剖器无法   解密邮件

我认为不必使用TLS,因为我通过修改相应的registry settings在客户端中启用了TLS 1.0和1.2。

0 个答案:

没有答案