Go Home works. With security!!
parent
fd64823466
commit
3d53694415
|
@ -38,6 +38,7 @@ using OpenMetaverse.Packets;
|
|||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Statistics;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenMetaverse;
|
||||
|
||||
using TokenBucket = OpenSim.Region.ClientStack.LindenUDP.TokenBucket;
|
||||
|
@ -900,6 +901,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
if (!m_scene.TryGetClient(agentID, out existingClient))
|
||||
{
|
||||
IHomeUsersSecurityService security = m_scene.RequestModuleInterface<IHomeUsersSecurityService>();
|
||||
if (security != null)
|
||||
{
|
||||
IPEndPoint ep = security.GetEndPoint(sessionID);
|
||||
if (ep != null && ep.ToString() != remoteEndPoint.ToString())
|
||||
{
|
||||
// uh-oh, this is fishy
|
||||
m_log.WarnFormat("[LLUDPSERVER]: Agent {0} with session {1} connecting with unidentified end point. Refusing service.", agentID, sessionID);
|
||||
m_log.WarnFormat("[LLUDPSERVER]: EP was {0}, now is {1}", ep.ToString(), remoteEndPoint.ToString());
|
||||
return;
|
||||
}
|
||||
else if (ep != null)
|
||||
{
|
||||
// ok, you're home, welcome back
|
||||
m_log.InfoFormat("LLUDPSERVER]: Agent {0} is coming back to this grid", agentID);
|
||||
security.RemoveEndPoint(sessionID);
|
||||
}
|
||||
}
|
||||
|
||||
// Create the LLClientView
|
||||
LLClientView client = new LLClientView(remoteEndPoint, m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode);
|
||||
client.OnLogout += LogoutHandler;
|
||||
|
|
|
@ -134,8 +134,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
if (!sp.Scene.Permissions.CanTeleport(sp.UUID))
|
||||
return;
|
||||
|
||||
bool destRegionUp = true;
|
||||
|
||||
IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>();
|
||||
|
||||
// Reset animations; the viewer does that in teleports.
|
||||
|
@ -240,8 +238,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
protected void DoTeleport(ScenePresence sp, GridRegion reg, GridRegion finalDestination, Vector3 position, Vector3 lookAt, uint teleportFlags, IEventQueue eq)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[ENTITY TRANSFER MODULE]: RequestTeleportToLocation to {0} in {1}",
|
||||
position, reg.RegionName);
|
||||
"[ENTITY TRANSFER MODULE]: Request Teleport to {0}:{1}:{2}/{3} final destination {4}",
|
||||
reg.ExternalHostName, reg.HttpPort, reg.RegionName, position, finalDestination.RegionName);
|
||||
|
||||
uint newRegionX = (uint)(reg.RegionHandle >> 40);
|
||||
uint newRegionY = (((uint)(reg.RegionHandle)) >> 8);
|
||||
|
@ -297,7 +295,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
string reason = String.Empty;
|
||||
|
||||
// Let's create an agent there if one doesn't exist yet.
|
||||
if (!CreateAgent(reg, finalDestination, agentCircuit, teleportFlags, out reason))
|
||||
if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason))
|
||||
{
|
||||
sp.ControllingClient.SendTeleportFailed(String.Format("Destination refused: {0}",
|
||||
reason));
|
||||
|
@ -458,7 +456,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
}
|
||||
|
||||
|
||||
protected virtual bool CreateAgent(GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason)
|
||||
protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason)
|
||||
{
|
||||
return m_aScene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ using OpenSim.Region.Framework.Interfaces;
|
|||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Connectors.Hypergrid;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Server.Base;
|
||||
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
|
@ -59,6 +60,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
}
|
||||
|
||||
private GatekeeperServiceConnector m_GatekeeperConnector;
|
||||
private IHomeUsersSecurityService m_Security;
|
||||
|
||||
#region ISharedRegionModule
|
||||
|
||||
|
@ -77,12 +79,42 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
{
|
||||
m_agentsInTransit = new List<UUID>();
|
||||
m_GatekeeperConnector = new GatekeeperServiceConnector();
|
||||
|
||||
IConfig config = source.Configs["HGEntityTransferModule"];
|
||||
if (config != null)
|
||||
{
|
||||
string dll = config.GetString("HomeUsersSecurityService", string.Empty);
|
||||
if (dll != string.Empty)
|
||||
{
|
||||
Object[] args = new Object[] { source };
|
||||
m_Security = ServerUtils.LoadPlugin<IHomeUsersSecurityService>(dll, args);
|
||||
if (m_Security == null)
|
||||
m_log.Debug("[HG ENTITY TRANSFER MODULE]: Unable to load Home Users Security service");
|
||||
else
|
||||
m_log.Debug("[HG ENTITY TRANSFER MODULE]: Home Users Security service loaded");
|
||||
}
|
||||
}
|
||||
|
||||
m_Enabled = true;
|
||||
m_log.InfoFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddRegion(Scene scene)
|
||||
{
|
||||
base.AddRegion(scene);
|
||||
if (m_Enabled)
|
||||
scene.RegisterModuleInterface<IHomeUsersSecurityService>(m_Security);
|
||||
}
|
||||
|
||||
public override void RemoveRegion(Scene scene)
|
||||
{
|
||||
base.AddRegion(scene);
|
||||
if (m_Enabled)
|
||||
scene.UnregisterModuleInterface<IHomeUsersSecurityService>(m_Security);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -98,13 +130,25 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
return true;
|
||||
}
|
||||
|
||||
protected override bool CreateAgent(GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason)
|
||||
protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason)
|
||||
{
|
||||
reason = string.Empty;
|
||||
if (reg.RegionLocX != finalDestination.RegionLocX && reg.RegionLocY != finalDestination.RegionLocY)
|
||||
if (reg.RegionLocX != finalDestination.RegionLocX || reg.RegionLocY != finalDestination.RegionLocY)
|
||||
{
|
||||
// this user is going to another grid
|
||||
reg.RegionName = finalDestination.RegionName;
|
||||
reg.RegionID = finalDestination.RegionID;
|
||||
reg.RegionLocX = finalDestination.RegionLocX;
|
||||
reg.RegionLocY = finalDestination.RegionLocY;
|
||||
|
||||
// Log their session and remote endpoint in the home users security service
|
||||
IHomeUsersSecurityService security = sp.Scene.RequestModuleInterface<IHomeUsersSecurityService>();
|
||||
if (security != null)
|
||||
security.SetEndPoint(sp.ControllingClient.SessionId, sp.ControllingClient.RemoteEndPoint);
|
||||
|
||||
// Log them out of this grid
|
||||
sp.Scene.PresenceService.LogoutAgent(agentCircuit.SessionID, sp.AbsolutePosition, sp.Lookat);
|
||||
|
||||
return m_GatekeeperConnector.CreateAgent(reg, agentCircuit, teleportFlags, out reason);
|
||||
}
|
||||
|
||||
|
@ -145,6 +189,26 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
Vector3 position = Vector3.UnitY, lookAt = Vector3.UnitY;
|
||||
GridRegion finalDestination = m_GatekeeperConnector.GetHomeRegion(homeGatekeeper, aCircuit.AgentID, out position, out lookAt);
|
||||
if (finalDestination == null)
|
||||
{
|
||||
client.SendTeleportFailed("Your home region could not be found");
|
||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's home region not found");
|
||||
return;
|
||||
}
|
||||
|
||||
ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(client.AgentId);
|
||||
if (sp == null)
|
||||
{
|
||||
client.SendTeleportFailed("Internal error");
|
||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent not found in the scene where it is supposed to be");
|
||||
return;
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: teleporting user {0} {1} home to {2} via {3}:{4}:{5}",
|
||||
aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ExternalHostName, homeGatekeeper.HttpPort, homeGatekeeper.RegionName);
|
||||
|
||||
IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>();
|
||||
DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
@ -159,6 +223,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
region.ExternalHostName = uri.Host;
|
||||
region.HttpPort = (uint)uri.Port;
|
||||
region.RegionName = string.Empty;
|
||||
region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0);
|
||||
return region;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
<RegionModule id="InventoryServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory.InventoryServiceInConnectorModule" />
|
||||
<RegionModule id="LandServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Land.LandServiceInConnectorModule" />
|
||||
<RegionModule id="NeighbourServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour.NeighbourServiceInConnectorModule" /> \
|
||||
<RegionModule id="HypergridServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid.HypergridServiceInConnectorModule" /> \
|
||||
<RegionModule id="HypergridServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid.HypergridServiceInConnectorModule" /> \
|
||||
<RegionModule id="LLLoginServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Login.LLLoginServiceInConnectorModule" /> \
|
||||
<RegionModule id="SimulationServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Simulation.SimulationServiceInConnectorModule" /> \
|
||||
<RegionModule id="GridInfoServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid.GridInfoServiceInConnectorModule" /> \
|
||||
|
|
|
@ -40,7 +40,7 @@ using OpenSim.Server.Handlers.Hypergrid;
|
|||
using OpenSim.Services.Interfaces;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid
|
||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid
|
||||
{
|
||||
public class HypergridServiceInConnectorModule : ISharedRegionModule
|
||||
{
|
||||
|
@ -119,6 +119,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid
|
|||
ISimulationService simService = scene.RequestModuleInterface<ISimulationService>();
|
||||
m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService);
|
||||
//ServerUtils.LoadPlugin<HypergridServiceInConnector>("OpenSim.Server.Handlers.dll:HypergridServiceInConnector", args);
|
||||
scene.RegisterModuleInterface<IGatekeeperService>(m_HypergridHandler.GateKeeper);
|
||||
}
|
||||
}
|
||||
|
|
@ -46,6 +46,10 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
|||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IGatekeeperService m_GatekeeperService;
|
||||
public IGatekeeperService GateKeeper
|
||||
{
|
||||
get { return m_GatekeeperService; }
|
||||
}
|
||||
|
||||
public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server, ISimulationService simService) :
|
||||
base(config, server, String.Empty)
|
||||
|
|
|
@ -0,0 +1,122 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
|
||||
using log4net;
|
||||
using Nwc.XmlRpc;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Server.Handlers.Hypergrid
|
||||
{
|
||||
public class HomeUsersSecurityServerConnector : ServiceConnector
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IHomeUsersSecurityService m_HomeUsersService;
|
||||
|
||||
public HomeUsersSecurityServerConnector(IConfigSource config, IHttpServer server) :
|
||||
base(config, server, String.Empty)
|
||||
{
|
||||
IConfig gridConfig = config.Configs["HomeUsersSecurityService"];
|
||||
if (gridConfig != null)
|
||||
{
|
||||
string serviceDll = gridConfig.GetString("LocalServiceModule", string.Empty);
|
||||
Object[] args = new Object[] { config };
|
||||
m_HomeUsersService = ServerUtils.LoadPlugin<IHomeUsersSecurityService>(serviceDll, args);
|
||||
}
|
||||
if (m_HomeUsersService == null)
|
||||
throw new Exception("HomeUsersSecurity server connector cannot proceed because of missing service");
|
||||
|
||||
server.AddXmlRPCHandler("ep_get", GetEndPoint, false);
|
||||
server.AddXmlRPCHandler("ep_set", SetEndPoint, false);
|
||||
server.AddXmlRPCHandler("ep_remove", RemoveEndPoint, false);
|
||||
|
||||
}
|
||||
|
||||
public XmlRpcResponse GetEndPoint(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
//string host = (string)requestData["host"];
|
||||
//string portstr = (string)requestData["port"];
|
||||
string sessionID_str = (string)requestData["sessionID"];
|
||||
UUID sessionID = UUID.Zero;
|
||||
UUID.TryParse(sessionID_str, out sessionID);
|
||||
|
||||
IPEndPoint ep = m_HomeUsersService.GetEndPoint(sessionID);
|
||||
|
||||
Hashtable hash = new Hashtable();
|
||||
if (ep == null)
|
||||
hash["result"] = "false";
|
||||
else
|
||||
{
|
||||
hash["result"] = "true";
|
||||
hash["ep_addr"] = ep.Address.ToString();
|
||||
hash["ep_port"] = ep.Port.ToString();
|
||||
}
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
response.Value = hash;
|
||||
return response;
|
||||
|
||||
}
|
||||
|
||||
public XmlRpcResponse SetEndPoint(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
string host = (string)requestData["ep_addr"];
|
||||
string portstr = (string)requestData["ep_port"];
|
||||
string sessionID_str = (string)requestData["sessionID"];
|
||||
UUID sessionID = UUID.Zero;
|
||||
UUID.TryParse(sessionID_str, out sessionID);
|
||||
int port = 0;
|
||||
Int32.TryParse(portstr, out port);
|
||||
|
||||
IPEndPoint ep = null;
|
||||
try
|
||||
{
|
||||
ep = new IPEndPoint(IPAddress.Parse(host), port);
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_log.Debug("[HOME USERS SECURITY]: Exception in creating EndPoint");
|
||||
}
|
||||
|
||||
m_HomeUsersService.SetEndPoint(sessionID, ep);
|
||||
|
||||
Hashtable hash = new Hashtable();
|
||||
hash["result"] = "true";
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
response.Value = hash;
|
||||
return response;
|
||||
|
||||
}
|
||||
|
||||
public XmlRpcResponse RemoveEndPoint(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
string sessionID_str = (string)requestData["sessionID"];
|
||||
UUID sessionID = UUID.Zero;
|
||||
UUID.TryParse(sessionID_str, out sessionID);
|
||||
|
||||
m_HomeUsersService.RemoveEndPoint(sessionID);
|
||||
|
||||
Hashtable hash = new Hashtable();
|
||||
hash["result"] = "true";
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
response.Value = hash;
|
||||
return response;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,132 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
using OpenMetaverse;
|
||||
using log4net;
|
||||
using Nwc.XmlRpc;
|
||||
using Nini.Config;
|
||||
|
||||
namespace OpenSim.Services.Connectors.Hypergrid
|
||||
{
|
||||
public class HomeUsersSecurityServiceConnector : IHomeUsersSecurityService
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
string m_ServerURL;
|
||||
public HomeUsersSecurityServiceConnector(string url)
|
||||
{
|
||||
m_ServerURL = url;
|
||||
}
|
||||
|
||||
public HomeUsersSecurityServiceConnector(IConfigSource config)
|
||||
{
|
||||
}
|
||||
|
||||
public void SetEndPoint(UUID sessionID, IPEndPoint ep)
|
||||
{
|
||||
Hashtable hash = new Hashtable();
|
||||
hash["sessionID"] = sessionID.ToString();
|
||||
hash["ep_addr"] = ep.Address.ToString();
|
||||
hash["ep_port"] = ep.Port.ToString();
|
||||
|
||||
Call("ep_set", hash);
|
||||
}
|
||||
|
||||
public void RemoveEndPoint(UUID sessionID)
|
||||
{
|
||||
Hashtable hash = new Hashtable();
|
||||
hash["sessionID"] = sessionID.ToString();
|
||||
|
||||
Call("ep_remove", hash);
|
||||
}
|
||||
|
||||
public IPEndPoint GetEndPoint(UUID sessionID)
|
||||
{
|
||||
Hashtable hash = new Hashtable();
|
||||
hash["sessionID"] = sessionID.ToString();
|
||||
|
||||
IList paramList = new ArrayList();
|
||||
paramList.Add(hash);
|
||||
|
||||
XmlRpcRequest request = new XmlRpcRequest("ep_get", paramList);
|
||||
//m_log.Debug("[HGrid]: Linking to " + uri);
|
||||
XmlRpcResponse response = null;
|
||||
try
|
||||
{
|
||||
response = request.Send(m_ServerURL, 10000);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Debug("[HGrid]: Exception " + e.Message);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (response.IsFault)
|
||||
{
|
||||
m_log.ErrorFormat("[HGrid]: remote call returned an error: {0}", response.FaultString);
|
||||
return null;
|
||||
}
|
||||
|
||||
hash = (Hashtable)response.Value;
|
||||
//foreach (Object o in hash)
|
||||
// m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
|
||||
try
|
||||
{
|
||||
bool success = false;
|
||||
Boolean.TryParse((string)hash["result"], out success);
|
||||
if (success)
|
||||
{
|
||||
IPEndPoint ep = null;
|
||||
int port = 0;
|
||||
if (hash["ep_port"] != null)
|
||||
Int32.TryParse((string)hash["ep_port"], out port);
|
||||
if (hash["ep_addr"] != null)
|
||||
ep = new IPEndPoint(IPAddress.Parse((string)hash["ep_addr"]), port);
|
||||
|
||||
return ep;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[HGrid]: Got exception while parsing GetEndPoint response " + e.StackTrace);
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void Call(string method, Hashtable hash)
|
||||
{
|
||||
IList paramList = new ArrayList();
|
||||
paramList.Add(hash);
|
||||
|
||||
XmlRpcRequest request = new XmlRpcRequest(method, paramList);
|
||||
XmlRpcResponse response = null;
|
||||
try
|
||||
{
|
||||
response = request.Send(m_ServerURL, 10000);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Debug("[HGrid]: Exception " + e.Message);
|
||||
return ;
|
||||
}
|
||||
|
||||
if (response.IsFault)
|
||||
{
|
||||
m_log.ErrorFormat("[HGrid]: remote call returned an error: {0}", response.FaultString);
|
||||
return ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
|
||||
using OpenSim.Framework;
|
||||
|
@ -51,6 +52,7 @@ namespace OpenSim.Services.HypergridService
|
|||
IPresenceService m_PresenceService;
|
||||
IAuthenticationService m_AuthenticationService;
|
||||
IUserAccountService m_UserAccountService;
|
||||
IHomeUsersSecurityService m_HomeUsersSecurityService;
|
||||
ISimulationService m_SimulationService;
|
||||
|
||||
string m_AuthDll;
|
||||
|
@ -66,14 +68,15 @@ namespace OpenSim.Services.HypergridService
|
|||
throw new Exception(String.Format("No section GatekeeperService in config file"));
|
||||
|
||||
string accountService = serverConfig.GetString("UserAccountService", String.Empty);
|
||||
string homeUsersSecurityService = serverConfig.GetString("HomeUsersSecurityService", string.Empty);
|
||||
string gridService = serverConfig.GetString("GridService", String.Empty);
|
||||
string presenceService = serverConfig.GetString("PresenceService", String.Empty);
|
||||
string simulationService = serverConfig.GetString("SimulationService", String.Empty);
|
||||
|
||||
m_AuthDll = serverConfig.GetString("AuthenticationService", String.Empty);
|
||||
|
||||
if (accountService == string.Empty || gridService == string.Empty ||
|
||||
presenceService == string.Empty || m_AuthDll == string.Empty)
|
||||
// These 3 are mandatory, the others aren't
|
||||
if (gridService == string.Empty || presenceService == string.Empty || m_AuthDll == string.Empty)
|
||||
throw new Exception("Incomplete specifications, Gatekeeper Service cannot function.");
|
||||
|
||||
string scope = serverConfig.GetString("ScopeID", UUID.Zero.ToString());
|
||||
|
@ -82,16 +85,20 @@ namespace OpenSim.Services.HypergridService
|
|||
m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true);
|
||||
|
||||
Object[] args = new Object[] { config };
|
||||
m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
|
||||
m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
|
||||
m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args);
|
||||
|
||||
if (accountService != string.Empty)
|
||||
m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
|
||||
if (homeUsersSecurityService != string.Empty)
|
||||
m_HomeUsersSecurityService = ServerUtils.LoadPlugin<IHomeUsersSecurityService>(homeUsersSecurityService, args);
|
||||
|
||||
if (simService != null)
|
||||
m_SimulationService = simService;
|
||||
else if (simulationService != string.Empty)
|
||||
m_SimulationService = ServerUtils.LoadPlugin<ISimulationService>(simulationService, args);
|
||||
|
||||
if (m_UserAccountService == null || m_GridService == null ||
|
||||
m_PresenceService == null || m_SimulationService == null)
|
||||
if (m_GridService == null || m_PresenceService == null || m_SimulationService == null)
|
||||
throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function.");
|
||||
|
||||
m_log.Debug("[GATEKEEPER SERVICE]: Starting...");
|
||||
|
@ -183,17 +190,31 @@ namespace OpenSim.Services.HypergridService
|
|||
}
|
||||
m_log.DebugFormat("[GATEKEEPER SERVICE]: Identity verified for {0} {1} @ {2}", aCircuit.firstname, aCircuit.lastname, authURL);
|
||||
|
||||
// Check to see if we have a local user with that UUID
|
||||
UserAccount account = m_UserAccountService.GetUserAccount(m_ScopeID, aCircuit.AgentID);
|
||||
if (account != null)
|
||||
{
|
||||
// No, sorry; go away
|
||||
reason = "User identifier not allowed on this grid";
|
||||
m_log.InfoFormat("[GATEKEEPER SERVICE]: Foreign agent {0} {1} has UUID of local user {3}. Refusing service.",
|
||||
aCircuit.firstname, aCircuit.lastname, aCircuit.AgentID);
|
||||
return false;
|
||||
}
|
||||
m_log.DebugFormat("[GATEKEEPER SERVICE]: User ID ok");
|
||||
//if (m_UserAccountService != null && m_HomeUsersSecurityService != null)
|
||||
//{
|
||||
// // Check to see if we have a local user with that UUID
|
||||
// UserAccount account = m_UserAccountService.GetUserAccount(m_ScopeID, aCircuit.AgentID);
|
||||
|
||||
// // See if that user went out of this home grid
|
||||
// IPEndPoint ep = m_HomeUsersSecurityService.GetEndPoint(aCircuit.AgentID);
|
||||
|
||||
// if (account != null)
|
||||
// {
|
||||
// if ((ep == null) || // there's no memory of this agent going out
|
||||
// (ep != null && (ep.Address != aCircuit.ClientEndPoint.Address || ep.Port != aCircuit.ClientEndPoint.Port))) // fake agent
|
||||
// {
|
||||
// // No, sorry; go away
|
||||
// reason = "User identifier not allowed on this grid";
|
||||
// m_log.InfoFormat("[GATEKEEPER SERVICE]: Foreign agent {0} {1} has UUID of local user {2}. Refusing service.",
|
||||
// aCircuit.firstname, aCircuit.lastname, aCircuit.AgentID);
|
||||
// return false;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// }
|
||||
// }
|
||||
// m_log.DebugFormat("[GATEKEEPER SERVICE]: User ID ok");
|
||||
//}
|
||||
|
||||
// May want to authorize
|
||||
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
using OpenMetaverse;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
|
||||
namespace OpenSim.Services.HypergridService
|
||||
{
|
||||
/// <summary>
|
||||
/// This service is for HG1.5 only, to make up for the fact that clients don't
|
||||
/// keep any private information in themselves, and that their 'home service'
|
||||
/// needs to do it for them.
|
||||
/// Once we have better clients, this shouldn't be needed.
|
||||
/// </summary>
|
||||
public class HomeUsersSecurityService : IHomeUsersSecurityService
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
//
|
||||
// This is a persistent storage wannabe for dealing with the
|
||||
// quirks of HG1.5. We don't really want to store this in a table.
|
||||
// But this is the necessary information for securing clients
|
||||
// coming home.
|
||||
//
|
||||
protected static Dictionary<UUID, IPEndPoint> m_ClientEndPoints = new Dictionary<UUID, IPEndPoint>();
|
||||
|
||||
public HomeUsersSecurityService(IConfigSource config)
|
||||
{
|
||||
m_log.DebugFormat("[HOME USERS SECURITY]: Starting...");
|
||||
}
|
||||
|
||||
public void SetEndPoint(UUID sessionID, IPEndPoint ep)
|
||||
{
|
||||
m_log.DebugFormat("[HOME USERS SECURITY]: Set EndPoint {0} for session {1}", ep.ToString(), sessionID);
|
||||
|
||||
lock (m_ClientEndPoints)
|
||||
m_ClientEndPoints[sessionID] = ep;
|
||||
}
|
||||
|
||||
public IPEndPoint GetEndPoint(UUID sessionID)
|
||||
{
|
||||
lock (m_ClientEndPoints)
|
||||
if (m_ClientEndPoints.ContainsKey(sessionID))
|
||||
{
|
||||
m_log.DebugFormat("[HOME USERS SECURITY]: Get EndPoint {0} for session {1}", m_ClientEndPoints[sessionID].ToString(), sessionID);
|
||||
return m_ClientEndPoints[sessionID];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void RemoveEndPoint(UUID sessionID)
|
||||
{
|
||||
m_log.DebugFormat("[HOME USERS SECURITY]: Remove EndPoint for session {0}", sessionID);
|
||||
lock (m_ClientEndPoints)
|
||||
if (m_ClientEndPoints.ContainsKey(sessionID))
|
||||
m_ClientEndPoints.Remove(sessionID);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -26,6 +26,7 @@
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using OpenSim.Framework;
|
||||
|
@ -43,4 +44,14 @@ namespace OpenSim.Services.Interfaces
|
|||
GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// HG1.5 only
|
||||
/// </summary>
|
||||
public interface IHomeUsersSecurityService
|
||||
{
|
||||
void SetEndPoint(UUID sessionID, IPEndPoint ep);
|
||||
IPEndPoint GetEndPoint(UUID sessionID);
|
||||
void RemoveEndPoint(UUID sessionID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ namespace OpenSim.Services.Interfaces
|
|||
GridRegion GetRegionByName(string name);
|
||||
List<GridRegion> GetRegionsByName(string name);
|
||||
List<GridRegion> GetRegionRange(int xmin, int xmax, int ymin, int ymax);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -82,6 +82,9 @@
|
|||
GridService = "OpenSim.Services.GridService.dll:GridService"
|
||||
AuthenticationService = "OpenSim.Services.Connectors.dll:AuthenticationServicesConnector"
|
||||
|
||||
[HGEntityTransferModule]
|
||||
HomeUsersSecurityService = "OpenSim.Services.HypergridService.dll:HomeUsersSecurityService"
|
||||
|
||||
[PresenceService]
|
||||
LocalServiceModule = "OpenSim.Services.PresenceService.dll:PresenceService"
|
||||
|
||||
|
|
Loading…
Reference in New Issue