我正在使用 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 指定的登录会话不存在。它可能已经被终止。
我做了一些研究,看起来我导入的证书不可导出,需要授予私钥访问权限,参考来自: 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?提前致谢。