mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
corrected test cases
This commit is contained in:
parent
c1bbf5295f
commit
e3b65aea7a
11
test/config/fail2ban-jail.cf
Normal file
11
test/config/fail2ban-jail.cf
Normal file
|
@ -0,0 +1,11 @@
|
|||
[DEFAULT]
|
||||
|
||||
# "bantime" is the number of seconds that a host is banned.
|
||||
bantime = 1234
|
||||
|
||||
# A host is banned if it has generated "maxretry" during the last "findtime"
|
||||
# seconds.
|
||||
findtime = 321
|
||||
|
||||
# "maxretry" is the number of failures before a host get banned.
|
||||
maxretry = 2
|
|
@ -367,20 +367,18 @@
|
|||
}
|
||||
|
||||
@test "checking fail2ban: fail2ban-jail.cf overrides" {
|
||||
run docker exec mail_fail2ban /bin/sh -c "fail2ban-client get sshd bantime | grep 10800"; [ "$status" -eq 1 ]
|
||||
run docker exec mail_fail2ban /bin/sh -c "fail2ban-client get postfix bantime | grep 10800"; [ "$status" -eq 1 ]
|
||||
run docker exec mail_fail2ban /bin/sh -c "fail2ban-client get dovecot bantime | grep 10800"; [ "$status" -eq 1 ]
|
||||
run docker exec mail_fail2ban /bin/sh -c "fail2ban-client get postfix-sasl bantime | grep 10800"; [ "$status" -eq 1 ]
|
||||
FILTERS=(sshd postfix dovecot postfix-sasl)
|
||||
|
||||
run docker exec mail_fail2ban /bin/sh -c "fail2ban-client get sshd findtime | grep 600"; [ "$status" -eq 1 ]
|
||||
run docker exec mail_fail2ban /bin/sh -c "fail2ban-client get postfix findtime | grep 600"; [ "$status" -eq 1 ]
|
||||
run docker exec mail_fail2ban /bin/sh -c "fail2ban-client get dovecot findtime | grep 600"; [ "$status" -eq 1 ]
|
||||
run docker exec mail_fail2ban /bin/sh -c "fail2ban-client get postfix-sasl findtime | grep 600"; [ "$status" -eq 1 ]
|
||||
for FILTER in "${arr[@]}"; do
|
||||
run docker exec mail_fail2ban /bin/sh -c "fail2ban-client get $FILTER bantime"
|
||||
[ "$output" = 1234 ]
|
||||
|
||||
run docker exec mail_fail2ban /bin/sh -c "fail2ban-client get sshd maxretry | grep 3"; [ "$status" -eq 1 ]
|
||||
run docker exec mail_fail2ban /bin/sh -c "fail2ban-client get postfix maxretry | grep 3"; [ "$status" -eq 1 ]
|
||||
run docker exec mail_fail2ban /bin/sh -c "fail2ban-client get dovecot maxretry | grep 3"; [ "$status" -eq 1 ]
|
||||
run docker exec mail_fail2ban /bin/sh -c "fail2ban-client get postfix-sasl maxretry | grep 3"; [ "$status" -eq 1 ]
|
||||
run docker exec mail_fail2ban /bin/sh -c "fail2ban-client get $FILTER findtime"
|
||||
[ "$output" = 321 ]
|
||||
|
||||
run docker exec mail_fail2ban /bin/sh -c "fail2ban-client get $FILTER maxretry"
|
||||
[ "$output" = 2 ]
|
||||
done
|
||||
}
|
||||
|
||||
@test "checking fail2ban: ban ip on multiple failed login" {
|
||||
|
|
Loading…
Reference in a new issue