aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/HypergridService/GatekeeperService.cs
diff options
context:
space:
mode:
authorDiva Canto2011-04-27 07:02:37 -0700
committerDiva Canto2011-04-27 07:02:37 -0700
commite0576b56d376d6bc7b9c5c3818acbdbcdb0dc56f (patch)
tree3f9b2bc869684c243ecb66ac99e2ce48098ee708 /OpenSim/Services/HypergridService/GatekeeperService.cs
parentBump minimum required mono to 2.4.3 from 2.4.2. OpenSim fails at runtime bel... (diff)
downloadopensim-SC_OLD-e0576b56d376d6bc7b9c5c3818acbdbcdb0dc56f.zip
opensim-SC_OLD-e0576b56d376d6bc7b9c5c3818acbdbcdb0dc56f.tar.gz
opensim-SC_OLD-e0576b56d376d6bc7b9c5c3818acbdbcdb0dc56f.tar.bz2
opensim-SC_OLD-e0576b56d376d6bc7b9c5c3818acbdbcdb0dc56f.tar.xz
Thank you Snoopy for a patch that adds some filtering to client versions allowed at login and HG-login times. NOTE: additional (optional) configuration variables in [LoginService] and [GatekeeperService]. See .examples.
Diffstat (limited to 'OpenSim/Services/HypergridService/GatekeeperService.cs')
-rw-r--r--OpenSim/Services/HypergridService/GatekeeperService.cs39
1 files changed, 37 insertions, 2 deletions
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;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Net; 30using System.Net;
31using System.Reflection; 31using System.Reflection;
32using System.Text.RegularExpressions;
32 33
33using OpenSim.Framework; 34using OpenSim.Framework;
34using OpenSim.Services.Interfaces; 35using 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