Mono's TLS remains broken. :(

This commit is contained in:
Rick Falkvinge
2019-02-17 18:07:52 +01:00
parent fe1cfb9f85
commit 977b1e58a5
+5 -20
View File
@@ -15,22 +15,8 @@ namespace Swarmops.Logic.Support
{
public static void DisableSslCertificateChecks()
{
// 2018-Dec-01: We're now requiring the freshest Mono repositories to be installed with Swarmops, and this DOES
// force a cert repository to be installed (at long effing last). Therefore, we're disabling this entire
// function, and basically checking if anything breaks as HTTPS becomes re-enabled across the board.
return;
// disable "unreachable code" for the rest of this function, as the disabling is deliberate
// disable "variable declared but never used" because of the workaround last here
// disable "variable is assigned a value that is never used" because of the workaround last here
#pragma warning disable 0162,0168,0219
// X.509 is SO SO SO broken. The reason we do this, btw, is that mono doesn't come with root certs. At all.
// This disables certificate checking completely and accepts ALL certificates.
// TODO: Does this install a new handler every time it's been called? How do you verify that this short-circuit is in place?
// Mono's SSL **REMAINS** broken even in the freshest builds. :( This disables client-side TLS verification.
// It means there's a certain lack of security, but the alternative is not having the functionality at all.
System.Net.ServicePointManager.ServerCertificateValidationCallback =
(sender, certificate, chain, sslPolicyErrors) => true;
@@ -38,11 +24,10 @@ namespace Swarmops.Logic.Support
// Further, instantiate an AesCryptoServiceProvider to make sure the linker doesn't optimize it away -- apparently
// another known bug. The warning disabled here is "b is assigned a value that is never used".
//#pragma warning disable 0219
#pragma warning disable 0219
System.Security.Cryptography.AesCryptoServiceProvider b = new System.Security.Cryptography.AesCryptoServiceProvider();
//#pragma warning restore 0219
#pragma warning restore 0162,0168,0219
#pragma warning restore 0219
}
public static string GenerateSecureRandomKey(int byteCount)