2016-10-03 80 views
0

想法是自动将SSL证书链接到IIS 7或更高版本的网站。在使用主机头的IIS网站上设置现有的SSL证书

服务器中的所有网站使用相同的IP地址和相同的默认端口。所以它们都通过主机标题名称来区分。

我可以实现这个手动没有任何问题。但是,自动化存在问题。

手动完成后,http.sys中的ssl配置条目记录为HostNameport TestName:443,而不是ipport xx.yy.z.a:443。

所以我想模仿自动化工作的相同手动步骤。但这并没有帮助。

我尝试了下面的步骤。

  1. 使用下面的命令在http.sys中为主机名端口组合创建一个新的ssl配置。

的netsh - %HTTP添加的sslcert hostnameport = Testssl:443 CERTHASH = d70930bb790f89c04c728d9285b64f5fb0258fc7的appid = {01010101-0101-0101-0101-010101010101} certstorename = MY

  • 使用hostheader名称为网站创建新的Web绑定。

    新-ItemProperty IIS:\网站\测试网站-name绑定 - 值@ {协议= “HTTPS”; bindingInformation = “192.168.1.108:443:Testssl”}

    新WebBinding -Name测试网站 - 协议HTTPS - 端口443 -HostHeader Testssl -IPAddress 192.168.1.108

  • 通过以上两个步骤的新的绑定存在,但SSL证书没有附加到绑定。

    是否可以使用http.sys ssl配置中的对应主机名端口条目为绑定设置SSL证书?

    +0

    1. SNI不上IIS 7/7.5工作。 2. SNI绑定需要设置SNI标志。 –

    +0

    谢谢。 我一直在尝试使用WebConfiguration属性的版本高于7.5的Windows 10和Windows 2012 R2,并且它无法使用它。 我试着用SNI标志的值为1. 执行时我得不到输出。但也没有变化。 **使用的命令:** Add-WebConfigurationProperty -pspath'MACHINE/WEBROOT/APPHOST'-filter“系统。applicationHost/sites/site [@ name ='Test']/bindings/binding [@ protocol ='https'and @ bindingInformation ='192.168.1.108:80:testssl']“-name”bindingInformation“-value”192.168.1.108 :443:testssl“ –

    +0

    Add-WebConfigurationProperty -pspath'MACHINE/WEBROOT/APPHOST'-filter”system.applicationHost/sites/site [@ name ='Test']/bindings/binding [@ protocol ='https'and @bindingInformation ='192.168.1.108:443:testssl']“-name”sslFlags“-value 1 –

    回答

    0

    在Lex Li的评论帮助下,下面的命令WORKS。

    新-WebBinding -Name测试网站-Protocol HTTPS - 端口443 -HostHeader Testssl -IPAddress 192.168.1.108 -SslFlags 1