22
22
import org .apache .guacamole .auth .ban .status .InMemoryAuthenticationFailureTracker ;
23
23
import org .apache .guacamole .auth .ban .status .AuthenticationFailureTracker ;
24
24
import org .apache .guacamole .GuacamoleException ;
25
- import org .apache .guacamole .GuacamoleServerException ;
26
25
import org .apache .guacamole .auth .ban .status .NullAuthenticationFailureTracker ;
27
26
import org .apache .guacamole .environment .Environment ;
28
27
import org .apache .guacamole .environment .LocalEnvironment ;
@@ -130,12 +129,6 @@ public BanningAuthenticationProvider() throws GuacamoleException {
130
129
int banDuration = environment .getProperty (IP_BAN_DURATION , DEFAULT_IP_BAN_DURATION );
131
130
long maxAddresses = environment .getProperty (MAX_ADDRESSES , DEFAULT_MAX_ADDRESSES );
132
131
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
-
139
132
// Configure auth failure tracking behavior and inform administrator of
140
133
// ultimate result
141
134
if (maxAttempts <= 0 ) {
@@ -151,6 +144,12 @@ else if (banDuration <= 0) {
151
144
+ "of brute-force authentication attempts will be "
152
145
+ "disabled." , banDuration );
153
146
}
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
+ }
154
153
else {
155
154
this .tracker = new InMemoryAuthenticationFailureTracker (maxAttempts , banDuration , maxAddresses );
156
155
logger .info ("Addresses will be automatically banned for {} "
0 commit comments