diff options
Diffstat (limited to 'OpenSim/Server')
-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 69d0b74..4b7fd8a 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 = 300000; } catch { } | 85 | try { ServicePointManager.DnsRefreshTimeout = 300000; } catch { } |
63 | 86 | ||
@@ -72,6 +95,10 @@ namespace OpenSim.Server | |||
72 | throw new Exception("Configuration error"); | 95 | throw new Exception("Configuration error"); |
73 | } | 96 | } |
74 | 97 | ||
98 | m_NoVerifyCertChain = serverConfig.GetBoolean("NoVerifyCertChain", m_NoVerifyCertChain); | ||
99 | m_NoVerifyCertHostname = serverConfig.GetBoolean("NoVerifyCertHostname", m_NoVerifyCertHostname); | ||
100 | |||
101 | |||
75 | string connList = serverConfig.GetString("ServiceConnectors", String.Empty); | 102 | string connList = serverConfig.GetString("ServiceConnectors", String.Empty); |
76 | 103 | ||
77 | registryLocation = serverConfig.GetString("RegistryLocation","."); | 104 | registryLocation = serverConfig.GetString("RegistryLocation","."); |