tests: update tests associated with Dovecot

Signed-off-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
This commit is contained in:
Georg Lauterbach 2026-03-28 20:38:23 +01:00
parent 158e6b8ea3
commit 4932e4b585
No known key found for this signature in database
8 changed files with 24 additions and 24 deletions

View File

@ -7,7 +7,7 @@ service lmtp {
# Create inet listener only if you can't use the above UNIX socket
# and avoid making LMTP visible for the entire internet
#inet_listener lmtp {
# address = 127.0.0.1
# listen = 127.0.0.1
# port = 24
#}
}

View File

@ -9,7 +9,7 @@ echo "[user-patches.sh] Changing Dovecot LMTP service listener from a unix socke
cat >/etc/dovecot/conf.d/lmtp-master.inc << EOF
service lmtp {
inet_listener lmtp {
address = 127.0.0.1
listen = 127.0.0.1
port = 24
}
}
@ -26,7 +26,7 @@ EOF
# service lmtp {
# inet_listener lmtp {
# address = 127.0.0.1
# listen = 127.0.0.1
# port = 24
# }
# }

View File

@ -12,5 +12,4 @@ echo 'gtube_patterns = "all"' >>/etc/rspamd/local.d/options.inc
# Sieve scripts are executed so Rspamd is trained when using
# `RSPAMD_LEARN=1`.
echo 'mail_debug = yes' >>/etc/dovecot/dovecot.conf
sed -i -E '/^}/d' /etc/dovecot/conf.d/90-sieve.conf
echo -e '\n sieve_trace_debug = yes\n}' >>/etc/dovecot/conf.d/90-sieve.conf
echo 'sieve_trace_debug = yes' >>/etc/dovecot/conf.d/90-sieve.conf

View File

@ -144,9 +144,9 @@ function teardown_file() { _default_teardown ; }
assert_output 4096000
# Quota support:
_run_in_container doveconf -h plugin/quota_rule
_run_in_container doveconf -h quota_storage_size
# Global default storage limit quota for each mailbox 4 MiB:
assert_output '*:storage=4M'
assert_output '4M'
# Sizes are equivalent - Bytes to MiB (rounded):
run numfmt --to=iec --format '%.0f' 4096000
@ -157,7 +157,7 @@ function teardown_file() { _default_teardown ; }
_run_in_container postconf -h message_size_limit
assert_output 2048000
_run_in_container doveconf -h plugin/quota_max_mail_size
_run_in_container doveconf -h quota_mail_size
assert_output '2M'
# Sizes are equivalent - Bytes to MiB (rounded):
@ -198,15 +198,17 @@ function teardown_file() { _default_teardown ; }
run _repeat_until_success_or_timeout 20 _exec_in_container_bash "${CMD_GET_QUOTA} | grep -o 'Type=STORAGE Value=0 Limit=51200'"
assert_success
# Deleting quota resets it to default global quota limit (`plugin/quota_rule`):
# Deleting quota resets it to default global quota limit (`quota_storage_size`):
_run_in_container setup quota del 'user1@localhost.localdomain'
assert_success
run _repeat_until_success_or_timeout 20 _exec_in_container_bash "${CMD_GET_QUOTA} | grep -o 'Type=STORAGE Value=0 Limit=4096'"
assert_success
}
# ! Current problem: 2026-02-15T15:10:04.938804+00:00 mail dovecot: lmtp(quotauser@otherdomain.tld)<1751><50XRNczhkWnXBgAAUi6ngw>: Error: quota-count: quota_warning warn-80: execute unix:/run/dovecot/quota-warning: net_connect_unix(/run/dovecot/quota-warning) failed: Permission denied (euid=5000(docker) egid=5000(docker) missing +r perm: /run/dovecot/quota-warning, dir owned by 0:0 mode=0755)
# TODO needs adjustments in target/dovecot/90-quota.conf
@test 'should receive a warning mail from Dovecot when quota is exceeded' {
# skip 'disabled as it fails randomly: https://github.com/docker-mailserver/docker-mailserver/pull/2511'
skip 'disabled as it does not work currently (quota settings need adjustments)'
# Prepare
_add_mail_account_then_wait_until_ready 'quotauser@otherdomain.tld'

View File

@ -14,10 +14,10 @@ function teardown_file() { _default_teardown ; }
@test "(Dovecot) quota plugin is disabled" {
_run_in_container_bash_and_filter_output 'cat /etc/dovecot/conf.d/10-mail.conf'
refute_output --partial 'quota'
refute_output --partial 'quota = yes'
_run_in_container_bash_and_filter_output 'cat /etc/dovecot/conf.d/20-imap.conf'
refute_output --partial 'imap_quota'
refute_output --partial 'imap_quota = yes'
_run_in_container_bash "[[ -f /etc/dovecot/conf.d/90-quota.conf ]]"
assert_failure

View File

@ -283,7 +283,7 @@ function teardown_file() { _default_teardown ; }
_file_exists_in_container "/usr/lib/dovecot/sieve-pipe/${FILE}"
done
_run_in_container grep 'mail_plugins.*imap_sieve' /etc/dovecot/conf.d/20-imap.conf
_run_in_container grep -F 'imap_sieve = yes' /etc/dovecot/conf.d/20-imap.conf
assert_success
local SIEVE_CONFIG_FILE='/etc/dovecot/conf.d/90-sieve.conf'
_run_in_container grep 'sieve_plugins.*sieve_imapsieve' "${SIEVE_CONFIG_FILE}"

View File

@ -173,9 +173,8 @@ function _should_have_valid_config() {
local LE_CERT_PATH="/etc/letsencrypt/live/${EXPECTED_FQDN}/${3}"
_has_matching_line 'postconf' "smtpd_tls_chain_files = ${LE_KEY_PATH} ${LE_CERT_PATH}"
_has_matching_line 'doveconf' "ssl_cert = <${LE_CERT_PATH}"
# `-P` is required to prevent redacting secrets
_has_matching_line 'doveconf -P' "ssl_key = <${LE_KEY_PATH}"
_has_matching_line 'doveconf ssl_server' " cert_file = ${LE_CERT_PATH}"
_has_matching_line 'doveconf ssl_server' " key_file = ${LE_KEY_PATH}"
}
# CMD ${1} run in container with output checked to match value of ${2}:

View File

@ -59,21 +59,21 @@ function teardown_file() { _default_teardown ; }
assert_success
assert_output "smtpd_tls_chain_files = ${PRIMARY_KEY} ${PRIMARY_CERT} ${FALLBACK_KEY} ${FALLBACK_CERT}"
_run_in_container grep '^ssl_key =' "${DOVECOT_CONFIG_SSL}"
_run_in_container grep '^ssl_server_key_file =' "${DOVECOT_CONFIG_SSL}"
assert_success
assert_output "ssl_key = <${PRIMARY_KEY}"
assert_output "ssl_server_key_file = ${PRIMARY_KEY}"
_run_in_container grep '^ssl_cert =' "${DOVECOT_CONFIG_SSL}"
_run_in_container grep '^ssl_server_cert_file =' "${DOVECOT_CONFIG_SSL}"
assert_success
assert_output "ssl_cert = <${PRIMARY_CERT}"
assert_output "ssl_server_cert_file = ${PRIMARY_CERT}"
_run_in_container grep '^ssl_alt_key =' "${DOVECOT_CONFIG_SSL}"
_run_in_container grep '^ssl_server_alt_key_file =' "${DOVECOT_CONFIG_SSL}"
assert_success
assert_output "ssl_alt_key = <${FALLBACK_KEY}"
assert_output "ssl_server_alt_key_file = ${FALLBACK_KEY}"
_run_in_container grep '^ssl_alt_cert =' "${DOVECOT_CONFIG_SSL}"
_run_in_container grep '^ssl_server_alt_cert_file =' "${DOVECOT_CONFIG_SSL}"
assert_success
assert_output "ssl_alt_cert = <${FALLBACK_CERT}"
assert_output "ssl_server_alt_cert_file = ${FALLBACK_CERT}"
}
@test "manual configuration copied files correctly " {