ChefDK - 在提供域凭据时,WinRM切换到基本身份验证。

时间:2015-01-02 21:01:39

标签: ruby chef winrm chefdk

我在Windows 7 64bit上使用ChefDK 0.3.5。我在尝试使用Chef和WinRM来执行时遇到了一些问题 远程服务器上的chef-client命令。我发出的命令如下:

C:\U\user1> knife winrm "fqdn:testserver.*" "netstat" -x 'domain\user1' -P 'password'
WARNING: Switching to Negotiate authentication, Basic does not support Domain Authentication
ERROR: RuntimeError: Error: Unencrypted communication not supported. Please check winrm configuration winrm/config/service AllowUnencrypted flag.

我得到的结果并没有让我做我想做的事。所以我用Google搜索,然后看到了 关于不验证SSL或使用:verify_peer的事情,它什么也没做 同样。所以我在Command中再次执行了WinRM配置命令 提示,因为PowerShell告诉我他们错了。

C:\Users\user1>C:\WIndows\System32\cmd.exe /c winrm set winrm/config/winrs @{MaxMemoryPerShellMB="300"}
Winrs
    AllowRemoteShellAccess = true
    IdleTimeout = 7200000
    MaxConcurrentUsers = 10
    MaxShellRunTime = 2147483647
    MaxProcessesPerShell = 25
    MaxMemoryPerShellMB = 300
    MaxShellsPerUser = 30


C:\Users\user1>C:\WIndows\System32\cmd.exe /c winrm set winrm/config @{MaxTimeoutms="1800000"}
Config
    MaxEnvelopeSizekb = 500
    MaxTimeoutms = 1800000
    MaxBatchItems = 32000
    MaxProviderRequests = 4294967295
    Client
        NetworkDelayms = 5000
        URLPrefix = wsman
        AllowUnencrypted = false
        Auth
            Basic = true
            Digest = true
            Kerberos = true
            Negotiate = true
            Certificate = true
            CredSSP = false
        DefaultPorts
            HTTP = 5985
            HTTPS = 5986
        TrustedHosts
    Service
        RootSDDL = O:NSG:BAD:P(A;;GA;;;BA)(A;;GR;;;IU)S:P(AU;FA;GA;;;WD)(AU;SA;G
XGW;;;WD)
        MaxConcurrentOperations = 4294967295
        MaxConcurrentOperationsPerUser = 1500
        EnumerationTimeoutms = 240000
        MaxConnections = 300
        MaxPacketRetrievalTimeSeconds = 120
        AllowUnencrypted = true
        Auth
            Basic = false
            Kerberos = true
            Negotiate = true
            Certificate = false
            CredSSP = false
            CbtHardeningLevel = Relaxed
        DefaultPorts
            HTTP = 5985
            HTTPS = 5986
        IPv4Filter = *
        IPv6Filter = *
        EnableCompatibilityHttpListener = false
        EnableCompatibilityHttpsListener = false
        CertificateThumbprint
        AllowRemoteAccess = true
    Winrs
        AllowRemoteShellAccess = true
        IdleTimeout = 7200000
        MaxConcurrentUsers = 10
        MaxShellRunTime = 2147483647
        MaxProcessesPerShell = 25
        MaxMemoryPerShellMB = 300
        MaxShellsPerUser = 30


C:\Users\user1>C:\WIndows\System32\cmd.exe /c winrm set winrm/config/service@{AllowUnencrypted="true"}
Service 
  RootSDDL = O:NSG:BAD:P(A;;GA;;;BA)(A;;GR;;;IU)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;
;;WD)
    MaxConcurrentOperations = 4294967295
    MaxConcurrentOperationsPerUser = 1500
    EnumerationTimeoutms = 240000
    MaxConnections = 300
    MaxPacketRetrievalTimeSeconds = 120
    AllowUnencrypted = true
    Auth
        Basic = false
        Kerberos = true
        Negotiate = true
        Certificate = false
        CredSSP = false
        CbtHardeningLevel = Relaxed
    DefaultPorts
        HTTP = 5985
        HTTPS = 5986
    IPv4Filter = *
    IPv6Filter = *
    EnableCompatibilityHttpListener = false
    EnableCompatibilityHttpsListener = false
    CertificateThumbprint
    AllowRemoteAccess = true

执行这些命令后,我再试一次,ChefDK像我一样看着我 笨。我不确定为什么Chef会尝试使用基本的auth然后我给它 域凭据。这也在以前工作,但我必须得到一个新的 电脑和我的笔记,安装都丢失了。有没有任何想法 我可能会失踪什么?如果我错过任何信息,请告诉我,我会更新我的问题。

1 个答案:

答案 0 :(得分:0)

客户端命令告诉您:

Unencrypted communication not supported. Please check winrm configuration winrm/config/service AllowUnencrypted flag.

从超时命令的结果中打印出来的配置会告诉您:

Config
    MaxEnvelopeSizekb = 500
    MaxTimeoutms = 1800000
    MaxBatchItems = 32000
    MaxProviderRequests = 4294967295
    Client
        NetworkDelayms = 5000
        URLPrefix = wsman
        AllowUnencrypted = false

您需要通过运行命令将AllowUnencrypted标志设置为true:

winrm set winrm/config/service @{AllowUnencrypted="true"}

最新的github版本的刀形窗口添加了用于创建ssl证书和加强连接的命令,当你准备好时,你希望这样做。