diff options
-rw-r--r-- | src/main.lib/Plugins/ValidationPlugins/Http/HttpValidation.cs | 14 | ||||
-rw-r--r-- | src/main.lib/Services/ProxyService.cs | 6 |
2 files changed, 15 insertions, 5 deletions
diff --git a/src/main.lib/Plugins/ValidationPlugins/Http/HttpValidation.cs b/src/main.lib/Plugins/ValidationPlugins/Http/HttpValidation.cs index c430ce2..3acca6c 100644 --- a/src/main.lib/Plugins/ValidationPlugins/Http/HttpValidation.cs +++ b/src/main.lib/Plugins/ValidationPlugins/Http/HttpValidation.cs @@ -6,7 +6,7 @@ using System; using System.Diagnostics; using System.IO; using System.Linq; -using System.Net; +using System.Net.Http; using System.Threading.Tasks; namespace PKISharp.WACS.Plugins.ValidationPlugins @@ -106,13 +106,19 @@ namespace PKISharp.WACS.Plugins.ValidationPlugins var value = await WarmupSite(); if (Equals(value, _challenge.HttpResourceValue)) { - _log.Information("Preliminary validation looks good, but ACME will be more thorough..."); + _log.Information("Preliminary validation looks good, but the ACME server will be more thorough"); } else { - _log.Warning("Preliminary validation failed, found {value} instead of {expected}", foundValue ?? "(null)", _challenge.HttpResourceValue); + _log.Warning("Preliminary validation failed, the server answered '{value}' instead of '{expected}'. The ACME server might have a different perspective", + foundValue ?? "(null)", + _challenge.HttpResourceValue); } } + catch (HttpRequestException hrex) + { + _log.Warning("Preliminary validation failed because {hrex}. The ACME server might have a different perspective", hrex.Message); + } catch (Exception ex) { _log.Error(ex, "Preliminary validation failed"); @@ -127,7 +133,7 @@ namespace PKISharp.WACS.Plugins.ValidationPlugins /// <param name="uri"></param> private async Task<string> WarmupSite() { - using var client = _proxy.GetHttpClient(); + using var client = _proxy.GetHttpClient(false); var response = await client.GetAsync(_challenge.HttpResourceUrl); return await response.Content.ReadAsStringAsync(); } diff --git a/src/main.lib/Services/ProxyService.cs b/src/main.lib/Services/ProxyService.cs index 4079261..bf7e73d 100644 --- a/src/main.lib/Services/ProxyService.cs +++ b/src/main.lib/Services/ProxyService.cs @@ -31,12 +31,16 @@ namespace PKISharp.WACS.Services /// Get prepared HttpClient with correct system proxy settings /// </summary> /// <returns></returns> - public HttpClient GetHttpClient() + public HttpClient GetHttpClient(bool checkSsl = true) { var httpClientHandler = new HttpClientHandler() { Proxy = GetWebProxy() }; + if (!checkSsl) + { + httpClientHandler.ServerCertificateCustomValidationCallback = (a, b, c, d) => true; + } if (UseSystemProxy) { httpClientHandler.DefaultProxyCredentials = CredentialCache.DefaultCredentials; |