diff --git a/LaunchServer/source/response/ResponseThread.java b/LaunchServer/source/response/ResponseThread.java index 7983525..6acc120 100644 --- a/LaunchServer/source/response/ResponseThread.java +++ b/LaunchServer/source/response/ResponseThread.java @@ -46,20 +46,22 @@ @Override public void run() { - if (AuthLimiterIPConfig.Instance.getAllowIp().stream().noneMatch(s -> s.equals(ip)) && !server.config.authLimitConfig.blockOnConnect && server.config.authLimit && server.config.authLimitConfig.onlyAllowIp) + if (server.config.authLimit && !server.config.authLimitConfig.blockOnConnect) { - if (!server.serverSocketHandler.logConnections) LogHelper.debug("Blocked connection from %s [Not found in Allow List]", ip); - return; + if (AuthLimiterIPConfig.Instance.getAllowIp().stream().noneMatch(s -> s.equals(ip)) && server.config.authLimitConfig.onlyAllowIp) + { + if (!server.serverSocketHandler.logConnections) LogHelper.debug("Blocked connection from %s [Not found in Allow List]", ip); + return; + } + + if (AuthLimiterIPConfig.Instance.getBlockIp().stream().anyMatch(s -> s.equals(ip)) && server.config.authLimitConfig.useBlockIp) + { + if (!server.serverSocketHandler.logConnections) LogHelper.debug("Blocked connection from %s [Found in Block List]", ip); + return; + } } - else if (AuthLimiterIPConfig.Instance.getBlockIp().stream().anyMatch(s -> s.equals(ip)) && !server.config.authLimitConfig.blockOnConnect && server.config.authLimit && server.config.authLimitConfig.useBlockIp) - { - if (!server.serverSocketHandler.logConnections) LogHelper.debug("Blocked connection from %s [Found in Block List]", ip); - return; - } - else - { - if (!server.serverSocketHandler.logConnections) LogHelper.debug("Connection from %s", ip); - } + + if (!server.serverSocketHandler.logConnections) LogHelper.debug("Connection from %s", ip); // Process connection boolean cancelled = false; diff --git a/LaunchServer/source/response/auth/AuthResponse.java b/LaunchServer/source/response/auth/AuthResponse.java index 5953020..f084348 100644 --- a/LaunchServer/source/response/auth/AuthResponse.java +++ b/LaunchServer/source/response/auth/AuthResponse.java @@ -61,25 +61,32 @@ AuthProviderResult result; try { - if (AuthLimiterIPConfig.Instance.getBlockIp().stream().anyMatch(s -> s.equals(ip)) && !server.config.authLimitConfig.blockOnConnect && server.config.authLimit && server.config.authLimitConfig.useBlockIp) + // Лесенка чтоб ее + if (server.config.authLimit) { - AuthProvider.authError(server.config.authLimitConfig.authBannedString); - return; - } - - if (AuthLimiterIPConfig.Instance.getAllowIp().stream().noneMatch(s -> s.equals(ip)) && !server.config.authLimitConfig.blockOnConnect && server.config.authLimit && server.config.authLimitConfig.onlyAllowIp) - { - AuthProvider.authError(server.config.authLimitConfig.authNotWhitelistString); - return; - } - - if (AuthLimiterIPConfig.Instance.getAllowIp().stream().noneMatch(s -> s.equals(ip)) && server.config.authLimit && server.config.authLimitConfig.useAllowIp) - { - if (server.limiter.isLimit(ip)) + if (AuthLimiterIPConfig.Instance.getBlockIp().stream().anyMatch(s -> s.equals(ip)) && server.config.authLimitConfig.useBlockIp) { - AuthProvider.authError(server.config.authLimitConfig.authRejectString); + AuthProvider.authError(server.config.authLimitConfig.authBannedString); return; } + + if (AuthLimiterIPConfig.Instance.getAllowIp().stream().noneMatch(s -> s.equals(ip))) + { + if (server.config.authLimitConfig.onlyAllowIp) + { + AuthProvider.authError(server.config.authLimitConfig.authNotWhitelistString); + return; + } + + if (server.config.authLimitConfig.useAllowIp) + { + if (server.limiter.isLimit(ip)) + { + AuthProvider.authError(server.config.authLimitConfig.authRejectString); + return; + } + } + } } result = server.config.authProvider.auth(login, password, ip); diff --git a/buildnumber b/buildnumber index 9453ffe..81de09f 100644 --- a/buildnumber +++ b/buildnumber @@ -1 +1 @@ -567, 20.07.2021 \ No newline at end of file +570, 29.10.2021 \ No newline at end of file