2013-07-07 20:19:08 +03:00
|
|
|
using System.Net;
|
|
|
|
using System.Net.Security;
|
|
|
|
using System.Security.Cryptography.X509Certificates;
|
|
|
|
using NLog;
|
|
|
|
using NzbDrone.Common.EnvironmentInfo;
|
2013-08-31 04:42:30 +03:00
|
|
|
using NzbDrone.Common.Instrumentation;
|
2013-07-07 20:19:08 +03:00
|
|
|
|
|
|
|
namespace NzbDrone.Common.Security
|
|
|
|
{
|
|
|
|
public static class IgnoreCertErrorPolicy
|
|
|
|
{
|
2013-08-31 04:42:30 +03:00
|
|
|
private static readonly Logger Logger = NzbDroneLogger.GetLogger();
|
2013-07-07 20:19:08 +03:00
|
|
|
|
|
|
|
public static void Register()
|
|
|
|
{
|
|
|
|
if (OsInfo.IsLinux)
|
|
|
|
{
|
|
|
|
ServicePointManager.ServerCertificateValidationCallback = ValidationCallback;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private static bool ValidationCallback(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslpolicyerrors)
|
|
|
|
{
|
|
|
|
Logger.Warn("[{0}] {1}", sender.GetType(), sslpolicyerrors);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|