From b51739e23ecc071a107755c7613ff274f65c3a64 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 6 Oct 2016 21:35:11 +0100 Subject: recover regions main http server ssl suport. Using a PKCS12 cert file, and not certs store for now. Option http_listener_cn, cert CN need to the same as external IP. Self sign certs do seem to work, but the viewers option NoVerifySLLCert needs to be set true. CA check is not done but they do check the IP --- OpenSim/Region/Application/OpenSimBase.cs | 26 ++++++++++++++++++++-- .../Region/Application/RegionApplicationBase.cs | 14 +++++++----- .../Caps/EventQueue/Tests/EventQueueTests.cs | 2 +- .../ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs | 2 +- 4 files changed, 35 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 52ded3d..62abf8e 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -351,7 +351,18 @@ namespace OpenSim if (startupConfig == null || startupConfig.GetBoolean("JobEngineEnabled", true)) WorkManager.JobEngine.Start(); - m_httpServerPort = m_networkServersInfo.HttpListenerPort; + + if(m_networkServersInfo.HttpUsesSSL) + { + m_httpServerSSL = true; + m_httpServerPort = m_networkServersInfo.httpSSLPort; + } + else + { + m_httpServerSSL = false; + m_httpServerPort = m_networkServersInfo.HttpListenerPort; + } + SceneManager.OnRestartSim += HandleRestartRegion; // Only enable the watchdogs when all regions are ready. Otherwise we get false positives when cpu is @@ -404,7 +415,18 @@ namespace OpenSim // set initial ServerURI regionInfo.HttpPort = m_httpServerPort; - regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort.ToString() + "/"; + if(m_httpServerSSL) + { + if(m_networkServersInfo.HttpSSLCN != regionInfo.ExternalHostName) + throw new Exception("main http cert CN doesn't match region External IP"); + + regionInfo.ServerURI = "https://" + regionInfo.ExternalHostName + + ":" + regionInfo.HttpPort.ToString() + "/"; + } + else + regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + + ":" + regionInfo.HttpPort.ToString() + "/"; + regionInfo.osSecret = m_osSecret; diff --git a/OpenSim/Region/Application/RegionApplicationBase.cs b/OpenSim/Region/Application/RegionApplicationBase.cs index ba92fd6..603f139 100644 --- a/OpenSim/Region/Application/RegionApplicationBase.cs +++ b/OpenSim/Region/Application/RegionApplicationBase.cs @@ -50,6 +50,7 @@ namespace OpenSim protected Dictionary m_clientCircuits = new Dictionary(); protected NetworkServersInfo m_networkServersInfo; protected uint m_httpServerPort; + protected bool m_httpServerSSL; protected ISimulationDataService m_simulationDataService; protected IEstateDataService m_estateDataService; @@ -70,15 +71,18 @@ namespace OpenSim m_httpServer = new BaseHttpServer( - m_httpServerPort, m_networkServersInfo.HttpUsesSSL, m_networkServersInfo.httpSSLPort, - m_networkServersInfo.HttpSSLCN); - + m_httpServerPort, m_networkServersInfo.HttpUsesSSL, + m_networkServersInfo.httpSSLPort, m_networkServersInfo.HttpSSLCN, + m_networkServersInfo.HttpSSLCertPath, m_networkServersInfo.HttpSSLCNCertPass); + +/* why this? we only run one if (m_networkServersInfo.HttpUsesSSL && (m_networkServersInfo.HttpListenerPort == m_networkServersInfo.httpSSLPort)) { m_log.Error("[REGION SERVER]: HTTP Server config failed. HTTP Server and HTTPS server must be on different ports"); } - - m_log.InfoFormat("[REGION SERVER]: Starting HTTP server on port {0}", m_httpServerPort); +*/ + m_log.InfoFormat("[REGION SERVER]: Starting HTTP{0} server on port {1}", + m_networkServersInfo.HttpUsesSSL ? "S" : "", m_httpServerPort); m_httpServer.Start(); MainServer.AddHttpServer(m_httpServer); diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs index 5eb4452..507d9b8 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs @@ -65,7 +65,7 @@ namespace OpenSim.Region.ClientStack.Linden.Tests // variables and the VM is not restarted between tests. MainServer.RemoveHttpServer(port); - BaseHttpServer server = new BaseHttpServer(port, false, sslPort, ""); + BaseHttpServer server = new BaseHttpServer(port, false, sslPort, "","",""); MainServer.AddHttpServer(server); MainServer.Instance = server; diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs index 30dc4cd..1453204 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs @@ -87,7 +87,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests uint port = 9999; MainServer.RemoveHttpServer(port); - BaseHttpServer server = new BaseHttpServer(port, false, 0, ""); + BaseHttpServer server = new BaseHttpServer(port, false, 0, "", "", ""); MainServer.AddHttpServer(server); MainServer.Instance = server; -- cgit v1.1