mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 13:41:21 +00:00
GUACAMOLE-990: Disable tracking if max addresses is not a positive integer.
This commit is contained in:
@@ -22,7 +22,6 @@ package org.apache.guacamole.auth.ban;
|
|||||||
import org.apache.guacamole.auth.ban.status.InMemoryAuthenticationFailureTracker;
|
import org.apache.guacamole.auth.ban.status.InMemoryAuthenticationFailureTracker;
|
||||||
import org.apache.guacamole.auth.ban.status.AuthenticationFailureTracker;
|
import org.apache.guacamole.auth.ban.status.AuthenticationFailureTracker;
|
||||||
import org.apache.guacamole.GuacamoleException;
|
import org.apache.guacamole.GuacamoleException;
|
||||||
import org.apache.guacamole.GuacamoleServerException;
|
|
||||||
import org.apache.guacamole.auth.ban.status.NullAuthenticationFailureTracker;
|
import org.apache.guacamole.auth.ban.status.NullAuthenticationFailureTracker;
|
||||||
import org.apache.guacamole.environment.Environment;
|
import org.apache.guacamole.environment.Environment;
|
||||||
import org.apache.guacamole.environment.LocalEnvironment;
|
import org.apache.guacamole.environment.LocalEnvironment;
|
||||||
@@ -130,12 +129,6 @@ public class BanningAuthenticationProvider extends AbstractAuthenticationProvide
|
|||||||
int banDuration = environment.getProperty(IP_BAN_DURATION, DEFAULT_IP_BAN_DURATION);
|
int banDuration = environment.getProperty(IP_BAN_DURATION, DEFAULT_IP_BAN_DURATION);
|
||||||
long maxAddresses = environment.getProperty(MAX_ADDRESSES, DEFAULT_MAX_ADDRESSES);
|
long maxAddresses = environment.getProperty(MAX_ADDRESSES, DEFAULT_MAX_ADDRESSES);
|
||||||
|
|
||||||
if (maxAddresses <= 0)
|
|
||||||
throw new GuacamoleServerException("The maximum number of "
|
|
||||||
+ "addresses tracked, as specified by the "
|
|
||||||
+ "\"" + MAX_ADDRESSES.getName() + "\" property, must be "
|
|
||||||
+ "greater than zero.");
|
|
||||||
|
|
||||||
// Configure auth failure tracking behavior and inform administrator of
|
// Configure auth failure tracking behavior and inform administrator of
|
||||||
// ultimate result
|
// ultimate result
|
||||||
if (maxAttempts <= 0) {
|
if (maxAttempts <= 0) {
|
||||||
@@ -151,6 +144,12 @@ public class BanningAuthenticationProvider extends AbstractAuthenticationProvide
|
|||||||
+ "of brute-force authentication attempts will be "
|
+ "of brute-force authentication attempts will be "
|
||||||
+ "disabled.", banDuration);
|
+ "disabled.", banDuration);
|
||||||
}
|
}
|
||||||
|
else if (maxAddresses <= 0) {
|
||||||
|
this.tracker = new NullAuthenticationFailureTracker();
|
||||||
|
logger.info("Maximum number of tracked addresses has been set to "
|
||||||
|
+ "{}. Automatic banning of brute-force authentication "
|
||||||
|
+ "attempts will be disabled.", maxAddresses);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
this.tracker = new InMemoryAuthenticationFailureTracker(maxAttempts, banDuration, maxAddresses);
|
this.tracker = new InMemoryAuthenticationFailureTracker(maxAttempts, banDuration, maxAddresses);
|
||||||
logger.info("Addresses will be automatically banned for {} "
|
logger.info("Addresses will be automatically banned for {} "
|
||||||
|
Reference in New Issue
Block a user