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

View File

@ -100,13 +100,25 @@ namespace OpenSim.Region.ClientStack
// "OOB" Server
if (m_networkServersInfo.ssl_listener)
{
BaseHttpServer server = new BaseHttpServer(
m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, m_networkServersInfo.cert_path,
m_networkServersInfo.cert_pass);
if (!m_networkServersInfo.ssl_external)
{
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);
MainServer.AddHttpServer(server);
server.Start();
m_log.InfoFormat("[REGION SERVER]: Starting HTTPS server on port {0}", server.Port);
MainServer.AddHttpServer(server);
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();

View File

@ -40,7 +40,7 @@ namespace OpenSim.Server.Base
{
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;
@ -69,6 +69,7 @@ namespace OpenSim.Server.Base
bool ssl_main = networkConfig.GetBoolean("https_main",false);
bool ssl_listener = networkConfig.GetBoolean("https_listener",false);
bool ssl_external = networkConfig.GetBoolean("https_external",false);
m_consolePort = (uint)networkConfig.GetInt("ConsolePort", 0);
@ -113,20 +114,29 @@ namespace OpenSim.Server.Base
uint https_port = (uint)networkConfig.GetInt("https_port", 0);
string cert_path = networkConfig.GetString("cert_path",String.Empty);
if ( cert_path == String.Empty )
m_log.WarnFormat("[SSL]: External flag is {0}", ssl_external);
if (!ssl_external)
{
System.Console.WriteLine("Path to X509 certificate is missing, server can't start.");
Thread.CurrentThread.Abort();
}
string cert_pass = networkConfig.GetString("cert_pass",String.Empty);
if ( cert_pass == String.Empty )
{
System.Console.WriteLine("Password for X509 certificate is missing, server can't start.");
Thread.CurrentThread.Abort();
}
string cert_path = networkConfig.GetString("cert_path",String.Empty);
if ( cert_path == String.Empty )
{
System.Console.WriteLine("Path to X509 certificate is missing, server can't start.");
Thread.CurrentThread.Abort();
}
string cert_pass = networkConfig.GetString("cert_pass",String.Empty);
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));
}
}
}