diff options
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Services')
4 files changed, 87 insertions, 13 deletions
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 8f80788..6ce0a47 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | |||
@@ -241,7 +241,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
241 | if (args != null) | 241 | if (args != null) |
242 | { | 242 | { |
243 | agent = new CompleteAgentData(); | 243 | agent = new CompleteAgentData(); |
244 | agent.Unpack(args); | 244 | agent.Unpack(args, null); |
245 | return true; | 245 | return true; |
246 | } | 246 | } |
247 | } | 247 | } |
@@ -256,9 +256,10 @@ namespace OpenSim.Services.Connectors.Simulation | |||
256 | 256 | ||
257 | /// <summary> | 257 | /// <summary> |
258 | /// </summary> | 258 | /// </summary> |
259 | public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason) | 259 | public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason) |
260 | { | 260 | { |
261 | reason = "Failed to contact destination"; | 261 | reason = "Failed to contact destination"; |
262 | version = "Unknown"; | ||
262 | 263 | ||
263 | // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position); | 264 | // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position); |
264 | 265 | ||
@@ -274,23 +275,27 @@ namespace OpenSim.Services.Connectors.Simulation | |||
274 | try | 275 | try |
275 | { | 276 | { |
276 | OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 10000); | 277 | OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 10000); |
278 | OSDMap data = (OSDMap)result["_Result"]; | ||
279 | |||
277 | bool success = result["success"].AsBoolean(); | 280 | bool success = result["success"].AsBoolean(); |
278 | reason = result["reason"].AsString(); | 281 | reason = data["reason"].AsString(); |
282 | if (data["version"] != null && data["version"].AsString() != string.Empty) | ||
283 | version = data["version"].AsString(); | ||
279 | 284 | ||
280 | //m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1}", uri, success); | 285 | m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1} version {2} ({3})", uri, success, version, data["version"].AsString()); |
281 | 286 | ||
282 | if (!success) | 287 | if (!success) |
283 | { | 288 | { |
284 | if (result.ContainsKey("Message")) | 289 | if (data.ContainsKey("Message")) |
285 | { | 290 | { |
286 | string message = result["Message"].AsString(); | 291 | string message = data["Message"].AsString(); |
287 | if (message == "Service request failed: [MethodNotAllowed] MethodNotAllowed") // Old style region | 292 | if (message == "Service request failed: [MethodNotAllowed] MethodNotAllowed") // Old style region |
288 | { | 293 | { |
289 | m_log.Info("[REMOTE SIMULATION CONNECTOR]: The above web util error was caused by a TP to a sim that doesn't support QUERYACCESS and can be ignored"); | 294 | m_log.Info("[REMOTE SIMULATION CONNECTOR]: The above web util error was caused by a TP to a sim that doesn't support QUERYACCESS and can be ignored"); |
290 | return true; | 295 | return true; |
291 | } | 296 | } |
292 | 297 | ||
293 | reason = result["Message"]; | 298 | reason = data["Message"]; |
294 | } | 299 | } |
295 | else | 300 | else |
296 | { | 301 | { |
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index b66bfed..9385b8d 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Net; | 30 | using System.Net; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Text.RegularExpressions; | ||
32 | 33 | ||
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Services.Interfaces; | 35 | using OpenSim.Services.Interfaces; |
@@ -57,6 +58,9 @@ namespace OpenSim.Services.HypergridService | |||
57 | private static IUserAgentService m_UserAgentService; | 58 | private static IUserAgentService m_UserAgentService; |
58 | private static ISimulationService m_SimulationService; | 59 | private static ISimulationService m_SimulationService; |
59 | 60 | ||
61 | protected string m_AllowedClients = string.Empty; | ||
62 | protected string m_DeniedClients = string.Empty; | ||
63 | |||
60 | private static UUID m_ScopeID; | 64 | private static UUID m_ScopeID; |
61 | private static bool m_AllowTeleportsToAnyRegion; | 65 | private static bool m_AllowTeleportsToAnyRegion; |
62 | private static string m_ExternalName; | 66 | private static string m_ExternalName; |
@@ -104,6 +108,9 @@ namespace OpenSim.Services.HypergridService | |||
104 | else if (simulationService != string.Empty) | 108 | else if (simulationService != string.Empty) |
105 | m_SimulationService = ServerUtils.LoadPlugin<ISimulationService>(simulationService, args); | 109 | m_SimulationService = ServerUtils.LoadPlugin<ISimulationService>(simulationService, args); |
106 | 110 | ||
111 | m_AllowedClients = serverConfig.GetString("AllowedClients", string.Empty); | ||
112 | m_DeniedClients = serverConfig.GetString("DeniedClients", string.Empty); | ||
113 | |||
107 | if (m_GridService == null || m_PresenceService == null || m_SimulationService == null) | 114 | if (m_GridService == null || m_PresenceService == null || m_SimulationService == null) |
108 | throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function."); | 115 | throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function."); |
109 | 116 | ||
@@ -181,8 +188,36 @@ namespace OpenSim.Services.HypergridService | |||
181 | string authURL = string.Empty; | 188 | string authURL = string.Empty; |
182 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) | 189 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) |
183 | authURL = aCircuit.ServiceURLs["HomeURI"].ToString(); | 190 | authURL = aCircuit.ServiceURLs["HomeURI"].ToString(); |
184 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to login foreign agent {0} {1} @ {2} ({3}) at destination {4}", | 191 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Login request for {0} {1} @ {2} ({3}) at {4} using viewer {5}, channel {6}, IP {7}, Mac {8}, Id0 {9}", |
185 | aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionName); | 192 | aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionName, |
193 | aCircuit.Viewer, aCircuit.Channel, aCircuit.IPAddress, aCircuit.Mac, aCircuit.Id0); | ||
194 | |||
195 | // | ||
196 | // Check client | ||
197 | // | ||
198 | if (m_AllowedClients != string.Empty) | ||
199 | { | ||
200 | Regex arx = new Regex(m_AllowedClients); | ||
201 | Match am = arx.Match(aCircuit.Viewer); | ||
202 | |||
203 | if (!am.Success) | ||
204 | { | ||
205 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Login failed, reason: client {0} is not allowed", aCircuit.Viewer); | ||
206 | return false; | ||
207 | } | ||
208 | } | ||
209 | |||
210 | if (m_DeniedClients != string.Empty) | ||
211 | { | ||
212 | Regex drx = new Regex(m_DeniedClients); | ||
213 | Match dm = drx.Match(aCircuit.Viewer); | ||
214 | |||
215 | if (dm.Success) | ||
216 | { | ||
217 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Login failed, reason: client {0} is denied", aCircuit.Viewer); | ||
218 | return false; | ||
219 | } | ||
220 | } | ||
186 | 221 | ||
187 | // | 222 | // |
188 | // Authenticate the user | 223 | // Authenticate the user |
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs index f2184fc..ae6bd72 100644 --- a/OpenSim/Services/Interfaces/ISimulationService.cs +++ b/OpenSim/Services/Interfaces/ISimulationService.cs | |||
@@ -67,7 +67,7 @@ namespace OpenSim.Services.Interfaces | |||
67 | 67 | ||
68 | bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent); | 68 | bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent); |
69 | 69 | ||
70 | bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason); | 70 | bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason); |
71 | 71 | ||
72 | /// <summary> | 72 | /// <summary> |
73 | /// Message from receiving region to departing region, telling it got contacted by the client. | 73 | /// Message from receiving region to departing region, telling it got contacted by the client. |
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index c6e6768..250f8f1 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -77,7 +77,11 @@ namespace OpenSim.Services.LLLoginService | |||
77 | protected string m_MapTileURL; | 77 | protected string m_MapTileURL; |
78 | protected string m_SearchURL; | 78 | protected string m_SearchURL; |
79 | 79 | ||
80 | protected string m_AllowedClients; | ||
81 | protected string m_DeniedClients; | ||
82 | |||
80 | IConfig m_LoginServerConfig; | 83 | IConfig m_LoginServerConfig; |
84 | IConfig m_ClientsConfig; | ||
81 | 85 | ||
82 | public LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService) | 86 | public LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService) |
83 | { | 87 | { |
@@ -105,7 +109,10 @@ namespace OpenSim.Services.LLLoginService | |||
105 | m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty); | 109 | m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty); |
106 | m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty); | 110 | m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty); |
107 | m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty); | 111 | m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty); |
108 | 112 | ||
113 | m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty); | ||
114 | m_DeniedClients = m_LoginServerConfig.GetString("DeniedClients", string.Empty); | ||
115 | |||
109 | // These are required; the others aren't | 116 | // These are required; the others aren't |
110 | if (accountService == string.Empty || authService == string.Empty) | 117 | if (accountService == string.Empty || authService == string.Empty) |
111 | throw new Exception("LoginService is missing service specifications"); | 118 | throw new Exception("LoginService is missing service specifications"); |
@@ -216,11 +223,38 @@ namespace OpenSim.Services.LLLoginService | |||
216 | bool success = false; | 223 | bool success = false; |
217 | UUID session = UUID.Random(); | 224 | UUID session = UUID.Random(); |
218 | 225 | ||
219 | m_log.InfoFormat("[LLOGIN SERVICE]: Login request for {0} {1} from {2} with user agent {3} starting in {4}", | 226 | m_log.InfoFormat("[LLOGIN SERVICE]: Login request for {0} {1} at {2} using viewer {3}, channel {4}, IP {5}, Mac {6}, Id0 {7}", |
220 | firstName, lastName, clientIP.Address.ToString(), clientVersion, startLocation); | 227 | firstName, lastName, startLocation, clientVersion, channel, clientIP.Address.ToString(), mac, id0); |
221 | try | 228 | try |
222 | { | 229 | { |
223 | // | 230 | // |
231 | // Check client | ||
232 | // | ||
233 | if (m_AllowedClients != string.Empty) | ||
234 | { | ||
235 | Regex arx = new Regex(m_AllowedClients); | ||
236 | Match am = arx.Match(clientVersion); | ||
237 | |||
238 | if (!am.Success) | ||
239 | { | ||
240 | m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: client {0} is not allowed", clientVersion); | ||
241 | return LLFailedLoginResponse.LoginBlockedProblem; | ||
242 | } | ||
243 | } | ||
244 | |||
245 | if (m_DeniedClients != string.Empty) | ||
246 | { | ||
247 | Regex drx = new Regex(m_DeniedClients); | ||
248 | Match dm = drx.Match(clientVersion); | ||
249 | |||
250 | if (dm.Success) | ||
251 | { | ||
252 | m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: client {0} is denied", clientVersion); | ||
253 | return LLFailedLoginResponse.LoginBlockedProblem; | ||
254 | } | ||
255 | } | ||
256 | |||
257 | // | ||
224 | // Get the account and check that it exists | 258 | // Get the account and check that it exists |
225 | // | 259 | // |
226 | UserAccount account = m_UserAccountService.GetUserAccount(scopeID, firstName, lastName); | 260 | UserAccount account = m_UserAccountService.GetUserAccount(scopeID, firstName, lastName); |