2023-02-06 22:59:01 +00:00
|
|
|
load "${REPOSITORY_ROOT}/test/helper/common"
|
|
|
|
load "${REPOSITORY_ROOT}/test/helper/setup"
|
|
|
|
|
|
|
|
BATS_TEST_NAME_PREFIX='[SASLauthd + RIMAP] '
|
|
|
|
CONTAINER_NAME='dms-test_saslauthd_and_rimap'
|
|
|
|
|
|
|
|
function setup_file() {
|
|
|
|
_init_with_defaults
|
|
|
|
|
|
|
|
local CUSTOM_SETUP_ARGUMENTS=(
|
|
|
|
--env ENABLE_SASLAUTHD=1
|
|
|
|
--env SASLAUTHD_MECH_OPTIONS=127.0.0.1
|
|
|
|
--env SASLAUTHD_MECHANISMS=rimap
|
|
|
|
--env PERMIT_DOCKER=container
|
|
|
|
)
|
2019-08-16 21:32:21 +00:00
|
|
|
|
2023-02-06 22:59:01 +00:00
|
|
|
_common_container_setup 'CUSTOM_SETUP_ARGUMENTS'
|
|
|
|
_wait_for_smtp_port_in_container mail_with_imap
|
2019-08-16 21:32:21 +00:00
|
|
|
}
|
|
|
|
|
2023-02-06 22:59:01 +00:00
|
|
|
function teardown_file() { _default_teardown ; }
|
2019-08-16 21:32:21 +00:00
|
|
|
|
2023-02-06 22:59:01 +00:00
|
|
|
@test '(Dovecot) LDAP RIMAP connection and authentication works' {
|
2024-01-11 09:34:08 +00:00
|
|
|
_nc_wrapper 'auth/imap-auth.txt' '-w 1 0.0.0.0 143'
|
2024-01-03 00:17:54 +00:00
|
|
|
assert_success
|
2019-08-16 21:32:21 +00:00
|
|
|
}
|
|
|
|
|
2023-02-06 22:59:01 +00:00
|
|
|
@test '(SASLauthd) SASL RIMAP authentication works' {
|
|
|
|
_run_in_container testsaslauthd -u 'user1@localhost.localdomain' -p 'mypassword'
|
2019-08-16 21:32:21 +00:00
|
|
|
assert_success
|
|
|
|
}
|
|
|
|
|
2023-02-06 22:59:01 +00:00
|
|
|
@test '(SASLauthd) RIMAP SMTP authentication works' {
|
2024-01-11 09:34:08 +00:00
|
|
|
_send_email --expect-rejection \
|
|
|
|
--auth PLAIN \
|
2024-01-03 00:17:54 +00:00
|
|
|
--auth-user user1@localhost.localdomain \
|
|
|
|
--auth-password mypassword \
|
|
|
|
--quit-after AUTH
|
|
|
|
assert_failure
|
|
|
|
assert_output --partial 'Host did not advertise authentication'
|
2023-02-24 09:44:18 +00:00
|
|
|
|
2024-01-03 00:17:54 +00:00
|
|
|
_send_email \
|
|
|
|
--port 465 \
|
2024-01-11 09:34:08 +00:00
|
|
|
--auth PLAIN \
|
2024-01-03 00:17:54 +00:00
|
|
|
--auth-user user1@localhost.localdomain \
|
|
|
|
--auth-password mypassword \
|
|
|
|
--quit-after AUTH
|
2023-02-23 14:19:39 +00:00
|
|
|
assert_output --partial 'Authentication successful'
|
2023-02-24 09:44:18 +00:00
|
|
|
|
2024-01-03 00:17:54 +00:00
|
|
|
_send_email \
|
|
|
|
--port 587 \
|
2024-01-11 09:34:08 +00:00
|
|
|
--auth PLAIN \
|
2024-01-03 00:17:54 +00:00
|
|
|
--auth-user user1@localhost.localdomain \
|
|
|
|
--auth-password mypassword \
|
|
|
|
--quit-after AUTH
|
2023-02-06 22:59:01 +00:00
|
|
|
assert_output --partial 'Authentication successful'
|
2019-08-16 21:32:21 +00:00
|
|
|
}
|
2022-05-07 22:28:32 +00:00
|
|
|
|
2023-02-06 22:59:01 +00:00
|
|
|
@test '(Dovecot) master account can login' {
|
|
|
|
_run_in_container testsaslauthd -u 'user1@localhost.localdomain*masterusername' -p 'masterpassword'
|
2022-05-07 22:28:32 +00:00
|
|
|
assert_success
|
|
|
|
}
|