diff options
Diffstat (limited to 'OpenSim/Server/ServerMain.cs')
-rw-r--r-- | OpenSim/Server/ServerMain.cs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index accf938..5c99ab7 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs | |||
@@ -30,6 +30,8 @@ using log4net; | |||
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System; | 31 | using System; |
32 | using System.Net; | 32 | using System.Net; |
33 | using System.Net.Security; | ||
34 | using System.Security.Cryptography.X509Certificates; | ||
33 | using System.Collections.Generic; | 35 | using System.Collections.Generic; |
34 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Servers; | 37 | using OpenSim.Framework.Servers; |
@@ -52,12 +54,33 @@ namespace OpenSim.Server | |||
52 | new List<IServiceConnector>(); | 54 | new List<IServiceConnector>(); |
53 | 55 | ||
54 | protected static PluginLoader loader; | 56 | protected static PluginLoader loader; |
57 | private static bool m_NoVerifyCertChain = false; | ||
58 | private static bool m_NoVerifyCertHostname = false; | ||
59 | |||
60 | public static bool ValidateServerCertificate( | ||
61 | object sender, | ||
62 | X509Certificate certificate, | ||
63 | X509Chain chain, | ||
64 | SslPolicyErrors sslPolicyErrors) | ||
65 | { | ||
66 | if (m_NoVerifyCertChain) | ||
67 | sslPolicyErrors &= ~SslPolicyErrors.RemoteCertificateChainErrors; | ||
68 | |||
69 | if (m_NoVerifyCertHostname) | ||
70 | sslPolicyErrors &= ~SslPolicyErrors.RemoteCertificateNameMismatch; | ||
71 | |||
72 | if (sslPolicyErrors == SslPolicyErrors.None) | ||
73 | return true; | ||
74 | |||
75 | return false; | ||
76 | } | ||
55 | 77 | ||
56 | public static int Main(string[] args) | 78 | public static int Main(string[] args) |
57 | { | 79 | { |
58 | ServicePointManager.DefaultConnectionLimit = 64; | 80 | ServicePointManager.DefaultConnectionLimit = 64; |
59 | ServicePointManager.Expect100Continue = false; | 81 | ServicePointManager.Expect100Continue = false; |
60 | ServicePointManager.UseNagleAlgorithm = false; | 82 | ServicePointManager.UseNagleAlgorithm = false; |
83 | ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate; | ||
61 | 84 | ||
62 | try { ServicePointManager.DnsRefreshTimeout = 120000; } // just is case some mono decides to have it infinity | 85 | try { ServicePointManager.DnsRefreshTimeout = 120000; } // just is case some mono decides to have it infinity |
63 | catch { } | 86 | catch { } |
@@ -73,6 +96,10 @@ namespace OpenSim.Server | |||
73 | throw new Exception("Configuration error"); | 96 | throw new Exception("Configuration error"); |
74 | } | 97 | } |
75 | 98 | ||
99 | m_NoVerifyCertChain = serverConfig.GetBoolean("NoVerifyCertChain", m_NoVerifyCertChain); | ||
100 | m_NoVerifyCertHostname = serverConfig.GetBoolean("NoVerifyCertHostname", m_NoVerifyCertHostname); | ||
101 | |||
102 | |||
76 | string connList = serverConfig.GetString("ServiceConnectors", String.Empty); | 103 | string connList = serverConfig.GetString("ServiceConnectors", String.Empty); |
77 | 104 | ||
78 | registryLocation = serverConfig.GetString("RegistryLocation","."); | 105 | registryLocation = serverConfig.GetString("RegistryLocation","."); |