From ecb7f70df0f1de5da7f9cbe55e3d46071cfbefeb Mon Sep 17 00:00:00 2001 From: "Simon J.K. Pedersen" Date: Wed, 23 Mar 2016 11:11:33 +0100 Subject: [PATCH] Fix for checking challenge files that are served using staging ssl certificates, if redirect to https has been enabled for the acme-challenge directory. --- .../CertificateManager.cs | 24 ++++++++++++------- LetsEncrypt.nuspec | 2 +- LetsEncrypt64.nuspec | 2 +- letsencrypt.siteextension.job.nuspec | 2 +- letsencrypt.siteextension.job64.nuspec | 2 +- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/LetsEncrypt.SiteExtension.Core/CertificateManager.cs b/LetsEncrypt.SiteExtension.Core/CertificateManager.cs index 23308b0..8811a26 100644 --- a/LetsEncrypt.SiteExtension.Core/CertificateManager.cs +++ b/LetsEncrypt.SiteExtension.Core/CertificateManager.cs @@ -534,16 +534,22 @@ public static AuthorizationState Authorize(Target target) var retry = 10; while (true) { - using (var client = new HttpClient()) + using (var handler = new WebRequestHandler()) { - Thread.Sleep(1000); - var x = client.GetAsync(answerUri).Result; - Trace.TraceInformation("Checking status {0}", x.StatusCode); - if (x.StatusCode == HttpStatusCode.OK) - break; - if (retry-- == 0) - break; - Trace.TraceInformation("Retrying {0}", retry); + //Allow self-signed certs otherwise staging wont work + handler.ServerCertificateValidationCallback = (sender, cert, chain, sslPolicyErrors) => true; + + using (var client = new HttpClient(handler)) + { + Thread.Sleep(1000); + var x = client.GetAsync(answerUri).Result; + Trace.TraceInformation("Checking status {0}", x.StatusCode); + if (x.StatusCode == HttpStatusCode.OK) + break; + if (retry-- == 0) + break; + Trace.TraceInformation("Retrying {0}", retry); + } } } Console.WriteLine(" Submitting answer"); diff --git a/LetsEncrypt.nuspec b/LetsEncrypt.nuspec index 9aefb8a..1325be6 100644 --- a/LetsEncrypt.nuspec +++ b/LetsEncrypt.nuspec @@ -3,7 +3,7 @@ letsencrypt Azure Let's Encrypt (x86) - 0.4.10 + 0.4.11 SJKP http://opensource.org/licenses/Apache-2.0 https://github.com/sjkp/letsencrypt-siteextension diff --git a/LetsEncrypt64.nuspec b/LetsEncrypt64.nuspec index 09d8fff..d3d1d0e 100644 --- a/LetsEncrypt64.nuspec +++ b/LetsEncrypt64.nuspec @@ -3,7 +3,7 @@ letsencrypt64 Azure Let's Encrypt (x64) - 0.4.10 + 0.4.11 SJKP http://opensource.org/licenses/Apache-2.0 https://github.com/sjkp/letsencrypt-siteextension diff --git a/letsencrypt.siteextension.job.nuspec b/letsencrypt.siteextension.job.nuspec index 47a6ae6..645f51d 100644 --- a/letsencrypt.siteextension.job.nuspec +++ b/letsencrypt.siteextension.job.nuspec @@ -3,7 +3,7 @@ letsencrypt.siteextension.job Azure SiteExtension Let's Encrypt WebJob - 0.4.10-beta + 0.4.11-beta SJKP http://opensource.org/licenses/Apache-2.0 https://github.com/sjkp/letsencrypt-siteextension diff --git a/letsencrypt.siteextension.job64.nuspec b/letsencrypt.siteextension.job64.nuspec index 4542db4..9d2f1df 100644 --- a/letsencrypt.siteextension.job64.nuspec +++ b/letsencrypt.siteextension.job64.nuspec @@ -3,7 +3,7 @@ letsencrypt.siteextension.job64 Azure SiteExtension Let's Encrypt WebJob (64bit) - 0.4.10-beta + 0.4.11-beta SJKP http://opensource.org/licenses/Apache-2.0 https://github.com/sjkp/letsencrypt-siteextension