author | Alberto Bertogli
<albertito@blitiri.com.ar> 2025-06-07 10:36:09 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2025-06-07 11:08:40 UTC |
parent | e632449fc28ee5c898c4f500a1016c5e0d1a748c |
test/t-11-dovecot/config/{dovecot.conf.in => dovecot.conf-2.3.in} | +0 | -0 |
test/t-11-dovecot/config/dovecot.conf-2.4.in | +48 | -0 |
test/t-11-dovecot/run.sh | +17 | -1 |
diff --git a/test/t-11-dovecot/config/dovecot.conf.in b/test/t-11-dovecot/config/dovecot.conf-2.3.in similarity index 100% rename from test/t-11-dovecot/config/dovecot.conf.in rename to test/t-11-dovecot/config/dovecot.conf-2.3.in diff --git a/test/t-11-dovecot/config/dovecot.conf-2.4.in b/test/t-11-dovecot/config/dovecot.conf-2.4.in new file mode 100644 index 0000000..857525e --- /dev/null +++ b/test/t-11-dovecot/config/dovecot.conf-2.4.in @@ -0,0 +1,48 @@ +dovecot_config_version = 2.4.0 +dovecot_storage_version = 2.4.0 + +base_dir = $ROOT/run/ +state_dir = $ROOT/lib/ +log_path = $ROOT/dovecot.log +ssl = no + +default_internal_user = $USER +default_internal_group = $USER +default_login_user = $USER + + +# Disable authentication penalty, since we intentionally make failed requests +# and it just slows down tests. +auth_failure_delay = 0 + +passdb passwd-file { + passwd_file_path = $ROOT/passwd + + # Before auth checks, rename "u@d" to "u-x". This exercises that chasquid + # handles well the case where the returned user information does not match the + # requested user. + # We drop the domain, to exercise "naked" auth handling. + auth_username_format = "%{user | username}-x" +} + +userdb passwd-file { + passwd_file_path = $ROOT/passwd + + # Same as for passdb applies here. + # Note we can't change the _global_ variant of this setting, because + # that influences the top-level lookups. + auth_username_format = "%{user | username}-x" +} + +service auth { + unix_listener auth { + mode = 0666 + } +} + +# Turn on debugging information, to help troubleshooting issues. +auth_verbose = yes +log_debug = category=auth +auth_debug_passwords = yes +auth_verbose_passwords = yes +mail_debug = yes diff --git a/test/t-11-dovecot/run.sh b/test/t-11-dovecot/run.sh index 7fda6de..72d2cd1 100755 --- a/test/t-11-dovecot/run.sh +++ b/test/t-11-dovecot/run.sh @@ -25,8 +25,24 @@ export ROOT="/tmp/chasquid-dovecot-test" mkdir -p $ROOT $ROOT/run $ROOT/lib rm -f $ROOT/dovecot.log +# Dovecot 2.4 config is not backwards compatible with 2.3. +# Since for now both are popular, we support testing against either. +# TODO: Remove 2.3 support once 2.4 becomes more common. +case "$(dovecot --version | cut -d . -f 1-2)" in +2.3) + DOVE_VER=2.3 + ;; +2.4) + DOVE_VER=2.4 + ;; +*) + skip "unknown dovecot version $(dovecot --version)" + ;; +esac + + GROUP=$(id -g -n) envsubst \ - < config/dovecot.conf.in > $ROOT/dovecot.conf + < config/dovecot.conf-$DOVE_VER.in > $ROOT/dovecot.conf cp -f config/passwd $ROOT/passwd dovecot -F -c $ROOT/dovecot.conf &