【问题标题】:SSL certificate conditional check using chef使用 Chef 的 SSL 证书条件检查
【发布时间】:2017-03-14 18:56:20
【问题描述】:

我正在编写一个厨师代码,该代码使用 pfx 文件将证书导入个人存储,并在 IIS 中添加 https 绑定并添加 ssl 证书。我的代码成功了,代码如下所示。

但是我想在运行这些步骤之前进行条件检查,即如果 ssl 证书已经在 IIS 上的 https 绑定上可用,我不想运行以下任何脚本。

您能帮我看看“IF”语句的第一行如何查看 SSL 是否已安装吗?

# Import certificates to local machine personal store
windows_certificate 'cert.pfx' do  
    pfx_password    '@password'  
end

#Setup a HTTPS port on IIS
iis_site 'Default Web Site' do  
  action :config  
  bindings 'http/*:80:,https/*:443:'  
end

#Add the certificate to the IIS 
windows_certificate_binding 'ssl certificate name' do  
  address '0.0.0.0'  
end

【问题讨论】:

    标签: ruby ssl iis chef-infra


    【解决方案1】:

    你想要的是使用通知:

    # Import certificates to local machine personal store
    windows_certificate 'cert.pfx' do  
        pfx_password    '@password'
        notifies :config, 'iis_site[Default Web Site]'
    end
    
    #Setup a HTTPS port on IIS
    iis_site 'Default Web Site' do  
      action :nothing  
      bindings 'http/*:80:,https/*:443:'  
    end
    

    或者类似的东西。当且仅当它被“更新”时,每个资源都会发送配置的通知操作(更新意味着不同资源的不同事物)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-03
      • 2016-11-13
      • 1970-01-01
      • 1970-01-01
      • 2014-06-23
      • 2020-01-10
      相关资源
      最近更新 更多