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 c343044..75aef5f 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.Servers; | 36 | using OpenSim.Framework.Servers; |
35 | using OpenSim.Framework.Servers.HttpServer; | 37 | using OpenSim.Framework.Servers.HttpServer; |
@@ -51,12 +53,33 @@ namespace OpenSim.Server | |||
51 | new List<IServiceConnector>(); | 53 | new List<IServiceConnector>(); |
52 | 54 | ||
53 | protected static PluginLoader loader; | 55 | protected static PluginLoader loader; |
56 | private static bool m_NoVerifyCertChain = false; | ||
57 | private static bool m_NoVerifyCertHostname = false; | ||
58 | |||
59 | public static bool ValidateServerCertificate( | ||
60 | object sender, | ||
61 | X509Certificate certificate, | ||
62 | X509Chain chain, | ||
63 | SslPolicyErrors sslPolicyErrors) | ||
64 | { | ||
65 | if (m_NoVerifyCertChain) | ||
66 | sslPolicyErrors &= ~SslPolicyErrors.RemoteCertificateChainErrors; | ||
67 | |||
68 | if (m_NoVerifyCertHostname) | ||
69 | sslPolicyErrors &= ~SslPolicyErrors.RemoteCertificateNameMismatch; | ||
70 | |||
71 | if (sslPolicyErrors == SslPolicyErrors.None) | ||
72 | return true; | ||
73 | |||
74 | return false; | ||
75 | } | ||
54 | 76 | ||
55 | public static int Main(string[] args) | 77 | public static int Main(string[] args) |
56 | { | 78 | { |
57 | // Make sure we don't get outbound connections queueing | 79 | // Make sure we don't get outbound connections queueing |
58 | ServicePointManager.DefaultConnectionLimit = 50; | 80 | ServicePointManager.DefaultConnectionLimit = 50; |
59 | ServicePointManager.UseNagleAlgorithm = false; | 81 | ServicePointManager.UseNagleAlgorithm = false; |
82 | ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate; | ||
60 | 83 | ||
61 | m_Server = new HttpServerBase("R.O.B.U.S.T.", args); | 84 | m_Server = new HttpServerBase("R.O.B.U.S.T.", args); |
62 | 85 | ||
@@ -69,6 +92,10 @@ namespace OpenSim.Server | |||
69 | throw new Exception("Configuration error"); | 92 | throw new Exception("Configuration error"); |
70 | } | 93 | } |
71 | 94 | ||
95 | m_NoVerifyCertChain = serverConfig.GetBoolean("NoVerifyCertChain", m_NoVerifyCertChain); | ||
96 | m_NoVerifyCertHostname = serverConfig.GetBoolean("NoVerifyCertHostname", m_NoVerifyCertHostname); | ||
97 | |||
98 | |||
72 | string connList = serverConfig.GetString("ServiceConnectors", String.Empty); | 99 | string connList = serverConfig.GetString("ServiceConnectors", String.Empty); |
73 | 100 | ||
74 | registryLocation = serverConfig.GetString("RegistryLocation","."); | 101 | registryLocation = serverConfig.GetString("RegistryLocation","."); |