Improve server control and logging of the DOS blacklist (#10904)
* Log kicks related to DOS bans * unBlacklistDos method Added a method to remove an IP that was blacklisted for being a potential DOS attack. * Added a command to add/remove/list DOS bans * Switched from spaces to a tab in the subnet-ban command Switched from spaces to a tab in the subnet-ban command's listing function. This is better for accessibility and customizability. * Use info(String, Object...) instead of String.format * Fixed formatting to fit style guidelines
This commit is contained in:
@@ -91,6 +91,10 @@ public class Administration{
|
||||
dosBlacklist.add(address);
|
||||
}
|
||||
|
||||
public synchronized void unBlacklistDos(String address){
|
||||
dosBlacklist.remove(address);
|
||||
}
|
||||
|
||||
public synchronized boolean isDosBlacklisted(String address){
|
||||
return dosBlacklist.contains(address);
|
||||
}
|
||||
|
||||
@@ -113,6 +113,8 @@ public class ArcNetProvider implements NetProvider{
|
||||
|
||||
//kill connections above the limit to prevent spam
|
||||
if((playerLimitCache > 0 && server.getConnections().length > playerLimitCache) || netServer.admins.isDosBlacklisted(ip)){
|
||||
Log.info("Closing connection @ - IP marked as a potential DOS attack.", ip);
|
||||
|
||||
connection.close(DcReason.closed);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user