Adds settings (#126)

This commit is contained in:
Kamron Batman 2020-05-02 23:41:30 -07:00 • committed by GitHub
parent 8028a85ffe
commit f336a56364
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 229 additions and 99 deletions

View file

@ -8,7 +8,11 @@ namespace Server.Accounting
{
public class AccountAttackLimiter
{
public static bool Enabled = true;
public static bool Enabled;
public static void Configure()
{
Enabled = ServerConfiguration.GetOrUpdateSetting("accountAttackLimiter.enabled", true);
}
private static readonly List<InvalidAccountAccessLog> m_List = new List<InvalidAccountAccessLog>();

View file

@ -11,10 +11,18 @@ namespace Server.Misc
{
public class AccountHandler
{
private static readonly int MaxAccountsPerIP = 1;
private static readonly bool AutoAccountCreation = true;
private static readonly bool RestrictDeletion = !TestCenter.Enabled;
private static readonly TimeSpan DeleteDelay = TimeSpan.FromDays(7.0);
private static int MaxAccountsPerIP;
private static bool AutoAccountCreation;
private static bool RestrictDeletion = !TestCenter.Enabled;
private static TimeSpan DeleteDelay = TimeSpan.FromDays(7.0);
private static bool PasswordCommandEnabled;
public static void Configure()
{
MaxAccountsPerIP = ServerConfiguration.GetOrUpdateSetting("accountHandler.maxAccountsPerIP", 1);
AutoAccountCreation = ServerConfiguration.GetOrUpdateSetting("accountHandler.autoAccountCreation", true);
PasswordCommandEnabled = ServerConfiguration.GetOrUpdateSetting("accountHandler.enablePlayerPasswordCommand", false);
}
private static readonly CityInfo[] StartingCities =
{
@ -46,8 +54,6 @@ namespace Server.Misc
}
*/
private static readonly bool PasswordCommandEnabled = false;
private static Dictionary<IPAddress, int> m_IPTable;
private static readonly char[] m_ForbiddenChars =

View file

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using System.Net;
using Server.Network;
@ -6,24 +7,23 @@ namespace Server.Misc
{
public class IPLimiter
{
public static bool Enabled = true;
public static bool SocketBlock = true; // true to block at connection, false to block at login request
public static bool Enabled { get; private set; }
public static bool SocketBlock { get; private set; }
public static int MaxAddresses { get; private set; }
public static int MaxAddresses = 10;
public static void Configure()
{
Enabled = ServerConfiguration.GetOrUpdateSetting("ipLImiter.enabled", true);
SocketBlock = ServerConfiguration.GetOrUpdateSetting("ipLImiter.blockAtConnection", true);
MaxAddresses = ServerConfiguration.GetOrUpdateSetting("ipLimiter.maxConnectionsPerIP", 10);
}
public static IPAddress[] Exemptions =
{
// IPAddress.Parse( "127.0.0.1" ),
};
public static bool IsExempt(IPAddress ip)
{
for (int i = 0; i < Exemptions.Length; i++)
if (ip.Equals(Exemptions[i]))
return true;
return false;
}
public static bool IsExempt(IPAddress ip) => Exemptions.Contains(ip);
public static bool Verify(IPAddress ourAddress)
{