Skip to content

Commit

Permalink
#38
Browse files Browse the repository at this point in the history
  • Loading branch information
sjkp committed Mar 22, 2016
1 parent d03041d commit 0a5f68f
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 13 deletions.
21 changes: 12 additions & 9 deletions LetsEncrypt.SiteExtension.Core/CertificateManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using LetsEncrypt.SiteExtension.Models;
using Microsoft.Azure.Management.WebSites;
using Microsoft.Azure.Management.WebSites.Models;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Configuration;
Expand Down Expand Up @@ -447,7 +448,7 @@ public static string Auto(Target binding)
return certificate.Thumbprint;
}

return null;
throw new Exception("Unable to complete challenge with Lets Encrypt servers error was: " + auth.Status);
}

public static void Install(Target target, string pfxFilename, X509Certificate2 certificate)
Expand Down Expand Up @@ -527,13 +528,14 @@ public static AuthorizationState Authorize(Target target)
authzState.Challenges = new AuthorizeChallenge[] { challenge };
client.SubmitChallengeAnswer(authzState, AcmeProtocol.CHALLENGE_TYPE_HTTP, true);

// have to loop to wait for server to stop being pending.
// TODO: put timeout/retry limit in this loop
while (authzState.Status == "pending")
// have to loop to wait for server to stop being pending.
int retry = 0;
while (authzState.Status == "pending" && retry < 6)
{
Console.WriteLine(" Refreshing authorization");
Trace.TraceInformation("Refreshing authorization");
Thread.Sleep(4000); // this has to be here to give ACME server a chance to think
retry++;
Console.WriteLine(" Refreshing authorization attempt" + retry);
Trace.TraceInformation("Refreshing authorization attempt" + retry);
Thread.Sleep(10000); // this has to be here to give ACME server a chance to think
var newAuthzState = client.RefreshIdentifierAuthorization(authzState);
if (newAuthzState.Status != "pending")
authzState = newAuthzState;
Expand All @@ -544,10 +546,11 @@ public static AuthorizationState Authorize(Target target)
if (authzState.Status == "invalid")
{
Trace.TraceError("Authorization Failed {0}", authzState.Status);
Trace.TraceInformation("Full Error Details {0}", authzState);
Trace.TraceInformation("Full Error Details {0}", JsonConvert.SerializeObject(authzState));
Console.WriteLine($"The ACME server was probably unable to reach {answerUri}");
Trace.TraceError("Unable to reach {0}", answerUri);
Console.WriteLine("\nCheck in a browser to see if the answer file is being served correctly.");
Console.WriteLine("\nCheck in a browser to see if the answer file is being served correctly.");
throw new Exception($"The Lets Encrypt ACME server was probably unable to reach {answerUri} view error report from Lets Encrypt at {authzState.Uri} for more information");
}
authStatus.Add(authzState);
}
Expand Down
2 changes: 1 addition & 1 deletion LetsEncrypt.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata>
<id>letsencrypt</id>
<title>Azure Let's Encrypt (x86)</title>
<version>0.4.7</version>
<version>0.4.9</version>
<authors>SJKP</authors>
<licenseUrl>http://opensource.org/licenses/Apache-2.0</licenseUrl>
<projectUrl>https://github.com/sjkp/letsencrypt-siteextension</projectUrl>
Expand Down
2 changes: 1 addition & 1 deletion LetsEncrypt64.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata>
<id>letsencrypt64</id>
<title>Azure Let's Encrypt (x64)</title>
<version>0.4.7</version>
<version>0.4.9</version>
<authors>SJKP</authors>
<licenseUrl>http://opensource.org/licenses/Apache-2.0</licenseUrl>
<projectUrl>https://github.com/sjkp/letsencrypt-siteextension</projectUrl>
Expand Down
2 changes: 1 addition & 1 deletion letsencrypt.siteextension.job.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata>
<id>letsencrypt.siteextension.job</id>
<title>Azure SiteExtension Let's Encrypt WebJob</title>
<version>0.4.7-beta</version>
<version>0.4.9-beta</version>
<authors>SJKP</authors>
<licenseUrl>http://opensource.org/licenses/Apache-2.0</licenseUrl>
<projectUrl>https://github.com/sjkp/letsencrypt-siteextension</projectUrl>
Expand Down
2 changes: 1 addition & 1 deletion letsencrypt.siteextension.job64.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata>
<id>letsencrypt.siteextension.job64</id>
<title>Azure SiteExtension Let's Encrypt WebJob (64bit)</title>
<version>0.4.7-beta</version>
<version>0.4.9-beta</version>
<authors>SJKP</authors>
<licenseUrl>http://opensource.org/licenses/Apache-2.0</licenseUrl>
<projectUrl>https://github.com/sjkp/letsencrypt-siteextension</projectUrl>
Expand Down
Binary file added media/error-during-challenge.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/troubleshoot-connect-to-streaming-log.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/troubleshoot-enable-diagnostic-logging.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0a5f68f

Please sign in to comment.