aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDiva Canto2014-05-03 17:13:53 -0700
committerDiva Canto2014-05-03 17:13:53 -0700
commit5a10da3ee89934e366c1d69833b81605dbc35017 (patch)
tree051ee28028598bc8e37e0008bd824cc6689a659b
parentMantis 7144 missing ATTACH_AVATAR_CENTER constant (diff)
downloadopensim-SC_OLD-5a10da3ee89934e366c1d69833b81605dbc35017.zip
opensim-SC_OLD-5a10da3ee89934e366c1d69833b81605dbc35017.tar.gz
opensim-SC_OLD-5a10da3ee89934e366c1d69833b81605dbc35017.tar.bz2
opensim-SC_OLD-5a10da3ee89934e366c1d69833b81605dbc35017.tar.xz
Added a optional key between the group remote connectors, sim and service. This allows for more secure group services, to be used by collections of mutually-trusting grids.
Diffstat (limited to '')
-rw-r--r--OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs8
-rw-r--r--OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs3
-rw-r--r--OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs38
-rw-r--r--bin/OpenSim.ini.example4
4 files changed, 48 insertions, 5 deletions
diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs
index 67402a2..1425a23 100644
--- a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs
+++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs
@@ -44,15 +44,17 @@ namespace OpenSim.Groups
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 45
46 private string m_ServerURI; 46 private string m_ServerURI;
47 private string m_SecretKey;
47 private object m_Lock = new object(); 48 private object m_Lock = new object();
48 49
49 public GroupsServiceRemoteConnector(string url) 50 public GroupsServiceRemoteConnector(string url, string secret)
50 { 51 {
51 m_ServerURI = url; 52 m_ServerURI = url;
52 if (!m_ServerURI.EndsWith("/")) 53 if (!m_ServerURI.EndsWith("/"))
53 m_ServerURI += "/"; 54 m_ServerURI += "/";
54 55
55 m_log.DebugFormat("[Groups.RemoteConnector]: Groups server at {0}", m_ServerURI); 56 m_SecretKey = secret;
57 m_log.DebugFormat("[Groups.RemoteConnector]: Groups server at {0}, secret key {1}", m_ServerURI, m_SecretKey);
56 } 58 }
57 59
58 public ExtendedGroupRecord CreateGroup(string RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, 60 public ExtendedGroupRecord CreateGroup(string RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment,
@@ -654,6 +656,8 @@ namespace OpenSim.Groups
654 private Dictionary<string, object> MakeRequest(string method, Dictionary<string, object> sendData) 656 private Dictionary<string, object> MakeRequest(string method, Dictionary<string, object> sendData)
655 { 657 {
656 sendData["METHOD"] = method; 658 sendData["METHOD"] = method;
659 if (m_SecretKey != string.Empty)
660 sendData["KEY"] = m_SecretKey;
657 661
658 string reply = string.Empty; 662 string reply = string.Empty;
659 lock (m_Lock) 663 lock (m_Lock)
diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs
index d3de0e8..5fb3c19 100644
--- a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs
+++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs
@@ -77,7 +77,8 @@ namespace OpenSim.Groups
77 if (!Uri.IsWellFormedUriString(url, UriKind.Absolute)) 77 if (!Uri.IsWellFormedUriString(url, UriKind.Absolute))
78 throw new Exception(string.Format("[Groups.RemoteConnector]: Malformed groups server URL {0}. Fix it or disable the Groups feature.", url)); 78 throw new Exception(string.Format("[Groups.RemoteConnector]: Malformed groups server URL {0}. Fix it or disable the Groups feature.", url));
79 79
80 m_GroupsService = new GroupsServiceRemoteConnector(url); 80 string secret = groupsConfig.GetString("SecretKey", string.Empty);
81 m_GroupsService = new GroupsServiceRemoteConnector(url, secret);
81 m_Scenes = new List<Scene>(); 82 m_Scenes = new List<Scene>();
82 83
83 } 84 }
diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs
index 616afa9..828965f 100644
--- a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs
+++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs
@@ -52,14 +52,24 @@ namespace OpenSim.Groups
52 public GroupsServiceRobustConnector(IConfigSource config, IHttpServer server, string configName) : 52 public GroupsServiceRobustConnector(IConfigSource config, IHttpServer server, string configName) :
53 base(config, server, configName) 53 base(config, server, configName)
54 { 54 {
55 string key = string.Empty;
55 if (configName != String.Empty) 56 if (configName != String.Empty)
56 m_ConfigName = configName; 57 m_ConfigName = configName;
57 58
58 m_log.DebugFormat("[Groups.RobustConnector]: Starting with config name {0}", m_ConfigName); 59 m_log.DebugFormat("[Groups.RobustConnector]: Starting with config name {0}", m_ConfigName);
59 60
61 IConfig groupsConfig = config.Configs[m_ConfigName];
62 if (groupsConfig != null)
63 {
64 key = groupsConfig.GetString("SecretKey", string.Empty);
65 m_log.DebugFormat("[Groups.RobustConnector]: Starting with secret key {0}", key);
66 }
67 else
68 m_log.WarnFormat("[Groups.RobustConnector]: Unable to find {0} section in configuration", m_ConfigName);
69
60 m_GroupsService = new GroupsService(config); 70 m_GroupsService = new GroupsService(config);
61 71
62 server.AddStreamHandler(new GroupsServicePostHandler(m_GroupsService)); 72 server.AddStreamHandler(new GroupsServicePostHandler(m_GroupsService, key));
63 } 73 }
64 } 74 }
65 75
@@ -68,11 +78,13 @@ namespace OpenSim.Groups
68 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 78 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
69 79
70 private GroupsService m_GroupsService; 80 private GroupsService m_GroupsService;
81 private string m_SecretKey = String.Empty;
71 82
72 public GroupsServicePostHandler(GroupsService service) : 83 public GroupsServicePostHandler(GroupsService service, string key) :
73 base("POST", "/groups") 84 base("POST", "/groups")
74 { 85 {
75 m_GroupsService = service; 86 m_GroupsService = service;
87 m_SecretKey = key;
76 } 88 }
77 89
78 protected override byte[] ProcessRequest(string path, Stream requestData, 90 protected override byte[] ProcessRequest(string path, Stream requestData,
@@ -96,6 +108,20 @@ namespace OpenSim.Groups
96 string method = request["METHOD"].ToString(); 108 string method = request["METHOD"].ToString();
97 request.Remove("METHOD"); 109 request.Remove("METHOD");
98 110
111 if (!String.IsNullOrEmpty(m_SecretKey)) // Verification required
112 {
113 // Sender didn't send key
114 if (!request.ContainsKey("KEY") || (request["KEY"] == null))
115 return FailureResult("This service requires a secret key");
116
117 // Sender sent wrong key
118 if (!m_SecretKey.Equals(request["KEY"]))
119 return FailureResult("Provided key does not match existing one");
120
121 // OK, key matches. Remove it.
122 request.Remove("KEY");
123 }
124
99 m_log.DebugFormat("[Groups.Handler]: {0}", method); 125 m_log.DebugFormat("[Groups.Handler]: {0}", method);
100 switch (method) 126 switch (method)
101 { 127 {
@@ -784,6 +810,14 @@ namespace OpenSim.Groups
784 string xmlString = ServerUtils.BuildXmlResponse(result); 810 string xmlString = ServerUtils.BuildXmlResponse(result);
785 return Util.UTF8NoBomEncoding.GetBytes(xmlString); 811 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
786 } 812 }
813
814 private byte[] FailureResult(string reason)
815 {
816 Dictionary<string, object> result = new Dictionary<string, object>();
817 NullResult(result, reason);
818 string xmlString = ServerUtils.BuildXmlResponse(result);
819 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
820 }
787 #endregion 821 #endregion
788 } 822 }
789} 823}
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index 1395d72..8742313 100644
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -996,6 +996,10 @@
996 ;; Used for V2 in HG only. If standalone, set this to local; if grided sim, set this to remote 996 ;; Used for V2 in HG only. If standalone, set this to local; if grided sim, set this to remote
997 ; LocalService = local 997 ; LocalService = local
998 998
999 ;# {SecretKey} {ServicesConnectorModule:Groups Remote Service Connector} {Secret key between sim and remote group service} {} ""
1000 ;; Used for V2 in Remote only.
1001 ; SecretKey = ""
1002
999 ;# {GroupsServerURI} {Module:GroupsModule (ServicesConnectorModule:Groups Remote Service Connector or (ServicesConnectorModule:Groups HG Service Connector and LocalService:remote))} {Groups Server URI} {} 1003 ;# {GroupsServerURI} {Module:GroupsModule (ServicesConnectorModule:Groups Remote Service Connector or (ServicesConnectorModule:Groups HG Service Connector and LocalService:remote))} {Groups Server URI} {}
1000 ;; URI for the groups services of this grid 1004 ;; URI for the groups services of this grid
1001 ;; e.g. http://yourxmlrpcserver.com/xmlrpc.php for Flotsam XmlRpc 1005 ;; e.g. http://yourxmlrpcserver.com/xmlrpc.php for Flotsam XmlRpc