【问题标题】:Chef Issue bootstrapping windows VM using winrm over https using self signed certificateChef 使用自签名证书在 https 上使用 winrm 引导 Windows VM
【发布时间】:2015-01-28 06:32:33
【问题描述】:

主厨服务器(RHEL 6.5):11.16.4

Windows 端点:Windows 2008

引导在 http (with winrm config allowUnEncrypeted = true and basic auth = true) 上运行良好。

现在我们在 https(but with basic auth = false and AllowUnEncrypted = false) 上尝试同样的事情

已生成自签名证书(使用私钥),并且我已通过端口 443 验证了 telnet。

为了检查连接,我从终端(Windows 7)运行了以下命令,

winrs -r:https://<fqdn Of windows EP>:443 -u:administrator -p:password_1 ipconfig

在受信任的根证书颁发机构下添加自签名证书后工作正常。

从主厨服务器引导时出错:

  [root@v-ng25-rhel6u5-tpm722 ~]# knife bootstrap windows winrm v-ngibm71tpm7222k8.example.co.in -x Administrator -P 'password_1' -p 443 --bootstrap-version '11.16.4-1'

Waiting for remote response before bootstrap.at depth 0 - 18: self signed certificate
..at depth 0 - 18: self signed certificate
..at depth 0 - 18: self signed certificate
..at depth 0 - 18: self signed certificate
..at depth 0 - 18: self signed certificate
..at depth 0 - 18: self signed certificate
..at depth 0 - 18: self signed certificate
..at depth 0 - 18: self signed certificate
..at depth 0 - 18: self signed certificate


ERROR: No response received from remote node after 1.84 minutes, giving up.
ERROR: OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

理想情况下,如果 winrs 命令有效(意味着自签名证书生成和侦听器配置没有问题),那么应该这样。

非常感谢任何帮助/指针。


更新:

  1. 在创建侦听器时注意删除指纹中的空格

  2. knife ssl check 能够验证证书

  3. 在链接 [link]https://github.com/gswallow/knife-windows/commit/d04c835cfff1260017b91a799168e90b931cad6a 尝试--no-ssl-peer-verification 选项

  4. env var SSL_CERT_FILE 指向包含远程机器证书的/opt/chef-server/embedded/ssl/certs/cacert.pem

  5. 尝试了一个临时建议,将证书添加到 /opt/opscode/embedded/jre/jre/lib/security/cacerts 的密钥库

问题仍然存在。


更新:

这是有效的,

编辑文件

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/knife-windows-0.8.0/lib/chef/knife/bootstrap_windows_winrm.rb

并添加行,

winrm.config[:no_ssl_peer_verification] = true

编辑文件

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/knife-windows-0.8.0/lib/chef/knife/winrm.rb

并添加行,

session_opts[:no_ssl_peer_verification] = true if config.has_key?(:no_ssl_peer_verification)

它仍然给出自签名错误,但至少它引导

输出:

Waiting for remote response before bootstrap.at depth 0 - 18: self signed certificate at depth 0 - 18: self signed certificate tpm72-win2K8R2.example.com . tpm72-win2K8R2.example.com Response received. Remote node responded after 0.0 minutes. Bootstrapping Chef on tpm72-win2K8R2.example.com at depth 0 - 18: self signed certificate at depth 0 - 18: self signed certificate tpm72-win2K8R2.example.com "Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-22620-1423038641.bat" chunk 1" at depth 0 - 18: self signed certificate at depth 0 - 18: self signed certificate tpm72-win2K8R2.example.com "Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-22620-1423038641.bat" chunk 2"

【问题讨论】:

  • 我最后想到的办法,尝试使用与http相同的参数的https(看看它是否只是证书问题或添加到证书警告的身份验证问题)
  • @Tensibai 错误保持与 http (winrm config allowUnEncrypeted = true and basic auth = true) 相同的参数。我会试试这个看看它是否有帮助[链接]gagravarr.org/writing/openssl-certs/…
  • 刚刚查看了您的一个链接(第 3 个)似乎 CA 证书文件有一个配置选项:winrm.config[:ca_trust_file] = Chef::Config[:knife][:ca_trust_file] if Chef::Config[:knife][:ca_trust_file] 所以您可以尝试将 knife[:ca_trust_file] = "/opt/chef-server/embedded/ssl/certs/cacert.pem" 添加到您的 Knife.rb 文件中。
  • @Tensibai 更新了解决方法。似乎绕过了错误。
  • 感谢您的更新,它可能会帮助其他人:)

标签: windows chef-infra bootstrapping winrm


【解决方案1】:

Knife 命令使用 openssl 库,它不知道您的 Windows 证书存储,但使用它自己的。

您必须将远程机器证书添加到&lt;path to chef install&gt;\embedded\ssl\certs\cacert.pem中的ruby堆栈的cacert.pem文件中)

您可能还需要添加一个名为 SSL_CERT_FILE 的环境变量来指向该文件以供其他工具使用。

【讨论】:

  • 感谢您的建议。 SSL_CERT_FILE 设置为 /opt/chef-server/embedded/ssl/certs/cacert.pem 我已经尝试将远程机器证书添加到 cacert.pem 的 2 个位置 /opt/chef/embedded/ssl/certs/cacert.pem /opt/chef-server/embedded/ssl/certs/cacert.pem 并且只是为了没有任何歧义,通过添加我的意思是我将远程机器证书的内容复制到两个位置的 cacert.pem 文件的末尾。远程机器证书内容的形式为“-----BEGIN CERTIFICATE-----等等-----END CERTIFICATE-----”
  • @Ivan 不确定您的评论结果,您还有 SSL 错误吗? (快速链接到带有域认证示例的文档:docs.chef.io/plugin_knife_windows.html
  • 是的,错误仍然存​​在。在创建侦听器时,我已经删除了您粘贴的链接中提到的空格,并且端口也是正确的(从 windows 机器触发的 winrs 成功结果可以看出)。刀 ssl 检查的输出是肯定的(在使用刀 ssl fetch 将其添加到trusted_certs 之后)。如果我可以验证其他任何内容,请告诉我。
  • @Ivan 我真的认为基本身份验证无法从 linux 机器中绕过,如果可以的话,我会看看代码。同时,您可以尝试从您的工作站引导(在其上配置刀等)
  • 很少有试验更新我在引导程序中尝试了 --node-ssl-verify-mode 选项(只是为了检查),却发现它不适合刀引导程序 windows winrm 尝试了一个临时建议添加证书到 /opt/opscode/embedded/jre/jre/lib/security/cacerts 的密钥库尝试了链接 [link]github.com/gswallow/knife-windows/commit/… 中提到的选项
猜你喜欢
  • 2021-12-23
  • 2020-06-16
  • 2012-12-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-08-16
  • 1970-01-01
相关资源
最近更新 更多