docker-postfix/unit-tests/026_postfix_setup_smtpd_sasl_auth.bats
Bojan Čekrlić b358d71454 Fix for #192: Automatically add domains to provided usernames for SASL
So, according to the documentation, usernames must always include a
domain for SASL.

In other words. User cannot be `johhny` but `johhny@example.org`.
Further info can be found on this ticket: https://github.com/bokysan/docker-postfix/issues/192

This commit will automatically append domain if one is not provided in
`SMTPD_SASL_USERS`.
2024-04-16 22:11:34 +02:00

23 lines
540 B
Bash

#!/usr/bin/env bats
load /code/scripts/common.sh
load /code/scripts/common-run.sh
@test "check if SMTPD_SASL_USERS works with and without domain" {
local db_file
local SMTPD_SASL_USERS="hello:world,foo@example.com:bar"
do_postconf -e 'mydomain=example.org'
postfix_setup_smtpd_sasl_auth
postfix check
[[ -f /etc/postfix/sasl/smtpd.conf ]]
[[ -f /etc/sasl2/smtpd.conf ]]
[[ -f /etc/sasldb2 ]] || [[ -f /etc/sasl2/sasldb2 ]]
sasldblistusers2 | grep -qE "^hello@example.org:"
sasldblistusers2 | grep -qE "^foo@example.com:"
}