From 77d744ceee5c14a763dc77fbbc37f971610ba5d8 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Thu, 21 Feb 2019 05:38:50 +0100 Subject: [PATCH] Re-enabling TLS checks; WebSocket appears a separate issue --- Logic/Support/General.cs | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/Logic/Support/General.cs b/Logic/Support/General.cs index 83919ab9..f9428392 100644 --- a/Logic/Support/General.cs +++ b/Logic/Support/General.cs @@ -15,8 +15,25 @@ namespace Swarmops.Logic.Support { public static void DisableSslCertificateChecks() { - // 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. + // 2019-Feb-21: The TLS connection to Blockchain.Info's WebSocket still fails with a TLS connection, but + // that appears to be unrelated to this issue; it fails a check whether TLS checks are enabled or not + // + // 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? System.Net.ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true; @@ -24,9 +41,11 @@ 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 0219 + + #pragma warning restore 0162, 0168, 0219 }