2022-11-25 22:37:58 +00:00
|
|
|
load "${REPOSITORY_ROOT}/test/test_helper/common"
|
2022-01-03 21:03:46 +00:00
|
|
|
|
|
|
|
CONTAINER="mail_dnsbl_enabled"
|
|
|
|
CONTAINER2="mail_dnsbl_disabled"
|
|
|
|
|
|
|
|
function setup_file() {
|
|
|
|
local PRIVATE_CONFIG
|
2022-05-05 08:28:38 +00:00
|
|
|
PRIVATE_CONFIG=$(duplicate_config_for_container . "${CONTAINER}")
|
2022-01-03 21:03:46 +00:00
|
|
|
|
2022-05-30 00:53:30 +00:00
|
|
|
docker run --rm -d --name "${CONTAINER}" \
|
|
|
|
-v "${PRIVATE_CONFIG}":/tmp/docker-mailserver \
|
|
|
|
-e ENABLE_DNSBL=1 \
|
|
|
|
-h mail.my-domain.com \
|
|
|
|
-t "${NAME}"
|
|
|
|
|
|
|
|
docker run --rm -d --name "${CONTAINER2}" \
|
|
|
|
-v "${PRIVATE_CONFIG}":/tmp/docker-mailserver \
|
|
|
|
-e ENABLE_DNSBL=0 \
|
|
|
|
-h mail.my-domain.com \
|
|
|
|
-t "${NAME}"
|
|
|
|
|
|
|
|
wait_for_smtp_port_in_container "${CONTAINER}"
|
|
|
|
wait_for_smtp_port_in_container "${CONTAINER2}"
|
2022-01-03 21:03:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# ENABLE_DNSBL=1
|
|
|
|
@test "checking enabled postfix DNS block list zen.spamhaus.org" {
|
|
|
|
run docker exec "${CONTAINER}" postconf smtpd_recipient_restrictions
|
|
|
|
assert_output --partial 'reject_rbl_client zen.spamhaus.org'
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "checking enabled postscreen DNS block lists --> postscreen_dnsbl_action" {
|
|
|
|
run docker exec "${CONTAINER}" postconf postscreen_dnsbl_action
|
|
|
|
assert_output 'postscreen_dnsbl_action = enforce'
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "checking enabled postscreen DNS block lists --> postscreen_dnsbl_sites" {
|
|
|
|
run docker exec "${CONTAINER}" postconf postscreen_dnsbl_sites
|
2022-11-07 08:28:47 +00:00
|
|
|
assert_output 'postscreen_dnsbl_sites = zen.spamhaus.org=127.0.0.[2..11]*3 bl.mailspike.net=127.0.0.[2;14;13;12;11;10] b.barracudacentral.org*2 bl.spameatingmonkey.net=127.0.0.2 dnsbl.sorbs.net psbl.surriel.com list.dnswl.org=127.0.[0..255].0*-2 list.dnswl.org=127.0.[0..255].1*-3 list.dnswl.org=127.0.[0..255].[2..3]*-4'
|
2022-01-03 21:03:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# ENABLE_DNSBL=0
|
|
|
|
@test "checking disabled postfix DNS block list zen.spamhaus.org" {
|
|
|
|
run docker exec "${CONTAINER2}" postconf smtpd_recipient_restrictions
|
|
|
|
refute_output --partial 'reject_rbl_client zen.spamhaus.org'
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "checking disabled postscreen DNS block lists --> postscreen_dnsbl_action" {
|
|
|
|
run docker exec "${CONTAINER2}" postconf postscreen_dnsbl_action
|
|
|
|
assert_output 'postscreen_dnsbl_action = ignore'
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "checking disabled postscreen DNS block lists --> postscreen_dnsbl_sites" {
|
|
|
|
run docker exec "${CONTAINER2}" postconf postscreen_dnsbl_sites
|
|
|
|
assert_output 'postscreen_dnsbl_sites ='
|
|
|
|
}
|
|
|
|
|
|
|
|
# cleanup
|
|
|
|
function teardown_file() {
|
|
|
|
docker rm -f "${CONTAINER}" "${CONTAINER2}"
|
|
|
|
}
|