Windows Chef添加ssl证书并绑定到IIS

问题描述 投票:0回答:2

我正在使用Windows Chef食谱https://supermarket.chef.io/cookbooks/windows/versions/5.0.0#readme

创建和绑定ssl。

首先我尝试过:

# Create/update certificate
windows_certificate "create cert" do
    source "c://hn/ssl/cert.pfx"
    pfx_password  {cert_pass}
    store_name "WEBHOSTING"
    action :create
end

# Bind certificate
windows_certificate_binding "bind to IIS" do
    action :create
    cert_name "{my_ssl_hash_number}"
    name_kind :hash
    port 443
    store_name "WEBHOSTING"
end

而且我遇到以下错误:

STDOUT:SSL证书添加失败,错误:指定的1312 A登录会话不存在。它可能已经被终止。

并且我做了一些研究,看来我导入的证书不可导出,需要授予私钥访问权限,请参考:SSL Certificate add failed when binding to port

下面是我的第二次尝试:

# Create/update certificate
windows_certificate "create cert" do
    source "c://hn/ssl/cert.pfx"
    pfx_password  {cert_pass}
    store_name "WEBHOSTING"
    private_key_acl ["IIS_IUSRS"]
    action [:create, :acl_add]
end 

# Bind certificate
windows_certificate_binding "bind to IIS" do
    action :create
    cert_name "{my_ssl_hash_number}"
    name_kind :hash
    port 443
    store_name "WEBHOSTING"
end

但是,我仍然出现错误:

STDOUT:STDERR:C:\ Users \ Administrator \ AppData \ Local \ Temp \ chef-script20180823-492-10cuvyo.ps1:不存在私钥。

有人可以帮我吗?如何正确导入SSL并绑定到IIS?预先感谢。

ssl ssl-certificate chef chef-recipe chef-windows
2个回答
0
投票

对我来说,另一种解决方案是使用Powershell脚本添加SSL证书,而不使用Windows食谱


0
投票

这是一个已知问题,在这里看看:https://github.com/chef-cookbooks/windows/issues/580

© www.soinside.com 2019 - 2024. All rights reserved.