diff --git a/BTCPayServer.Tests/UnitTest1.cs b/BTCPayServer.Tests/UnitTest1.cs index b835c5603..152207f78 100644 --- a/BTCPayServer.Tests/UnitTest1.cs +++ b/BTCPayServer.Tests/UnitTest1.cs @@ -676,10 +676,10 @@ namespace BTCPayServer.Tests response = await client.GetAsync("http://explorerzydxu5ecjrkwceayqybizmpjjznk5izmitf2modhcusuqlid.onion/"); response.EnsureSuccessStatusCode(); - TestLogs.LogInformation("Querying an onion address which can't be found should send http 500"); + TestLogs.LogInformation("Querying an onion address which can't be found"); await Assert.ThrowsAsync(() => client.GetAsync("http://dwoduwoi.onion/")); - TestLogs.LogInformation("Querying valid onion but unreachable should send error 502"); + TestLogs.LogInformation("Querying valid onion but unreachable"); await Assert.ThrowsAsync(() => client.GetAsync("http://nzwsosflsoquxirwb2zikz6uxr3u5n5u73l33umtdx4hq5mzm5dycuqd.onion/")); } } diff --git a/BTCPayServer/Services/Mails/EmailSettings.cs b/BTCPayServer/Services/Mails/EmailSettings.cs index b137231af..8c551f65e 100644 --- a/BTCPayServer/Services/Mails/EmailSettings.cs +++ b/BTCPayServer/Services/Mails/EmailSettings.cs @@ -5,6 +5,8 @@ using MailKit.Net.Smtp; using MimeKit; using System.Threading.Tasks; using System.Threading; +using System.Net.Security; +using System.Security.Cryptography.X509Certificates; namespace BTCPayServer.Services.Mails { @@ -77,6 +79,13 @@ namespace BTCPayServer.Services.Mails using var connectCancel = new CancellationTokenSource(10000); try { + if (Extensions.IsLocalNetwork(Server)) + { + client.CheckCertificateRevocation = false; +#pragma warning disable CA5359 // Do Not Disable Certificate Validation + client.ServerCertificateValidationCallback = (s, c, h, e) => true; +#pragma warning restore CA5359 // Do Not Disable Certificate Validation + } await client.ConnectAsync(Server, Port.Value, MailKit.Security.SecureSocketOptions.Auto, connectCancel.Token); await client.AuthenticateAsync(Login, Password, connectCancel.Token); }