Comments (1)
I produced a workaround in my powershell script yesterday. I now understand that the setting of SslFlags clears the binding to the SSL Cert (Hash and StoreName). It looks to me as though the Certifcate cannot be applied at the same time as the binding is created or at the same time as the SslFlags are changed. You can verify this by use of the "Set-WebBinding" cmdlet with -PropertyName SslFlags and -Value 1, i.e. the flags are set, but the hash is clear.
I couldn't work out how to install the certificate using "Import-Certificate" cmdlet - so I've worked out a way to use Install-ACMECertificate safely - the approach is as follows:
- Configure an additional site in IIS specifically to import certificates - mines called "__acme_installer" but the name is unimportant.
- Remove bindings from this site using Get-WebBinding and Remove-WebBinding as appropriate.
- Use "Install-ACMECertificate" to install the certificate to a FixedIP that isn't used elsewhere within IIS. I don't think that the IP has to be bound, but probably should come from a private address range. I'm using "127.0.0.1", but that's because I don't bind sites to localhost on my box.
Note) You will now have the binding on the additional site, but more importantly the certifcate is correctly imported into IIS Server Certifcates. - On your target site (the one that you're actually trying to set up) use New-WebBinding ensuring that you use -SslFlags 1.
- On your target site, use $binding = Get-WebBinding and $binding.AddSslCertificate(hash, "My"). I already have my hash in my script, but you don't have it, you can use Get-ACMECertificate and powershell filtering to get it.
Here are the relevant code fragments from my script:
"Removing existing SSL Bindings"
$bindings = (Get-WebBinding -Name $WebSiteName | where-object {$_.protocol -eq "https"})
if($bindings -ne $null) {
foreach($binding in $bindings) {
"Removing Binding"
$binding
Remove-WebBinding -InputObject $binding
}
}
"Importing Certificate Into IIS"
$binding = (Get-WebBinding -Name "__acme_installer" | where-object {$_.protocol -eq "https"})
if($binding -ne $null) {
Remove-WebBinding -Name "__acme_installer" -Port 443 -Protocol "https" -IPAddress "127.0.0.1"
}
Install-ACMECertificate -VaultProfile _VaultName_ -CertificateRef $certident -Installer iis -InstallerParameters @{
WebSiteRef = "__acme_installer"
BindingAddress = "127.0.0.1"
PortNumber = 443
}
$cert = Get-ACMECertificate -VaultProfile _VaultName_ -Ref $certident
#We install SNI cert on each binding
foreach ($webname in $webaddresslist) {
"Installing an SNI-based certificate $webname"
New-WebBinding -Name $WebSiteName -Protocol "https" -Port $PortNumber -HostHeader $webname -SslFlags 1
$binding = Get-WebBinding -Name $WebSiteName -Protocol "https" -Port $PortNumber -HostHeader $webname
$binding.AddSslCertificate($cert.Thumbprint, "My")
}
from acmesharp.
Related Issues (20)
- TLS 1.0 required? HOT 6
- Retry transient errors
- Is auto renewal possible now? HOT 2
- Update-ACMEIdentifier returns invalid status for ChallengeType http-01 using iis Handler
- Bug in Docs Initialize-ACMESharp should be Initialize-ACMEVault
- Certificate case sensitive
- Class not registered HOT 1
- Using Update-ACMEIdentifier with an ID instead of alias HOT 1
- Problem starting over with renewal HOT 2
- vulnerability check fails
- Complete-ACMEChallenge : unresolved site for given site reference
- Command to query Vault for existing certificates HOT 1
- We need ACME v2 support HOT 6
- Missing ChallangeHandler HOT 1
- Issue with ACME v2 HOT 2
- Upgrade powershell code to ACMEv2 protocol HOT 1
- Possible to use with Kestral? HOT 3
- certifytheWeb is returned with this issue please help HOT 3
- Maintenance State HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from acmesharp.