diff --git a/test/tests/parallel/set1/spam_virus/fail2ban.bats b/test/tests/parallel/set1/spam_virus/fail2ban.bats index f451befd..5088fa1c 100644 --- a/test/tests/parallel/set1/spam_virus/fail2ban.bats +++ b/test/tests/parallel/set1/spam_virus/fail2ban.bats @@ -34,7 +34,7 @@ function teardown_file() { } @test "localhost is not banned because ignored" { - _run_in_container fail2ban-client status postfix-sasl + _run_in_container fail2ban-client status postfix assert_success refute_output --regexp '.*IP list:.*127\.0\.0\.1.*' @@ -49,7 +49,7 @@ function teardown_file() { } @test "fail2ban-jail.cf overrides" { - for FILTER in 'dovecot' 'postfix' 'postfix-sasl'; do + for FILTER in 'dovecot' 'postfix'; do _run_in_container fail2ban-client get "${FILTER}" bantime assert_output 1234 @@ -62,7 +62,6 @@ function teardown_file() { _run_in_container fail2ban-client -d assert_output --partial "['set', 'dovecot', 'addaction', 'nftables-multiport']" assert_output --partial "['set', 'postfix', 'addaction', 'nftables-multiport']" - assert_output --partial "['set', 'postfix-sasl', 'addaction', 'nftables-multiport']" done } @@ -87,12 +86,12 @@ function teardown_file() { # Checking that CONTAINER2_IP is banned in "${CONTAINER1_NAME}" CONTAINER2_IP=$(_get_container_ip "${CONTAINER2_NAME}") - run _repeat_in_container_until_success_or_timeout 10 "${CONTAINER_NAME}" /bin/bash -c "fail2ban-client status postfix-sasl | grep -F '${CONTAINER2_IP}'" + run _repeat_in_container_until_success_or_timeout 10 "${CONTAINER_NAME}" /bin/bash -c "fail2ban-client status postfix | grep -F '${CONTAINER2_IP}'" assert_success assert_output --partial 'Banned IP list:' # Checking that CONTAINER2_IP is banned by nftables - _run_in_container_bash 'nft list set inet f2b-table addr-set-postfix-sasl' + _run_in_container_bash 'nft list set inet f2b-table addr-set-postfix' assert_success assert_output --partial "elements = { ${CONTAINER2_IP} }" } @@ -100,17 +99,13 @@ function teardown_file() { # NOTE: Depends on previous test case, if no IP was banned at this point, it passes regardless.. @test "unban ip works" { CONTAINER2_IP=$(_get_container_ip "${CONTAINER2_NAME}") - _run_in_container fail2ban-client set postfix-sasl unbanip "${CONTAINER2_IP}" + _run_in_container fail2ban-client set postfix unbanip "${CONTAINER2_IP}" assert_success # Checking that CONTAINER2_IP is unbanned in "${CONTAINER1_NAME}" - _run_in_container fail2ban-client status postfix-sasl + _run_in_container fail2ban-client status postfix assert_success refute_output --partial "${CONTAINER2_IP}" - - # Checking that CONTAINER2_IP is unbanned by nftables - _run_in_container_bash 'nft list set inet f2b-table addr-set-postfix-sasl' - refute_output --partial "${CONTAINER2_IP}" } @test "bans work properly (single IP)" { @@ -157,7 +152,7 @@ function teardown_file() { @test "FAIL2BAN_BLOCKTYPE is really set to drop" { # ban IPs here manually so we can be sure something is inside the jails - for JAIL in dovecot postfix-sasl custom; do + for JAIL in dovecot custom; do _run_in_container fail2ban-client set "${JAIL}" banip 192.33.44.55 assert_success done @@ -165,11 +160,10 @@ function teardown_file() { _run_in_container nft list table inet f2b-table assert_success assert_output --partial 'tcp dport { 110, 143, 465, 587, 993, 995, 4190 } ip saddr @addr-set-dovecot drop' - assert_output --partial 'tcp dport { 25, 110, 143, 465, 587, 993, 995 } ip saddr @addr-set-postfix-sasl drop' assert_output --partial 'tcp dport { 25, 110, 143, 465, 587, 993, 995, 4190 } ip saddr @addr-set-custom drop' # unban the IPs previously banned to get a clean state again - for JAIL in dovecot postfix-sasl custom; do + for JAIL in dovecot custom; do _run_in_container fail2ban-client set "${JAIL}" unbanip 192.33.44.55 assert_success done