From 8c101d24dfc48ae20ddf963e51b07b43019930ea Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Tue, 18 Aug 2009 00:23:02 +1000 Subject: * Implementing a bunch of Unimplemented MRM stubs. --- .../Scripting/Minimodule/SOPObjectMaterial.cs | 29 +++++++++++++++++++--- .../Scripting/Minimodule/SPAvatar.cs | 8 ++---- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObjectMaterial.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObjectMaterial.cs index 68f2f52..0cba6af 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObjectMaterial.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObjectMaterial.cs @@ -91,24 +91,45 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule public bool Bright { get { return GetTexface().Fullbright; } - set { throw new System.NotImplementedException(); } + set + { + Primitive.TextureEntry tex = m_parent.Shape.Textures; + Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face); + texface.Fullbright = value; + tex.FaceTextures[m_face] = texface; + m_parent.UpdateTexture(tex); + } } public double Bloom { get { return GetTexface().Glow; } - set { throw new System.NotImplementedException(); } + set + { + Primitive.TextureEntry tex = m_parent.Shape.Textures; + Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face); + texface.Glow = (float) value; + tex.FaceTextures[m_face] = texface; + m_parent.UpdateTexture(tex); + } } public bool Shiny { get { return GetTexface().Shiny != Shininess.None; } - set { throw new System.NotImplementedException(); } + set + { + Primitive.TextureEntry tex = m_parent.Shape.Textures; + Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face); + texface.Shiny = value ? Shininess.High : Shininess.None; + tex.FaceTextures[m_face] = texface; + m_parent.UpdateTexture(tex); + } } public bool BumpMap { - get { throw new System.NotImplementedException(); } + get { return GetTexface().Bump == Bumpiness.None; } set { throw new System.NotImplementedException(); } } } diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs index 4600836..4427426 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs @@ -25,17 +25,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Reflection; using System.Collections; using System.Collections.Generic; - +using System.Security; using OpenMetaverse; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; -using log4net; - namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { class SPAvatar : System.MarshalByRefObject, IAvatar @@ -60,7 +56,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule public string Name { get { return GetSP().Name; } - set { throw new InvalidOperationException("Avatar Names are a read-only property."); } + set { throw new SecurityException("Avatar Names are a read-only property."); } } public UUID GlobalID -- cgit v1.1 From f34e89f385c0edc5677b09060f508edf5c6eeb82 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Mon, 17 Aug 2009 10:28:58 -0400 Subject: * More Test tweaking to get down to the root cause of the test wierdness --- OpenSim/Framework/Tests/AgentCircuitDataTest.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OpenSim/Framework/Tests/AgentCircuitDataTest.cs b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs index 12b9cc1..ecd35c0 100644 --- a/OpenSim/Framework/Tests/AgentCircuitDataTest.cs +++ b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs @@ -325,6 +325,8 @@ namespace OpenSim.Framework.Tests { //spurious litjson errors :P map2 = map; + Assert.That(1==1); + return; } AgentCircuitData Agent2Data = new AgentCircuitData(); -- cgit v1.1 From 30c4aa55e6f18d153f164529a3435e44754c5352 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Tue, 18 Aug 2009 00:58:42 +1000 Subject: Added additional configuration options for MRM Security. See OpenSim.ini.example under the [MRM] section. --- .../Scripting/Minimodule/MRMModule.cs | 30 ++++++++++++++++------ bin/OpenSim.ini.example | 22 ++++++++++++++-- 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs index 9042e0d..bf523dd 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs @@ -211,25 +211,39 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { if (script.StartsWith("//MRM:C#")) { - if (m_scene.GetSceneObjectPart(localID).OwnerID != m_scene.RegionInfo.MasterAvatarAssignedUUID - || - m_scene.GetSceneObjectPart(localID).CreatorID != m_scene.RegionInfo.MasterAvatarAssignedUUID) - return; + if (m_config.GetBoolean("OwnerOnly", true)) + if (m_scene.GetSceneObjectPart(localID).OwnerID != m_scene.RegionInfo.MasterAvatarAssignedUUID + || m_scene.GetSceneObjectPart(localID).CreatorID != m_scene.RegionInfo.MasterAvatarAssignedUUID) + return; script = ConvertMRMKeywords(script); try { - m_log.Info("[MRM] Found C# MRM - Starting in AppDomain with " + m_config.GetString("permissionLevel", "Internet") + "-level security."); + AppDomain target; + if (m_config.GetBoolean("Sandboxed", true)) + { + m_log.Info("[MRM] Found C# MRM - Starting in AppDomain with " + + m_config.GetString("SandboxLevel", "Internet") + "-level security."); - string domainName = UUID.Random().ToString(); - AppDomain target = CreateRestrictedDomain(m_config.GetString("permissionLevel", "Internet"), - domainName); + string domainName = UUID.Random().ToString(); + target = CreateRestrictedDomain(m_config.GetString("SandboxLevel", "Internet"), + domainName); + } + else + { + m_log.Info("[MRM] Found C# MRM - Starting in current AppDomain"); + m_log.Warn( + "[MRM] Security Risk: AppDomain is run in current context. Use only in trusted environments."); + target = AppDomain.CurrentDomain; + } + m_log.Info("[MRM] Unwrapping into target AppDomain"); MRMBase mmb = (MRMBase) target.CreateInstanceFromAndUnwrap( CompileFromDotNetText(script, itemID.ToString()), "OpenSim.MiniModule"); + m_log.Info("[MRM] Initialising MRM Globals"); InitializeMRM(mmb, localID, itemID); m_scripts[itemID] = mmb; diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index a1532c5..166f2c6 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -1163,10 +1163,28 @@ [MRM] - ; Enables the Mini Region Modules Script Engine. WARNING: SECURITY RISK. + ; Enables the Mini Region Modules Script Engine. ; default is false Enabled = false - + + ; Runs MRM in a Security Sandbox + ; WARNING: DISABLING IS A SECURITY RISK. + Sandboxed = true + + ; The level sandbox to use, adjust at your OWN RISK. + ; Valid values are: + ; * FullTrust + ; * SkipVerification + ; * Execution + ; * Nothing + ; * LocalIntranet + ; * Internet + ; * Everything + SandboxLevel = "Internet" + + ; Only allow Region Owners to run MRMs + ; May represent a security risk if you disable this. + OwnerOnly = true [Hypergrid] ; Keep it false for now. Making it true requires the use of a special client in order to access inventory -- cgit v1.1 From eb78ac343e68d36a84fdc7fec47797233699cccc Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 17 Aug 2009 19:48:32 +0100 Subject: Apply http://opensimulator.org/mantis/view.php?id=3538 Add ability to silence IRC relay of region joins and quits from certain users This is useful for admins who wish to remain hidden, or service bots. Thanks RemedyTomm --- .../OptionalModules/Avatar/Chat/ChannelState.cs | 10 +++++++-- .../OptionalModules/Avatar/Chat/RegionState.cs | 12 +++++++++-- bin/OpenSim.ini.example | 25 +++++++++++++--------- 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs index f03e5fc..b61959f 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs @@ -83,6 +83,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat internal string _accessPassword = String.Empty; internal Regex AccessPasswordRegex = null; + internal List ExcludeList = new List(); internal string AccessPassword { get { return _accessPassword; } @@ -210,8 +211,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat m_log.DebugFormat("[IRC-Channel-{0}] PingDelay : <{1}>", cs.idn, cs.PingDelay); cs.AccessPassword = Substitute(rs, config.GetString("access_password", cs.AccessPassword)); m_log.DebugFormat("[IRC-Channel-{0}] AccessPassword : <{1}>", cs.idn, cs.AccessPassword); - - + string[] excludes = config.GetString("exclude_list", "").Trim().Split(new Char[] { ',' }); + cs.ExcludeList = new List(excludes.Length); + foreach(string name in excludes) + { + cs.ExcludeList.Add(name.Trim().ToLower()); + } + // Fail if fundamental information is still missing if (cs.Server == null || cs.IrcChannel == null || cs.BaseNickname == null || cs.User == null) diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs index 203948e..c49d942 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs @@ -145,7 +145,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat if (enabled && (cs.irc.Enabled) && (cs.irc.Connected) && (cs.ClientReporting)) { m_log.InfoFormat("[IRC-Region {0}]: {1} has left", Region, client.Name); - cs.irc.PrivMsg(cs.NoticeMessageFormat, cs.irc.Nick, Region, String.Format("{0} has left", client.Name)); + //Check if this person is excluded from IRC + if (!cs.ExcludeList.Contains(client.Name.ToLower())) + { + cs.irc.PrivMsg(cs.NoticeMessageFormat, cs.irc.Nick, Region, String.Format("{0} has left", client.Name)); + } } client.OnLogout -= OnClientLoggedOut; client.OnConnectionClosed -= OnClientLoggedOut; @@ -209,7 +213,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat { string clientName = String.Format("{0} {1}", presence.Firstname, presence.Lastname); m_log.DebugFormat("[IRC-Region {0}] {1} has arrived", Region, clientName); - cs.irc.PrivMsg(cs.NoticeMessageFormat, cs.irc.Nick, Region, String.Format("{0} has arrived", clientName)); + //Check if this person is excluded from IRC + if (!cs.ExcludeList.Contains(clientName.ToLower())) + { + cs.irc.PrivMsg(cs.NoticeMessageFormat, cs.irc.Nick, Region, String.Format("{0} has arrived", clientName)); + } } } } diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 166f2c6..9a17c58 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -679,16 +679,21 @@ ;relay_chat = true ;access_password = foobar - ;fallback_region = name of "default" region - ;MSGformat fields : 0=botnick, 1=user, 2=region, 3=message - ; must start with "PRIVMSG {0} : " or irc server will get upset - ;for : : - ;msgformat = "PRIVMSG {0} :<{1} in {2}>: {3}" - ;for : - : - msgformat = "PRIVMSG {0} : {3} - {1} of {2}" - ;for : - from : - ;msgformat = "PRIVMSG {0} : {3} - from {1}" - + ;;fallback_region = name of "default" region + ;;MSGformat fields : 0=botnick, 1=user, 2=region, 3=message + ;; must start with "PRIVMSG {0} : " or irc server will get upset + ;;for : : + ;;msgformat = "PRIVMSG {0} :<{1} in {2}>: {3}" + ;;for : - : + ;msgformat = "PRIVMSG {0} : {3} - {1} of {2}" + ;;for : - from : + ;;msgformat = "PRIVMSG {0} : {3} - from {1}" + + ;; exclude_list allows you to stop the IRC connector from announcing the + ;;arrival and departure of certain users. For example: admins, bots. + + ;exclude_list=User 1,User 2,User 3 + ;[CMS] ;enabled = true -- cgit v1.1 From 4a992388e3ec515ea179fff5cd7ef62bccca411e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 17 Aug 2009 20:02:42 +0100 Subject: Apply http://opensimulator.org/mantis/view.php?id=4016 Make previously hidden cookies available to code Thanks jhurliman --- OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs | 13 +++++++++++++ prebuild.xml | 1 + 2 files changed, 14 insertions(+) diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs index 6214563..c53160f 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs @@ -33,6 +33,7 @@ using System.IO; using System.Net; using System.Reflection; using System.Text; +using System.Web; using HttpServer; using log4net; @@ -72,6 +73,18 @@ namespace OpenSim.Framework.Servers.HttpServer } private string _contentType; + public HttpCookieCollection Cookies + { + get + { + RequestCookies cookies = _request.Cookies; + HttpCookieCollection httpCookies = new HttpCookieCollection(); + foreach (RequestCookie cookie in cookies) + httpCookies.Add(new HttpCookie(cookie.Name, cookie.Value)); + return httpCookies; + } + } + public bool HasEntityBody { get { return _request.ContentLength != 0; } diff --git a/prebuild.xml b/prebuild.xml index 6401ff0..5e44169 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -70,6 +70,7 @@ ../../../../bin/ + -- cgit v1.1 From 0d7bcee5602a536b5d97893fabcac8b2e0db2536 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 17 Aug 2009 20:25:14 +0100 Subject: no-op to poke panda --- OpenSim/Region/Application/OpenSimBase.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index e28bc9a..7bc0b77 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -70,14 +70,14 @@ namespace OpenSim protected bool m_autoCreateClientStack = true; - /// + /// /// The file used to load and save prim backup xml if no filename has been specified - /// + /// protected const string DEFAULT_PRIM_BACKUP_FILENAME = "prim-backup.xml"; - /// + /// /// The file used to load and save an opensimulator archive if no filename has been specified - /// + /// protected const string DEFAULT_OAR_BACKUP_FILENAME = "region.oar"; public ConfigSettings ConfigurationSettings -- cgit v1.1