From 6e3f934c4bc15ade3c2c0d0829a618e552e33b3b Mon Sep 17 00:00:00 2001 From: Vincent Sylvester Date: Tue, 24 Apr 2018 20:57:38 +0200 Subject: Add mac banning Signed-off-by: UbitUmarov --- OpenSim/Services/HypergridService/GatekeeperService.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'OpenSim/Services/HypergridService/GatekeeperService.cs') diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 5c6abd2..019bab8 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -62,6 +62,7 @@ namespace OpenSim.Services.HypergridService private static string m_AllowedClients = string.Empty; private static string m_DeniedClients = string.Empty; + private static string m_DeniedMacs = string.Empty; private static bool m_ForeignAgentsAllowed = true; private static List m_ForeignsAllowedExceptions = new List(); private static List m_ForeignsDisallowedExceptions = new List(); @@ -137,6 +138,8 @@ namespace OpenSim.Services.HypergridService config, "AllowedClients", possibleAccessControlConfigSections, string.Empty); m_DeniedClients = Util.GetConfigVarFromSections( config, "DeniedClients", possibleAccessControlConfigSections, string.Empty); + m_DeniedMacs = Util.GetConfigVarFromSections( + config, "DeniedMacs", possibleAccessControlConfigSections, string.Empty); m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true); LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_ForeignsAllowedExceptions); @@ -275,6 +278,8 @@ namespace OpenSim.Services.HypergridService (source == null) ? "Unknown" : string.Format("{0} ({1}){2}", source.RegionName, source.RegionID, (source.RawServerURI == null) ? "" : " @ " + source.ServerURI)); string curViewer = Util.GetViewerName(aCircuit); + string curMac = aCircuit.Mac.ToString(); + // // Check client @@ -304,6 +309,17 @@ namespace OpenSim.Services.HypergridService return false; } } + + if (m_DeniedMacs != string.Empty) + { + m_log.InfoFormat("[GATEKEEPER SERVICE]: Checking users Mac {0} against list of denied macs {1} ...", curMac, m_DeniedMacs); + if (m_DeniedMacs.Contains(curMac)) + { + reason = "Login failed: client with Mac " + curMac + " is denied"; + m_log.InfoFormat("[GATEKEEPER SERVICE]: Login failed, reason: client with mac {0} is denied", curMac); + return false; + } + } // // Authenticate the user -- cgit v1.1