From c9cb85fb4c905a75232dd82ae6b397d2ddc5ca5b Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Wed, 14 Sep 2016 12:20:27 +0200 Subject: [PATCH] Disabled cert checks on install because Mono's broken cert store --- Logic/Support/DatabaseMaintenance.cs | 4 ++++ Logic/Support/General.cs | 2 ++ 2 files changed, 6 insertions(+) diff --git a/Logic/Support/DatabaseMaintenance.cs b/Logic/Support/DatabaseMaintenance.cs index d11bda78..48630509 100644 --- a/Logic/Support/DatabaseMaintenance.cs +++ b/Logic/Support/DatabaseMaintenance.cs @@ -89,6 +89,10 @@ namespace Swarmops.Logic.Support { Console.WriteLine(" trying fallback..."); + // Because Mono installs with an insufficient certificate store, we must disable certificate checking before accessing github + + SupportFunctions.DisableSslCertificateChecks(); + fileName = String.Format("https://raw.githubusercontent.com/Swarmops/Swarmops/master/Database/Schemata/upgrade-{0:D4}.sql", currentDbVersion); diff --git a/Logic/Support/General.cs b/Logic/Support/General.cs index 43d64e3b..1d400b70 100644 --- a/Logic/Support/General.cs +++ b/Logic/Support/General.cs @@ -18,6 +18,8 @@ namespace Swarmops.Logic.Support // 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; }