Fix conf test (#2243)

This commit is contained in:
Christophe Maudoux 2020-12-20 17:14:33 +01:00
parent 48df4a8807
commit 512045c528
2 changed files with 7 additions and 7 deletions

View File

@ -692,24 +692,24 @@ sub tests {
}
grep { /\d+/ }
split /\s*,\s*/, $conf->{bruteForceProtectionLockTimes};
$conf->{bruteForceProtectionLockTimes} = join ', ', @lockTimes;
$conf->{bruteForceProtectionLockTimes} = join ', ', @lockTimes if scalar @lockTimes;
return 1 unless ( $conf->{bruteForceProtection} );
return ( 1,
return ( 0,
'"History" plugin is required to enable "BruteForceProtection" plugin'
) unless ( $conf->{loginHistoryEnabled} );
return ( 1,
return ( 0,
'Number of failed logins must be higher than 1 to enable "BruteForceProtection" plugin'
) unless ( $conf->{failedLoginNumber} > 1 );
return ( 1,
return ( 0,
'Number of allowed failed logins must be higher than 0 to enable "BruteForceProtection" plugin'
) unless ( $conf->{bruteForceProtectionMaxFailed} > 0 );
return ( 1,
return ( 0,
'Number of failed logins history must be higher or equal than allowed failed logins plus lock time values'
)
if ( $conf->{bruteForceProtectionIncrementalTempo}
&& $conf->{failedLoginNumber} <
$conf->{bruteForceProtectionMaxFailed} + scalar @lockTimes );
return ( 1,
return ( 0,
'Number of failed logins history must be higher or equal than allowed failed logins'
)
unless ( $conf->{failedLoginNumber} >=

View File

@ -47,7 +47,7 @@ sub init {
return 0;
}
unless ( $self->conf->{failedLoginNumber} > $self->maxFailed ) {
unless ( $self->conf->{failedLoginNumber} >= $self->maxFailed ) {
$self->logger->error( 'Number of failed logins history ('
. $self->conf->{failedLoginNumber}
. ') must be higher than allowed failed logins attempt ('