【问题标题】:Binding SSL certificate by name using command line使用命令行按名称绑定 SSL 证书
【发布时间】:2015-05-15 09:56:49
【问题描述】:

尝试使用 InnoSetup 为我的网站自动设置 IIS,包括设置 SSL 证书。

我已经成功地使用 SelfSSL 创建了自签名 SSL 证书,到目前为止一切正常,除了我不确定如何自动将 SSL 证书(使用 SelfSSL 创建)绑定到我的网站的最后一个过程.

参考上图,如何使用命令行告诉 IIS 将 SSL 证书(在本例中名为“Testing”)绑定到我的网站?

P/S:这里还有一个类似的问题: How to assign a SSL Certificate to IIS7 Site from Command Prompt

但这需要运行命令的人事先获得 certhash

【问题讨论】:

    标签: iis-7 ssl-certificate


    【解决方案1】:

    好的,所以我刚刚找到了使用 Powershell 的解决方案。

    这是检索 certash 的 powershell 脚本:

    $hostname = 'example.com';
    $certhash = dir cert:localmachine\my | where {$_.Subject -eq "CN=$($hostname)"} | select -first 1 | select-object -ExpandProperty Thumbprint

    有了 certash 信息,我们现在可以继续使用 netsh 命令将 sslcert 绑定到我们的站点:

    netsh http add sslcert ipport=0.0.0.0:443 certhash=$certhash appid="{00112233-4455-6677-8899-AABBCCDDEEFF}"

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-12-27
      • 1970-01-01
      • 2013-10-07
      • 2023-01-18
      • 1970-01-01
      • 2019-10-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多