From 977b1e58a53a79620e9f6b7b7c15b5ef546d06a2 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Sun, 17 Feb 2019 18:07:52 +0100 Subject: [PATCH] Mono's TLS remains broken. :( --- Logic/Support/General.cs | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/Logic/Support/General.cs b/Logic/Support/General.cs index 86ada44b..83919ab9 100644 --- a/Logic/Support/General.cs +++ b/Logic/Support/General.cs @@ -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)