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

@ -99,6 +99,8 @@ namespace OpenSim.Region.ClientStack
// "OOB" Server // "OOB" Server
if (m_networkServersInfo.ssl_listener) if (m_networkServersInfo.ssl_listener)
{
if (!m_networkServersInfo.ssl_external)
{ {
BaseHttpServer server = new BaseHttpServer( BaseHttpServer server = new BaseHttpServer(
m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, m_networkServersInfo.cert_path, m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, m_networkServersInfo.cert_path,
@ -108,6 +110,16 @@ namespace OpenSim.Region.ClientStack
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();
} }

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,6 +114,9 @@ namespace OpenSim.Server.Base
uint https_port = (uint)networkConfig.GetInt("https_port", 0); uint https_port = (uint)networkConfig.GetInt("https_port", 0);
m_log.WarnFormat("[SSL]: External flag is {0}", ssl_external);
if (!ssl_external)
{
string cert_path = networkConfig.GetString("cert_path",String.Empty); string cert_path = networkConfig.GetString("cert_path",String.Empty);
if ( cert_path == String.Empty ) if ( cert_path == String.Empty )
{ {
@ -128,6 +132,12 @@ namespace OpenSim.Server.Base
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));
}
}
} }
protected override void Initialise() protected override void Initialise()