aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/HypergridService
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/HypergridService')
-rw-r--r--OpenSim/Services/HypergridService/GatekeeperService.cs128
-rw-r--r--OpenSim/Services/HypergridService/UserAgentService.cs38
2 files changed, 98 insertions, 68 deletions
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs
index c5cfe75..3aaafe8 100644
--- a/OpenSim/Services/HypergridService/GatekeeperService.cs
+++ b/OpenSim/Services/HypergridService/GatekeeperService.cs
@@ -49,61 +49,64 @@ namespace OpenSim.Services.HypergridService
49 LogManager.GetLogger( 49 LogManager.GetLogger(
50 MethodBase.GetCurrentMethod().DeclaringType); 50 MethodBase.GetCurrentMethod().DeclaringType);
51 51
52 IGridService m_GridService; 52 private static bool m_Initialized = false;
53 IPresenceService m_PresenceService;
54 IUserAccountService m_UserAccountService;
55 IUserAgentService m_UserAgentService;
56 ISimulationService m_SimulationService;
57 53
58 string m_AuthDll; 54 private static IGridService m_GridService;
55 private static IPresenceService m_PresenceService;
56 private static IUserAccountService m_UserAccountService;
57 private static IUserAgentService m_UserAgentService;
58 private static ISimulationService m_SimulationService;
59 59
60 UUID m_ScopeID; 60 private static UUID m_ScopeID;
61 bool m_AllowTeleportsToAnyRegion; 61 private static bool m_AllowTeleportsToAnyRegion;
62 string m_ExternalName; 62 private static string m_ExternalName;
63 GridRegion m_DefaultGatewayRegion; 63 private static GridRegion m_DefaultGatewayRegion;
64 64
65 public GatekeeperService(IConfigSource config, ISimulationService simService) 65 public GatekeeperService(IConfigSource config, ISimulationService simService)
66 { 66 {
67 IConfig serverConfig = config.Configs["GatekeeperService"]; 67 if (!m_Initialized)
68 if (serverConfig == null) 68 {
69 throw new Exception(String.Format("No section GatekeeperService in config file")); 69 m_Initialized = true;
70 70
71 string accountService = serverConfig.GetString("UserAccountService", String.Empty); 71 IConfig serverConfig = config.Configs["GatekeeperService"];
72 string homeUsersService = serverConfig.GetString("HomeUsersSecurityService", string.Empty); 72 if (serverConfig == null)
73 string gridService = serverConfig.GetString("GridService", String.Empty); 73 throw new Exception(String.Format("No section GatekeeperService in config file"));
74 string presenceService = serverConfig.GetString("PresenceService", String.Empty); 74
75 string simulationService = serverConfig.GetString("SimulationService", String.Empty); 75 string accountService = serverConfig.GetString("UserAccountService", String.Empty);
76 76 string homeUsersService = serverConfig.GetString("UserAgentService", string.Empty);
77 //m_AuthDll = serverConfig.GetString("AuthenticationService", String.Empty); 77 string gridService = serverConfig.GetString("GridService", String.Empty);
78 78 string presenceService = serverConfig.GetString("PresenceService", String.Empty);
79 // These 3 are mandatory, the others aren't 79 string simulationService = serverConfig.GetString("SimulationService", String.Empty);
80 if (gridService == string.Empty || presenceService == string.Empty || m_AuthDll == string.Empty) 80
81 throw new Exception("Incomplete specifications, Gatekeeper Service cannot function."); 81 // These 3 are mandatory, the others aren't
82 82 if (gridService == string.Empty || presenceService == string.Empty)
83 string scope = serverConfig.GetString("ScopeID", UUID.Zero.ToString()); 83 throw new Exception("Incomplete specifications, Gatekeeper Service cannot function.");
84 UUID.TryParse(scope, out m_ScopeID); 84
85 //m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!"); 85 string scope = serverConfig.GetString("ScopeID", UUID.Zero.ToString());
86 m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true); 86 UUID.TryParse(scope, out m_ScopeID);
87 m_ExternalName = serverConfig.GetString("ExternalName", string.Empty); 87 //m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
88 88 m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true);
89 Object[] args = new Object[] { config }; 89 m_ExternalName = serverConfig.GetString("ExternalName", string.Empty);
90 m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args); 90
91 m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args); 91 Object[] args = new Object[] { config };
92 92 m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
93 if (accountService != string.Empty) 93 m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args);
94 m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); 94
95 if (homeUsersService != string.Empty) 95 if (accountService != string.Empty)
96 m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(homeUsersService, args); 96 m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
97 97 if (homeUsersService != string.Empty)
98 if (simService != null) 98 m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(homeUsersService, args);
99 m_SimulationService = simService; 99
100 else if (simulationService != string.Empty) 100 if (simService != null)
101 m_SimulationService = ServerUtils.LoadPlugin<ISimulationService>(simulationService, args); 101 m_SimulationService = simService;
102 102 else if (simulationService != string.Empty)
103 if (m_GridService == null || m_PresenceService == null || m_SimulationService == null) 103 m_SimulationService = ServerUtils.LoadPlugin<ISimulationService>(simulationService, args);
104 throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function."); 104
105 105 if (m_GridService == null || m_PresenceService == null || m_SimulationService == null)
106 m_log.Debug("[GATEKEEPER SERVICE]: Starting..."); 106 throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function.");
107
108 m_log.Debug("[GATEKEEPER SERVICE]: Starting...");
109 }
107 } 110 }
108 111
109 public GatekeeperService(IConfigSource config) 112 public GatekeeperService(IConfigSource config)
@@ -280,18 +283,23 @@ namespace OpenSim.Services.HypergridService
280 return false; 283 return false;
281 } 284 }
282 285
283 Object[] args = new Object[] { userURL }; 286 if (userURL == m_ExternalName)
284 IUserAgentService userAgentService = new UserAgentServiceConnector(userURL); //ServerUtils.LoadPlugin<IUserAgentService>(m_AuthDll, args); 287 return m_UserAgentService.VerifyAgent(aCircuit.SessionID, aCircuit.ServiceSessionID);
285 if (userAgentService != null) 288 else
286 { 289 {
287 try 290 Object[] args = new Object[] { userURL };
291 IUserAgentService userAgentService = new UserAgentServiceConnector(userURL);
292 if (userAgentService != null)
288 { 293 {
289 return userAgentService.VerifyAgent(aCircuit.SessionID, aCircuit.ServiceSessionID); 294 try
290 } 295 {
291 catch 296 return userAgentService.VerifyAgent(aCircuit.SessionID, aCircuit.ServiceSessionID);
292 { 297 }
293 m_log.DebugFormat("[GATEKEEPER SERVICE]: Unable to contact authentication service at {0}", userURL); 298 catch
294 return false; 299 {
300 m_log.DebugFormat("[GATEKEEPER SERVICE]: Unable to contact authentication service at {0}", userURL);
301 return false;
302 }
295 } 303 }
296 } 304 }
297 305
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs
index 2f1fed4..181d7f2 100644
--- a/OpenSim/Services/HypergridService/UserAgentService.cs
+++ b/OpenSim/Services/HypergridService/UserAgentService.cs
@@ -62,11 +62,18 @@ namespace OpenSim.Services.HypergridService
62 protected static IGridUserService m_GridUserService; 62 protected static IGridUserService m_GridUserService;
63 protected static IGridService m_GridService; 63 protected static IGridService m_GridService;
64 protected static GatekeeperServiceConnector m_GatekeeperConnector; 64 protected static GatekeeperServiceConnector m_GatekeeperConnector;
65 protected static IGatekeeperService m_GatekeeperService;
66
67 protected static string m_GridName;
68
69 protected static bool m_BypassClientVerification;
65 70
66 public UserAgentService(IConfigSource config) 71 public UserAgentService(IConfigSource config)
67 { 72 {
68 if (!m_Initialized) 73 if (!m_Initialized)
69 { 74 {
75 m_Initialized = true;
76
70 m_log.DebugFormat("[HOME USERS SECURITY]: Starting..."); 77 m_log.DebugFormat("[HOME USERS SECURITY]: Starting...");
71 78
72 IConfig serverConfig = config.Configs["UserAgentService"]; 79 IConfig serverConfig = config.Configs["UserAgentService"];
@@ -75,16 +82,25 @@ namespace OpenSim.Services.HypergridService
75 82
76 string gridService = serverConfig.GetString("GridService", String.Empty); 83 string gridService = serverConfig.GetString("GridService", String.Empty);
77 string gridUserService = serverConfig.GetString("GridUserService", String.Empty); 84 string gridUserService = serverConfig.GetString("GridUserService", String.Empty);
85 string gatekeeperService = serverConfig.GetString("GatekeeperService", String.Empty);
86
87 m_BypassClientVerification = serverConfig.GetBoolean("BypassClientVerification", false);
78 88
79 if (gridService == string.Empty || gridUserService == string.Empty) 89 if (gridService == string.Empty || gridUserService == string.Empty || gatekeeperService == string.Empty)
80 throw new Exception(String.Format("Incomplete specifications, UserAgent Service cannot function.")); 90 throw new Exception(String.Format("Incomplete specifications, UserAgent Service cannot function."));
81 91
82 Object[] args = new Object[] { config }; 92 Object[] args = new Object[] { config };
83 m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args); 93 m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
84 m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args); 94 m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args);
85 m_GatekeeperConnector = new GatekeeperServiceConnector(); 95 m_GatekeeperConnector = new GatekeeperServiceConnector();
96 m_GatekeeperService = ServerUtils.LoadPlugin<IGatekeeperService>(gatekeeperService, args);
86 97
87 m_Initialized = true; 98 m_GridName = serverConfig.GetString("ExternalName", string.Empty);
99 if (m_GridName == string.Empty)
100 {
101 serverConfig = config.Configs["GatekeeperService"];
102 m_GridName = serverConfig.GetString("ExternalName", string.Empty);
103 }
88 } 104 }
89 } 105 }
90 106
@@ -131,7 +147,13 @@ namespace OpenSim.Services.HypergridService
131 agentCircuit.ServiceSessionID = "http://" + region.ExternalHostName + ":" + region.HttpPort + ";" + UUID.Random(); 147 agentCircuit.ServiceSessionID = "http://" + region.ExternalHostName + ":" + region.HttpPort + ";" + UUID.Random();
132 TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region); 148 TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region);
133 149
134 bool success = m_GatekeeperConnector.CreateAgent(region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, out reason); 150 //bool success = m_GatekeeperConnector.CreateAgent(region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, out reason);
151 bool success = false;
152 string gridName = "http://" + gatekeeper.ExternalHostName + ":" + gatekeeper.HttpPort;
153 if (m_GridName == gridName)
154 success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason);
155 else
156 success = m_GatekeeperConnector.CreateAgent(region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, out reason);
135 157
136 if (!success) 158 if (!success)
137 { 159 {
@@ -171,7 +193,7 @@ namespace OpenSim.Services.HypergridService
171 m_TravelingAgents[agentCircuit.SessionID] = travel; 193 m_TravelingAgents[agentCircuit.SessionID] = travel;
172 } 194 }
173 travel.UserID = agentCircuit.AgentID; 195 travel.UserID = agentCircuit.AgentID;
174 travel.GridExternalName = region.ExternalHostName + ":" + region.HttpPort; 196 travel.GridExternalName = "http://" + region.ExternalHostName + ":" + region.HttpPort;
175 travel.ServiceToken = agentCircuit.ServiceSessionID; 197 travel.ServiceToken = agentCircuit.ServiceSessionID;
176 if (old != null) 198 if (old != null)
177 travel.ClientToken = old.ClientToken; 199 travel.ClientToken = old.ClientToken;
@@ -207,16 +229,16 @@ namespace OpenSim.Services.HypergridService
207 return false; 229 return false;
208 230
209 TravelingAgentInfo travel = m_TravelingAgents[sessionID]; 231 TravelingAgentInfo travel = m_TravelingAgents[sessionID];
232
210 return travel.GridExternalName == thisGridExternalName; 233 return travel.GridExternalName == thisGridExternalName;
211 } 234 }
212 235
213 public bool VerifyClient(UUID sessionID, string token) 236 public bool VerifyClient(UUID sessionID, string token)
214 { 237 {
215 m_log.DebugFormat("[USER AGENT SERVICE]: Verifying Client session {0} with token {1}", sessionID, token); 238 if (m_BypassClientVerification)
216 //return true; 239 return true;
217 240
218 // Commenting this for now until I understand better what part of a sender's 241 m_log.DebugFormat("[USER AGENT SERVICE]: Verifying Client session {0} with token {1}", sessionID, token);
219 // info stays unchanged throughout a session
220 242
221 if (m_TravelingAgents.ContainsKey(sessionID)) 243 if (m_TravelingAgents.ContainsKey(sessionID))
222 return m_TravelingAgents[sessionID].ClientToken == token; 244 return m_TravelingAgents[sessionID].ClientToken == token;