diff options
author | BlueWall | 2011-05-01 14:44:09 -0400 |
---|---|---|
committer | BlueWall | 2011-05-05 19:56:54 -0400 |
commit | 8ca793875318efc8db3339b25bf7fa5ddeeac218 (patch) | |
tree | cc860147bdb35f8b9d52325b7b12c9df383f17cd /OpenSim/Framework | |
parent | fix command display for debugging 'emergency-monitoring' (diff) | |
download | opensim-SC_OLD-8ca793875318efc8db3339b25bf7fa5ddeeac218.zip opensim-SC_OLD-8ca793875318efc8db3339b25bf7fa5ddeeac218.tar.gz opensim-SC_OLD-8ca793875318efc8db3339b25bf7fa5ddeeac218.tar.bz2 opensim-SC_OLD-8ca793875318efc8db3339b25bf7fa5ddeeac218.tar.xz |
Adding ssl support
Adding ssl support for "Out of Band" applications such as the remote
admin module or Robust services
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/MainServer.cs | 5 | ||||
-rw-r--r-- | OpenSim/Framework/NetworkServersInfo.cs | 15 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 14 |
3 files changed, 34 insertions, 0 deletions
diff --git a/OpenSim/Framework/MainServer.cs b/OpenSim/Framework/MainServer.cs index 0515b16..a3e0a26 100644 --- a/OpenSim/Framework/MainServer.cs +++ b/OpenSim/Framework/MainServer.cs | |||
@@ -52,6 +52,11 @@ namespace OpenSim.Framework | |||
52 | return GetHttpServer(port,null); | 52 | return GetHttpServer(port,null); |
53 | } | 53 | } |
54 | 54 | ||
55 | public static void AddHttpServer(BaseHttpServer server) | ||
56 | { | ||
57 | m_Servers.Add(server.Port, server); | ||
58 | } | ||
59 | |||
55 | public static IHttpServer GetHttpServer(uint port, IPAddress ipaddr) | 60 | public static IHttpServer GetHttpServer(uint port, IPAddress ipaddr) |
56 | { | 61 | { |
57 | if (port == 0) | 62 | if (port == 0) |
diff --git a/OpenSim/Framework/NetworkServersInfo.cs b/OpenSim/Framework/NetworkServersInfo.cs index b25f8b9..5bb4111 100644 --- a/OpenSim/Framework/NetworkServersInfo.cs +++ b/OpenSim/Framework/NetworkServersInfo.cs | |||
@@ -49,6 +49,12 @@ namespace OpenSim.Framework | |||
49 | public string HttpSSLCN = ""; | 49 | public string HttpSSLCN = ""; |
50 | public uint httpSSLPort = 9001; | 50 | public uint httpSSLPort = 9001; |
51 | 51 | ||
52 | // "Out of band" managemnt https | ||
53 | public bool ssl_listener = false; | ||
54 | public uint https_port = 0; | ||
55 | public string cert_path = String.Empty; | ||
56 | public string cert_pass = String.Empty; | ||
57 | |||
52 | public string MessagingURL = String.Empty; | 58 | public string MessagingURL = String.Empty; |
53 | 59 | ||
54 | public NetworkServersInfo() | 60 | public NetworkServersInfo() |
@@ -86,6 +92,15 @@ namespace OpenSim.Framework | |||
86 | secureInventoryServer = config.Configs["Network"].GetBoolean("secure_inventory_server", true); | 92 | secureInventoryServer = config.Configs["Network"].GetBoolean("secure_inventory_server", true); |
87 | 93 | ||
88 | MessagingURL = config.Configs["Network"].GetString("messaging_server_url", string.Empty); | 94 | MessagingURL = config.Configs["Network"].GetString("messaging_server_url", string.Empty); |
95 | |||
96 | // "Out of band management https" | ||
97 | ssl_listener = config.Configs["Network"].GetBoolean("https_listener",false); | ||
98 | if( ssl_listener) | ||
99 | { | ||
100 | cert_path = config.Configs["Network"].GetString("cert_path",String.Empty); | ||
101 | cert_pass = config.Configs["Network"].GetString("cert_pass",String.Empty); | ||
102 | https_port = (uint)config.Configs["Network"].GetInt("https_port", 0); | ||
103 | } | ||
89 | } | 104 | } |
90 | } | 105 | } |
91 | } | 106 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index ba89e21..598e5d1 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -32,6 +32,7 @@ using System.Collections.Specialized; | |||
32 | using System.IO; | 32 | using System.IO; |
33 | using System.Net; | 33 | using System.Net; |
34 | using System.Net.Sockets; | 34 | using System.Net.Sockets; |
35 | using System.Security.Cryptography.X509Certificates; | ||
35 | using System.Reflection; | 36 | using System.Reflection; |
36 | using System.Globalization; | 37 | using System.Globalization; |
37 | using System.Text; | 38 | using System.Text; |
@@ -72,6 +73,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
72 | protected uint m_port; | 73 | protected uint m_port; |
73 | protected uint m_sslport; | 74 | protected uint m_sslport; |
74 | protected bool m_ssl; | 75 | protected bool m_ssl; |
76 | private X509Certificate2 m_cert; | ||
75 | protected bool m_firstcaps = true; | 77 | protected bool m_firstcaps = true; |
76 | protected string m_SSLCommonName = ""; | 78 | protected string m_SSLCommonName = ""; |
77 | 79 | ||
@@ -123,6 +125,14 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
123 | } | 125 | } |
124 | } | 126 | } |
125 | 127 | ||
128 | public BaseHttpServer(uint port, bool ssl, string CPath, string CPass) : this (port, ssl) | ||
129 | { | ||
130 | if (m_ssl) | ||
131 | { | ||
132 | m_cert = new X509Certificate2(CPath, CPass); | ||
133 | } | ||
134 | } | ||
135 | |||
126 | /// <summary> | 136 | /// <summary> |
127 | /// Add a stream handler to the http server. If the handler already exists, then nothing happens. | 137 | /// Add a stream handler to the http server. If the handler already exists, then nothing happens. |
128 | /// </summary> | 138 | /// </summary> |
@@ -1683,6 +1693,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1683 | try | 1693 | try |
1684 | { | 1694 | { |
1685 | //m_httpListener = new HttpListener(); | 1695 | //m_httpListener = new HttpListener(); |
1696 | |||
1686 | NotSocketErrors = 0; | 1697 | NotSocketErrors = 0; |
1687 | if (!m_ssl) | 1698 | if (!m_ssl) |
1688 | { | 1699 | { |
@@ -1702,6 +1713,9 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1702 | { | 1713 | { |
1703 | //m_httpListener.Prefixes.Add("https://+:" + (m_sslport) + "/"); | 1714 | //m_httpListener.Prefixes.Add("https://+:" + (m_sslport) + "/"); |
1704 | //m_httpListener.Prefixes.Add("http://+:" + m_port + "/"); | 1715 | //m_httpListener.Prefixes.Add("http://+:" + m_port + "/"); |
1716 | m_httpListener2 = CoolHTTPListener.Create(IPAddress.Any, (int)m_port, m_cert); | ||
1717 | m_httpListener2.ExceptionThrown += httpServerException; | ||
1718 | m_httpListener2.LogWriter = httpserverlog; | ||
1705 | } | 1719 | } |
1706 | 1720 | ||
1707 | m_httpListener2.RequestReceived += OnRequest; | 1721 | m_httpListener2.RequestReceived += OnRequest; |