[英]Powershell - Add SSL binding using shared certificate
I am using following code to link certificate to SSL binding that I have added 我使用以下代码将证书链接到我添加的SSL绑定
$thumb = (Get-ChildItem cert:\LocalMachine\My | where-object { $_.Subject -like $wildCardSubject } | Select-Object -First 1).Thumbprint
Push-Location IIS:\SslBindings
Get-Item cert:\LocalMachine\My\$thumb | New-Item $ipAddress!$port
Pop-Location
This works fine without any errors. 这很好,没有任何错误。 After running this, if I open bindings UI for that website from IIS manager I do not see any certificate attached to the binding. 运行此操作后,如果我从IIS管理器打开该网站的绑定UI,我看不到任何附加到绑定的证书。 Am I missing anything here? 我在这里错过了什么吗?
On a similar topic, if I am using a shared certificate between two websites, what care do I need to take in order to ensure that adding/removing ssl bindings work? 在类似的主题上,如果我在两个网站之间使用共享证书,我需要注意什么才能确保添加/删除ssl绑定有效? I can see following problems where doing this from IIS Manager UI 我可以从IIS管理器UI中看到以下问题
Get-Item expects String Value of Thumbprint. Get-Item需要Thumbprint的String值。 Hope this helps. 希望这可以帮助。
$Cert = dir cert:\localmachine\my | Where-Object {$_.Subject -like $CertSubject }
$Thumb = $Cert.Thumbprint.ToString()
Push-Location IIS:\SslBindings
New-WebBinding -Name $WebSiteName -IP $IP -Port 443 -Protocol https
Get-Item cert:\LocalMachine\MY\$strThumb | new-item $IP!443
Pop-Location
For the Other two Question, HTTPS Binding is IP+SSLCertificate. 对于其他两个问题,HTTPS绑定是IP + SSLCertificate。 So if you want to use Shared Certificate try and use Unique IP for each Binding, doing so will not give you any Warning. 因此,如果您想使用共享证书,请尝试为每个绑定使用唯一IP,这样做不会给您任何警告。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.