Skip to content

Commit 2e5d3f4

Browse files
committed
GUACAMOLE-990: Disable tracking if max addresses is not a positive integer.
1 parent 584db45 commit 2e5d3f4

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

extensions/guacamole-auth-ban/src/main/java/org/apache/guacamole/auth/ban/BanningAuthenticationProvider.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import org.apache.guacamole.auth.ban.status.InMemoryAuthenticationFailureTracker;
2323
import org.apache.guacamole.auth.ban.status.AuthenticationFailureTracker;
2424
import org.apache.guacamole.GuacamoleException;
25-
import org.apache.guacamole.GuacamoleServerException;
2625
import org.apache.guacamole.auth.ban.status.NullAuthenticationFailureTracker;
2726
import org.apache.guacamole.environment.Environment;
2827
import org.apache.guacamole.environment.LocalEnvironment;
@@ -130,12 +129,6 @@ public BanningAuthenticationProvider() throws GuacamoleException {
130129
int banDuration = environment.getProperty(IP_BAN_DURATION, DEFAULT_IP_BAN_DURATION);
131130
long maxAddresses = environment.getProperty(MAX_ADDRESSES, DEFAULT_MAX_ADDRESSES);
132131

133-
if (maxAddresses <= 0)
134-
throw new GuacamoleServerException("The maximum number of "
135-
+ "addresses tracked, as specified by the "
136-
+ "\"" + MAX_ADDRESSES.getName() + "\" property, must be "
137-
+ "greater than zero.");
138-
139132
// Configure auth failure tracking behavior and inform administrator of
140133
// ultimate result
141134
if (maxAttempts <= 0) {
@@ -151,6 +144,12 @@ else if (banDuration <= 0) {
151144
+ "of brute-force authentication attempts will be "
152145
+ "disabled.", banDuration);
153146
}
147+
else if (maxAddresses <= 0) {
148+
this.tracker = new NullAuthenticationFailureTracker();
149+
logger.info("Maximum number of tracked addresses has been set to "
150+
+ "{}. Automatic banning of brute-force authentication "
151+
+ "attempts will be disabled.", maxAddresses);
152+
}
154153
else {
155154
this.tracker = new InMemoryAuthenticationFailureTracker(maxAttempts, banDuration, maxAddresses);
156155
logger.info("Addresses will be automatically banned for {} "

0 commit comments

Comments
 (0)