mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-26 22:46:37 -04:00
Fixed: Added fallback and log errors when Tls1.2 clashes with https certificate with obsolete md5 hash.
This commit is contained in:
@@ -24,6 +24,7 @@ namespace NzbDrone.Common.Security
|
||||
protocol |= Tls11;
|
||||
}
|
||||
|
||||
// Enabling Tls1.2 invalidates certificates using md5, so we disable Tls12 on the fly if that happens.
|
||||
if (Enum.IsDefined(typeof(SecurityProtocolType), Tls12))
|
||||
{
|
||||
protocol |= Tls12;
|
||||
@@ -36,5 +37,23 @@ namespace NzbDrone.Common.Security
|
||||
Logger.Debug(ex, "Failed to set TLS security protocol.");
|
||||
}
|
||||
}
|
||||
|
||||
public static void DisableTls12()
|
||||
{
|
||||
try
|
||||
{
|
||||
var protocol = ServicePointManager.SecurityProtocol;
|
||||
if (protocol.HasFlag(Tls12))
|
||||
{
|
||||
Logger.Warn("Disabled Tls1.2 due to remote certificate error.");
|
||||
|
||||
ServicePointManager.SecurityProtocol = protocol & ~Tls12;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Debug(ex, "Failed to disable TLS 1.2 security protocol.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user