Fixes configurations. (#128)
This commit is contained in:
parent
f336a56364
commit
cf8620d558
12 changed files with 25 additions and 21 deletions
|
|
@ -315,7 +315,7 @@ namespace Server.Accounting
|
|||
public void SetPassword(string plainPassword)
|
||||
{
|
||||
Password = AccountSecurity.CurrentPasswordProtection.EncryptPassword(plainPassword);
|
||||
m_PasswordAlgorithm = AccountSecurity.AlgorithmName;
|
||||
m_PasswordAlgorithm = AccountSecurity.CurrentAlgorithm;
|
||||
}
|
||||
|
||||
public bool CheckPassword(string plainPassword)
|
||||
|
|
@ -327,7 +327,7 @@ namespace Server.Accounting
|
|||
return false;
|
||||
|
||||
// Upgrade the password protection in case we change the algorithm
|
||||
if (m_PasswordAlgorithm != AccountSecurity.AlgorithmName)
|
||||
if (m_PasswordAlgorithm != AccountSecurity.CurrentAlgorithm)
|
||||
SetPassword(plainPassword);
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace Server.Accounting
|
|||
public static bool Enabled;
|
||||
public static void Configure()
|
||||
{
|
||||
Enabled = ServerConfiguration.GetOrUpdateSetting("accountAttackLimiter.enabled", true);
|
||||
Enabled = ServerConfiguration.GetOrUpdateSetting("accountAttackLimiter.enable", true);
|
||||
}
|
||||
|
||||
private static readonly List<InvalidAccountAccessLog> m_List = new List<InvalidAccountAccessLog>();
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ namespace Server.Misc
|
|||
public static void Configure()
|
||||
{
|
||||
MaxAccountsPerIP = ServerConfiguration.GetOrUpdateSetting("accountHandler.maxAccountsPerIP", 1);
|
||||
AutoAccountCreation = ServerConfiguration.GetOrUpdateSetting("accountHandler.autoAccountCreation", true);
|
||||
AutoAccountCreation = ServerConfiguration.GetOrUpdateSetting("accountHandler.enableAutoAccountCreation", true);
|
||||
PasswordCommandEnabled = ServerConfiguration.GetOrUpdateSetting("accountHandler.enablePlayerPasswordCommand", false);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ namespace Server.Misc
|
|||
|
||||
public static void Configure()
|
||||
{
|
||||
Enabled = ServerConfiguration.GetOrUpdateSetting("ipLImiter.enabled", true);
|
||||
SocketBlock = ServerConfiguration.GetOrUpdateSetting("ipLImiter.blockAtConnection", true);
|
||||
Enabled = ServerConfiguration.GetOrUpdateSetting("ipLimiter.enable", true);
|
||||
SocketBlock = ServerConfiguration.GetOrUpdateSetting("ipLimiter.blockAtConnection", true);
|
||||
MaxAddresses = ServerConfiguration.GetOrUpdateSetting("ipLimiter.maxConnectionsPerIP", 10);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,14 +40,17 @@ namespace Server.Accounting.Security
|
|||
public static class AccountSecurity
|
||||
{
|
||||
// TODO: Put it in a configuration
|
||||
public const PasswordProtectionAlgorithm AlgorithmName = PasswordProtectionAlgorithm.Argon2;
|
||||
public static PasswordProtectionAlgorithm CurrentAlgorithm { get; set; }
|
||||
|
||||
public static readonly IPasswordProtection CurrentPasswordProtection = GetPasswordProtection(AlgorithmName);
|
||||
public static readonly IPasswordProtection CurrentPasswordProtection = GetPasswordProtection(CurrentAlgorithm);
|
||||
|
||||
public static void Configure()
|
||||
{
|
||||
if (AlgorithmName < PasswordProtectionAlgorithm.SHA2)
|
||||
throw new Exception($"Security: {AlgorithmName} is obselete and not secure. Do not use it.");
|
||||
CurrentAlgorithm =
|
||||
ServerConfiguration.GetOrUpdateSetting("accountSecurity.encryptionAlgorithm", PasswordProtectionAlgorithm.Argon2);
|
||||
|
||||
if (CurrentAlgorithm < PasswordProtectionAlgorithm.SHA2)
|
||||
throw new Exception($"Security: {CurrentAlgorithm} is obselete and not secure. Do not use it.");
|
||||
}
|
||||
|
||||
public static IPasswordProtection GetPasswordProtection(PasswordProtectionAlgorithm algorithm)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue