Addition of loginserver restart schedule configurations.
This commit is contained in:
@@ -102,9 +102,10 @@ IpUpdateTime = 0
|
||||
# Ppimer : 10.1
|
||||
NetworkList = 192.168.;10.0.
|
||||
|
||||
# ===============================================================
|
||||
# Test server configuration, not to switch on the game server! =
|
||||
# ===============================================================
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Test server configuration, not to switch on the game server!
|
||||
# ---------------------------------------------------------------------------
|
||||
# Use the GG client authentication
|
||||
# Login server access let the client without GameGuard
|
||||
ForceGGAuth = False
|
||||
@@ -113,18 +114,33 @@ ForceGGAuth = False
|
||||
# IMPORTANT: Put True for server security.
|
||||
EnableFloodProtection = True
|
||||
|
||||
# =============================================================
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Anti Bruteforce protection. (credits RT-Interlude)
|
||||
# =============================================================
|
||||
#Count of trying connection to server, after which will be made checking IP address
|
||||
#for a possible BrutForce
|
||||
#Reducing this value will increase the likelihood of false positives
|
||||
#Increasing this value will reduce the effectiveness of security (more chance find passwords for large accounts)
|
||||
# ---------------------------------------------------------------------------
|
||||
# Count of trying connection to server, after which will be made checking IP address
|
||||
# for a possible BrutForce
|
||||
# Reducing this value will increase the likelihood of false positives
|
||||
# Increasing this value will reduce the effectiveness of security (more chance find passwords for large accounts)
|
||||
BrutLogonAttempts = 15
|
||||
#The average time (in seconds) between attempts to connect to the server
|
||||
#Reducing this value will increase the likelihood of false positives
|
||||
#Increasing this value will reduce the effectiveness of security (more chance find passwords for large accounts)
|
||||
|
||||
# The average time (in seconds) between attempts to connect to the server
|
||||
# Reducing this value will increase the likelihood of false positives
|
||||
# Increasing this value will reduce the effectiveness of security (more chance find passwords for large accounts)
|
||||
BrutAvgTime = 30
|
||||
#Number of second, for ban IP address, who time BrutAvgTime less specified
|
||||
#900 second = 15 minute
|
||||
|
||||
# Number of second, for ban IP address, who time BrutAvgTime less specified
|
||||
# 900 second = 15 minute
|
||||
BrutBanIpTime = 900
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Scheduled Login Restart
|
||||
# ---------------------------------------------------------------------------
|
||||
# Enable disable scheduled login restart.
|
||||
# Default: False
|
||||
LoginRestartSchedule = False
|
||||
|
||||
# Time in hours.
|
||||
# Default: 24
|
||||
LoginRestartTime = 24
|
||||
|
@@ -134,6 +134,8 @@ public class Config
|
||||
public static int BRUT_AVG_TIME;
|
||||
public static int BRUT_LOGON_ATTEMPTS;
|
||||
public static int BRUT_BAN_IP_TIME;
|
||||
public static boolean LOGIN_SERVER_SCHEDULE_RESTART;
|
||||
public static long LOGIN_SERVER_SCHEDULE_RESTART_TIME;
|
||||
public static int MAX_CHAT_LENGTH;
|
||||
public static boolean TRADE_CHAT_IS_NOOBLE;
|
||||
public static boolean PRECISE_DROP_CALCULATION;
|
||||
@@ -2908,6 +2910,8 @@ public class Config
|
||||
BRUT_AVG_TIME = serverSettings.getInt("BrutAvgTime", 30); // in Seconds
|
||||
BRUT_LOGON_ATTEMPTS = serverSettings.getInt("BrutLogonAttempts", 15);
|
||||
BRUT_BAN_IP_TIME = serverSettings.getInt("BrutBanIpTime", 900); // in Seconds
|
||||
LOGIN_SERVER_SCHEDULE_RESTART = serverSettings.getBoolean("LoginRestartSchedule", false);
|
||||
LOGIN_SERVER_SCHEDULE_RESTART_TIME = serverSettings.getLong("LoginRestartTime", 24);
|
||||
SHOW_LICENCE = serverSettings.getBoolean("ShowLicence", false);
|
||||
IP_UPDATE_TIME = serverSettings.getInt("IpUpdateTime", 15);
|
||||
FORCE_GGAUTH = serverSettings.getBoolean("ForceGGAuth", false);
|
||||
|
@@ -74,12 +74,11 @@ public class LoginClient extends MMOClient<MMOConnection<LoginClient>>
|
||||
{
|
||||
super(con);
|
||||
_state = LoginClientState.CONNECTED;
|
||||
final String ip = getConnection().getInetAddress().getHostAddress();
|
||||
_ip = ip;
|
||||
_ip = getConnection().getInetAddress().getHostAddress();
|
||||
final String[] localip = Config.NETWORK_IP_LIST.split(";");
|
||||
for (String oneIp : localip)
|
||||
{
|
||||
if (ip.startsWith(oneIp) || ip.startsWith("127.0"))
|
||||
if (_ip.startsWith(oneIp) || _ip.startsWith("127.0"))
|
||||
{
|
||||
_usesInternalIP = true;
|
||||
}
|
||||
@@ -92,13 +91,13 @@ public class LoginClient extends MMOClient<MMOConnection<LoginClient>>
|
||||
_loginCrypt = new LoginCrypt();
|
||||
_loginCrypt.setKey(_blowfishKey);
|
||||
LoginController.getInstance().addLoginClient(this);
|
||||
|
||||
// This checkup must go next to BAN because it can cause decrease ban account time
|
||||
if (!BruteProtector.canLogin(ip))
|
||||
if (!BruteProtector.canLogin(_ip))
|
||||
{
|
||||
LoginController.getInstance().addBanForAddress(getConnection().getInetAddress(), Config.BRUT_BAN_IP_TIME * 1000);
|
||||
LOGGER.warning("Drop connection from IP " + ip + " because of BruteForce.");
|
||||
LOGGER.warning("Drop connection from IP " + _ip + " because of BruteForce.");
|
||||
}
|
||||
// Closer.getInstance().add(this);
|
||||
}
|
||||
|
||||
public String getIntetAddress()
|
||||
|
@@ -46,6 +46,7 @@ public class LoginServer
|
||||
|
||||
public static final int PROTOCOL_REV = 0x0102;
|
||||
private static LoginServer INSTANCE;
|
||||
private Thread _restartLoginServer;
|
||||
private GameServerListener _gameServerListener;
|
||||
private SelectorThread<LoginClient> _selectorThread;
|
||||
private TelnetStatusThread _statusServer;
|
||||
@@ -113,6 +114,7 @@ public class LoginServer
|
||||
LOGGER.warning("WARNING: The LoginServer bind address is invalid, using all avaliable IPs " + e1);
|
||||
}
|
||||
}
|
||||
|
||||
// Load telnet status
|
||||
if (Config.IS_TELNET_ENABLED)
|
||||
{
|
||||
@@ -171,11 +173,39 @@ public class LoginServer
|
||||
|
||||
// load bannedIps
|
||||
Config.loadBanFile();
|
||||
|
||||
if (Config.LOGIN_SERVER_SCHEDULE_RESTART)
|
||||
{
|
||||
LOGGER.info("Scheduled LS restart after " + Config.LOGIN_SERVER_SCHEDULE_RESTART_TIME + " hours");
|
||||
_restartLoginServer = new LoginServerRestart();
|
||||
_restartLoginServer.setDaemon(true);
|
||||
_restartLoginServer.start();
|
||||
}
|
||||
}
|
||||
|
||||
public GameServerListener getGameServerListener()
|
||||
class LoginServerRestart extends Thread
|
||||
{
|
||||
return _gameServerListener;
|
||||
public LoginServerRestart()
|
||||
{
|
||||
setName("LoginServerRestart");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
while (!isInterrupted())
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread.sleep(Config.LOGIN_SERVER_SCHEDULE_RESTART_TIME * 3600000);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
return;
|
||||
}
|
||||
shutdown(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void shutdown(boolean restart)
|
||||
@@ -190,6 +220,11 @@ public class LoginServer
|
||||
Runtime.getRuntime().exit(restart ? 2 : 0);
|
||||
}
|
||||
|
||||
public GameServerListener getGameServerListener()
|
||||
{
|
||||
return _gameServerListener;
|
||||
}
|
||||
|
||||
public int getStatus()
|
||||
{
|
||||
return _loginStatus;
|
||||
|
Reference in New Issue
Block a user