Allow opening a https port using only http so that nginx can be used for ssl

avinationmerge
Melanie Thielker 2014-04-26 02:42:30 +02:00
parent c77cd6adc7
commit 5c661baf6c
3 changed files with 44 additions and 20 deletions

View File

@ -41,6 +41,7 @@ namespace OpenSim.Framework
// "Out of band" managemnt https // "Out of band" managemnt https
public bool ssl_listener = false; public bool ssl_listener = false;
public bool ssl_external = false;
public uint https_port = 0; public uint https_port = 0;
public string cert_path = String.Empty; public string cert_path = String.Empty;
public string cert_pass = String.Empty; public string cert_pass = String.Empty;
@ -64,6 +65,7 @@ namespace OpenSim.Framework
// "Out of band management https" // "Out of band management https"
ssl_listener = config.Configs["Network"].GetBoolean("https_listener",false); ssl_listener = config.Configs["Network"].GetBoolean("https_listener",false);
ssl_external = config.Configs["Network"].GetBoolean("https_external",false);
if( ssl_listener) if( ssl_listener)
{ {
cert_path = config.Configs["Network"].GetString("cert_path",String.Empty); cert_path = config.Configs["Network"].GetString("cert_path",String.Empty);

View File

@ -100,13 +100,25 @@ namespace OpenSim.Region.ClientStack
// "OOB" Server // "OOB" Server
if (m_networkServersInfo.ssl_listener) if (m_networkServersInfo.ssl_listener)
{ {
BaseHttpServer server = new BaseHttpServer( if (!m_networkServersInfo.ssl_external)
m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, m_networkServersInfo.cert_path, {
m_networkServersInfo.cert_pass); BaseHttpServer server = new BaseHttpServer(
m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, m_networkServersInfo.cert_path,
m_networkServersInfo.cert_pass);
m_log.InfoFormat("[REGION SERVER]: Starting HTTPS server on port {0}", server.Port); m_log.InfoFormat("[REGION SERVER]: Starting HTTPS server on port {0}", server.Port);
MainServer.AddHttpServer(server); MainServer.AddHttpServer(server);
server.Start(); server.Start();
}
else
{
BaseHttpServer server = new BaseHttpServer(
m_networkServersInfo.https_port);
m_log.InfoFormat("[REGION SERVER]: Starting HTTP server on port {0} for external HTTPS", server.Port);
MainServer.AddHttpServer(server);
server.Start();
}
} }
base.StartupSpecific(); base.StartupSpecific();
@ -132,4 +144,4 @@ namespace OpenSim.Region.ClientStack
return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier); return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier);
} }
} }
} }

View File

@ -40,7 +40,7 @@ namespace OpenSim.Server.Base
{ {
public class HttpServerBase : ServicesServerBase public class HttpServerBase : ServicesServerBase
{ {
// private static readonly ILog m_Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private uint m_consolePort; private uint m_consolePort;
@ -69,6 +69,7 @@ namespace OpenSim.Server.Base
bool ssl_main = networkConfig.GetBoolean("https_main",false); bool ssl_main = networkConfig.GetBoolean("https_main",false);
bool ssl_listener = networkConfig.GetBoolean("https_listener",false); bool ssl_listener = networkConfig.GetBoolean("https_listener",false);
bool ssl_external = networkConfig.GetBoolean("https_external",false);
m_consolePort = (uint)networkConfig.GetInt("ConsolePort", 0); m_consolePort = (uint)networkConfig.GetInt("ConsolePort", 0);
@ -113,20 +114,29 @@ namespace OpenSim.Server.Base
uint https_port = (uint)networkConfig.GetInt("https_port", 0); uint https_port = (uint)networkConfig.GetInt("https_port", 0);
string cert_path = networkConfig.GetString("cert_path",String.Empty); m_log.WarnFormat("[SSL]: External flag is {0}", ssl_external);
if ( cert_path == String.Empty ) if (!ssl_external)
{ {
System.Console.WriteLine("Path to X509 certificate is missing, server can't start."); string cert_path = networkConfig.GetString("cert_path",String.Empty);
Thread.CurrentThread.Abort(); if ( cert_path == String.Empty )
} {
string cert_pass = networkConfig.GetString("cert_pass",String.Empty); System.Console.WriteLine("Path to X509 certificate is missing, server can't start.");
if ( cert_pass == String.Empty ) Thread.CurrentThread.Abort();
{ }
System.Console.WriteLine("Password for X509 certificate is missing, server can't start."); string cert_pass = networkConfig.GetString("cert_pass",String.Empty);
Thread.CurrentThread.Abort(); if ( cert_pass == String.Empty )
} {
System.Console.WriteLine("Password for X509 certificate is missing, server can't start.");
Thread.CurrentThread.Abort();
}
MainServer.AddHttpServer(new BaseHttpServer(https_port, ssl_listener, cert_path, cert_pass)); MainServer.AddHttpServer(new BaseHttpServer(https_port, ssl_listener, cert_path, cert_pass));
}
else
{
m_log.WarnFormat("[SSL]: SSL port is active but no SSL is used because external SSL was requested.");
MainServer.AddHttpServer(new BaseHttpServer(https_port));
}
} }
} }