From 5c661baf6c197caef73e6a8fe5a2223d00a2a6ba Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 26 Apr 2014 02:42:30 +0200 Subject: Allow opening a https port using only http so that nginx can be used for ssl --- OpenSim/Server/Base/HttpServerBase.cs | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'OpenSim/Server/Base/HttpServerBase.cs') diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs index 954783c..eed2645 100644 --- a/OpenSim/Server/Base/HttpServerBase.cs +++ b/OpenSim/Server/Base/HttpServerBase.cs @@ -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_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)); } - string cert_pass = networkConfig.GetString("cert_pass",String.Empty); - if ( cert_pass == String.Empty ) + else { - System.Console.WriteLine("Password for X509 certificate is missing, server can't start."); - Thread.CurrentThread.Abort(); + m_log.WarnFormat("[SSL]: SSL port is active but no SSL is used because external SSL was requested."); + MainServer.AddHttpServer(new BaseHttpServer(https_port)); } - - MainServer.AddHttpServer(new BaseHttpServer(https_port, ssl_listener, cert_path, cert_pass)); } } -- cgit v1.1