Fix HTTPS certs on VSTS (#1123)
This commit is contained in:
parent
652c529f8f
commit
d99d2d881c
|
|
@ -3,12 +3,8 @@ phases:
|
||||||
parameters:
|
parameters:
|
||||||
agentOs: Windows
|
agentOs: Windows
|
||||||
beforeBuild:
|
beforeBuild:
|
||||||
- powershell: "git submodule update --init"
|
- powershell: "& ./tools/UpdateIISExpressCertificate.ps1; & ./tools/update_schema.ps1; Restart-Service w3svc"
|
||||||
displayName: Update submodules
|
displayName: Prepare repo
|
||||||
- powershell: "& ./tools/update_schema.ps1"
|
|
||||||
displayName: Update ANCM schema
|
|
||||||
- powershell: Restart-Service w3svc
|
|
||||||
displayName: Restart IIS
|
|
||||||
|
|
||||||
- template: .vsts-pipelines/templates/phases/default-build.yml@buildtools
|
- template: .vsts-pipelines/templates/phases/default-build.yml@buildtools
|
||||||
parameters:
|
parameters:
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
// So these tests always have to use ports in this range, and we can't rely on OS-allocated ports without a whole lot of ceremony around
|
// So these tests always have to use ports in this range, and we can't rely on OS-allocated ports without a whole lot of ceremony around
|
||||||
// creating self-signed certificates and registering SSL bindings with HTTP.sys
|
// creating self-signed certificates and registering SSL bindings with HTTP.sys
|
||||||
// Test specific to IISExpress
|
// Test specific to IISExpress
|
||||||
[SkipInVSTS]
|
|
||||||
public class HttpsTest : IISFunctionalTestBase
|
public class HttpsTest : IISFunctionalTestBase
|
||||||
{
|
{
|
||||||
public HttpsTest(ITestOutputHelper output) : base(output)
|
public HttpsTest(ITestOutputHelper output) : base(output)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
$cert = New-SelfSignedCertificate -DnsName "localhost", "localhost" -CertStoreLocation "cert:\LocalMachine\My" -NotAfter (Get-Date).AddYears(5)
|
||||||
|
$thumb = $cert.GetCertHashString()
|
||||||
|
|
||||||
|
$Store = New-Object -TypeName System.Security.Cryptography.X509Certificates.X509Store -ArgumentList 'root', 'LocalMachine'
|
||||||
|
$Store.Open([System.Security.Cryptography.X509Certificates.OpenFlags]::ReadWrite)
|
||||||
|
$Store.Add($cert)
|
||||||
|
$Store.Close()
|
||||||
|
|
||||||
|
$tempFile = [System.IO.Path]::GetTempFileName();
|
||||||
|
$content = "";
|
||||||
|
|
||||||
|
for ($i=44300; $i -le 44399; $i++) {
|
||||||
|
$content += "http delete sslcert ipport=0.0.0.0:$i`n";
|
||||||
|
$content += "http add sslcert ipport=0.0.0.0:$i certhash=$thumb appid=`{214124cd-d05b-4309-9af9-9caa44b2b74a`}`n";
|
||||||
|
}
|
||||||
|
|
||||||
|
[IO.File]::WriteAllLines($tempFile, $content)
|
||||||
|
|
||||||
|
netsh -f $tempFile
|
||||||
|
Remove-Item $tempFile;
|
||||||
Loading…
Reference in New Issue