fixed serial tests and openssl invocations
This commit is contained in:
parent
f55de24bbc
commit
9e29a54a5a
|
@ -1,14 +1,5 @@
|
||||||
EHLO mail
|
|
||||||
AUTH LOGIN dXNlcjFAbG9jYWxob3N0LmxvY2FsZG9tYWlu
|
|
||||||
bXlwYXNzd29yZA==
|
|
||||||
MAIL FROM: alias1@localhost.localdomain
|
|
||||||
RCPT TO: user1@localhost.localdomain
|
|
||||||
DATA
|
|
||||||
From: user1_alias <alias1@localhost.localdomain>
|
From: user1_alias <alias1@localhost.localdomain>
|
||||||
To: Existing Local User <user1@localhost.localdomain>
|
To: Existing Local User <user1@localhost.localdomain>
|
||||||
Date: Sat, 22 May 2010 07:43:25 -0400
|
Date: Sat, 22 May 2010 07:43:25 -0400
|
||||||
Subject: Test Message
|
Subject: Test Message
|
||||||
This is a test mail.
|
This is a test mail.
|
||||||
|
|
||||||
.
|
|
||||||
QUIT
|
|
|
@ -1,14 +1,5 @@
|
||||||
EHLO mail
|
|
||||||
AUTH LOGIN YWRkZWRAbG9jYWxob3N0LmxvY2FsZG9tYWlu
|
|
||||||
bXlwYXNzd29yZA==
|
|
||||||
MAIL FROM: user2@localhost.localdomain
|
|
||||||
RCPT TO: user1@localhost.localdomain
|
|
||||||
DATA
|
|
||||||
From: Not_My_Business <user2@localhost.localdomain>
|
From: Not_My_Business <user2@localhost.localdomain>
|
||||||
To: Existing Local User <user1@localhost.localdomain>
|
To: Existing Local User <user1@localhost.localdomain>
|
||||||
Date: Sat, 22 May 2010 07:43:25 -0400
|
Date: Sat, 22 May 2010 07:43:25 -0400
|
||||||
Subject: Test Message
|
Subject: Test Message
|
||||||
This is a test mail.
|
This is a test mail.
|
||||||
|
|
||||||
.
|
|
||||||
QUIT
|
|
|
@ -1,15 +1,5 @@
|
||||||
EHLO mail
|
|
||||||
AUTH LOGIN
|
|
||||||
c29tZS51c2VyQGxvY2FsaG9zdC5sb2NhbGRvbWFpbg==
|
|
||||||
c2VjcmV0
|
|
||||||
MAIL FROM: postmaster@localhost.localdomain
|
|
||||||
RCPT TO: some.user@localhost.localdomain
|
|
||||||
DATA
|
|
||||||
From: alias_address <postmaster@localhost.localdomain>
|
From: alias_address <postmaster@localhost.localdomain>
|
||||||
To: Existing Local User <some.user@localhost.localdomain>
|
To: Existing Local User <some.user@localhost.localdomain>
|
||||||
Date: Sat, 22 May 2010 07:43:25 -0400
|
Date: Sat, 22 May 2010 07:43:25 -0400
|
||||||
Subject: Test Message
|
Subject: Test Message
|
||||||
This is a test mail from ldap-smtp-auth-spoofed-alias.txt
|
This is a test mail from ldap-smtp-auth-spoofed-alias.txt
|
||||||
|
|
||||||
.
|
|
||||||
QUIT
|
|
|
@ -1,15 +1,5 @@
|
||||||
EHLO mail
|
|
||||||
AUTH LOGIN
|
|
||||||
c29tZS51c2VyLmVtYWlsQGxvY2FsaG9zdC5sb2NhbGRvbWFpbgo=
|
|
||||||
c2VjcmV0
|
|
||||||
MAIL FROM: randomspoofedaddress@localhost.localdomain
|
|
||||||
RCPT TO: some.user@localhost.localdomain
|
|
||||||
DATA
|
|
||||||
From: spoofed_address <randomspoofedaddress@localhost.localdomain>
|
From: spoofed_address <randomspoofedaddress@localhost.localdomain>
|
||||||
To: Existing Local User <some.user@localhost.localdomain>
|
To: Existing Local User <some.user@localhost.localdomain>
|
||||||
Date: Sat, 22 May 2010 07:43:25 -0400
|
Date: Sat, 22 May 2010 07:43:25 -0400
|
||||||
Subject: Test Message
|
Subject: Test Message
|
||||||
This is a test mail from ldap-smtp-auth-spoofed-sender-with-filter-exception.txt
|
This is a test mail from ldap-smtp-auth-spoofed-sender-with-filter-exception.txt
|
||||||
|
|
||||||
.
|
|
||||||
QUIT
|
|
|
@ -1,15 +1,5 @@
|
||||||
EHLO mail
|
|
||||||
AUTH LOGIN
|
|
||||||
c29tZS51c2VyQGxvY2FsaG9zdC5sb2NhbGRvbWFpbg==
|
|
||||||
c2VjcmV0
|
|
||||||
MAIL FROM: ldap@localhost.localdomain
|
|
||||||
RCPT TO: user1@localhost.localdomain
|
|
||||||
DATA
|
|
||||||
From: forged_address <ldap@localhost.localdomain>
|
From: forged_address <ldap@localhost.localdomain>
|
||||||
To: Existing Local User <user1@localhost.localdomain>
|
To: Existing Local User <user1@localhost.localdomain>
|
||||||
Date: Sat, 22 May 2010 07:43:25 -0400
|
Date: Sat, 22 May 2010 07:43:25 -0400
|
||||||
Subject: Test Message
|
Subject: Test Message
|
||||||
This is a test mail.
|
This is a test mail.
|
||||||
|
|
||||||
.
|
|
||||||
QUIT
|
|
|
@ -1,15 +1,6 @@
|
||||||
EHLO mail
|
|
||||||
AUTH LOGIN dXNlcjFAbG9jYWxob3N0LmxvY2FsZG9tYWlu
|
|
||||||
bXlwYXNzd29yZA==
|
|
||||||
mail from: <user1@localhost.localdomain>
|
|
||||||
rcpt to: <user1@localhost.localdomain>
|
|
||||||
data
|
|
||||||
From: Some User <user1@localhost.localdomain>
|
From: Some User <user1@localhost.localdomain>
|
||||||
To: Some User <user1@localhost.localdomain>
|
To: Some User <user1@localhost.localdomain>
|
||||||
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
|
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
|
||||||
Gecko/20100101 Thunderbird/52.2.1
|
Gecko/20100101 Thunderbird/52.2.1
|
||||||
Subject: Test ESMTP Auth LOGIN and remove privacy
|
Subject: Test ESMTP Auth LOGIN and remove privacy
|
||||||
This is a test mail.
|
This is a test mail.
|
||||||
|
|
||||||
.
|
|
||||||
QUIT
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ function teardown_file() { _default_teardown ; }
|
||||||
|
|
||||||
# this test covers https://github.com/docker-mailserver/docker-mailserver/issues/681
|
# this test covers https://github.com/docker-mailserver/docker-mailserver/issues/681
|
||||||
@test "(Postfix) remove privacy details of the sender" {
|
@test "(Postfix) remove privacy details of the sender" {
|
||||||
_run_in_container_bash "openssl s_client -quiet -starttls smtp -connect 0.0.0.0:587 < /tmp/docker-mailserver-test/emails/privacy.txt"
|
_send_email --port 587 -tls --auth LOGIN --auth-user user1@localhost.localdomain --auth-password mypassword 'privacy'
|
||||||
assert_success
|
assert_success
|
||||||
|
|
||||||
_run_until_success_or_timeout 120 _exec_in_container_bash '[[ -d /var/mail/localhost.localdomain/user1/new ]]'
|
_run_until_success_or_timeout 120 _exec_in_container_bash '[[ -d /var/mail/localhost.localdomain/user1/new ]]'
|
||||||
|
|
|
@ -30,13 +30,13 @@ function teardown_file() { _default_teardown ; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@test '(SASLauthd) RIMAP SMTP authentication works' {
|
@test '(SASLauthd) RIMAP SMTP authentication works' {
|
||||||
_send_email 'auth/smtp-auth-login' '-w 5 0.0.0.0 25'
|
_nc_wrapper '/tmp/docker-mailserver-test/auth/smtp-auth-login.txt' '-w 5 0.0.0.0 25'
|
||||||
assert_output --partial 'Error: authentication not enabled'
|
assert_output --partial 'Error: authentication not enabled'
|
||||||
|
|
||||||
_send_email 'auth/smtp-auth-login' '-w 5 0.0.0.0 465'
|
_nc_wrapper '/tmp/docker-mailserver-test/auth/smtp-auth-login.txt' '-w 5 0.0.0.0 465'
|
||||||
assert_output --partial 'Authentication successful'
|
assert_output --partial 'Authentication successful'
|
||||||
|
|
||||||
_send_email 'auth/smtp-auth-login' '-w 5 0.0.0.0 587'
|
_nc_wrapper '/tmp/docker-mailserver-test/auth/smtp-auth-login.txt' '-w 5 0.0.0.0 587'
|
||||||
assert_output --partial 'Authentication successful'
|
assert_output --partial 'Authentication successful'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -327,12 +327,12 @@ function teardown() {
|
||||||
@test "spoofing (with LDAP): rejects sender forging" {
|
@test "spoofing (with LDAP): rejects sender forging" {
|
||||||
_wait_for_smtp_port_in_container_to_respond dms-test_ldap
|
_wait_for_smtp_port_in_container_to_respond dms-test_ldap
|
||||||
|
|
||||||
_run_in_container_bash 'openssl s_client -quiet -connect 0.0.0.0:465 < /tmp/docker-mailserver-test/auth/ldap-smtp-auth-spoofed.txt'
|
_send_email --port 465 -tlsc --auth LOGIN --auth-user some.user@localhost.localdomain --auth-password secret --helo mail --from ldap@localhost.localdomain 'auth/ldap-smtp-auth-spoofed'
|
||||||
assert_output --partial 'Sender address rejected: not owned by user'
|
assert_output --partial 'Sender address rejected: not owned by user'
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "spoofing (with LDAP): accepts sending as alias" {
|
@test "spoofing (with LDAP): accepts sending as alias" {
|
||||||
_run_in_container_bash 'openssl s_client -quiet -connect 0.0.0.0:465 < /tmp/docker-mailserver-test/auth/ldap-smtp-auth-spoofed-alias.txt'
|
_send_email --port 465 -tlsc --auth LOGIN --auth-user some.user@localhost.localdomain --auth-password secret --helo mail --from postmaster@localhost.localdomain --to some.user@localhost.localdomain 'auth/ldap-smtp-auth-spoofed-alias'
|
||||||
assert_output --partial 'End data with'
|
assert_output --partial 'End data with'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,18 +341,21 @@ function teardown() {
|
||||||
# Template used has invalid AUTH: https://github.com/docker-mailserver/docker-mailserver/pull/3006#discussion_r1073321432
|
# Template used has invalid AUTH: https://github.com/docker-mailserver/docker-mailserver/pull/3006#discussion_r1073321432
|
||||||
skip 'TODO: This test seems to have been broken from the start (?)'
|
skip 'TODO: This test seems to have been broken from the start (?)'
|
||||||
|
|
||||||
_run_in_container_bash 'openssl s_client -quiet -connect 0.0.0.0:465 < /tmp/docker-mailserver-test/auth/ldap-smtp-auth-spoofed-sender-with-filter-exception.txt'
|
_send_email --port 465 -tlsc --auth LOGIN --auth-user some.user.email@localhost.localdomain --auth-password secret --helo mail --from randomspoofedaddress@localhost.localdomain --to some.user@localhost.localdomain 'auth/ldap-smtp-auth-spoofed-sender-with-filter-exception'
|
||||||
assert_output --partial 'Sender address rejected: not owned by user'
|
assert_output --partial 'Sender address rejected: not owned by user'
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "saslauthd: ldap smtp authentication" {
|
@test "saslauthd: ldap smtp authentication" {
|
||||||
|
# do not use _send_email here
|
||||||
# Requires ENV `PERMIT_DOCKER=container`
|
# Requires ENV `PERMIT_DOCKER=container`
|
||||||
_send_email 'auth/sasl-ldap-smtp-auth' '-w 5 0.0.0.0 25'
|
_nc_wrapper '/tmp/docker-mailserver-test/auth/sasl-ldap-smtp-auth.txt' '-w 5 0.0.0.0 25'
|
||||||
assert_output --partial 'Error: authentication not enabled'
|
assert_output --partial 'Error: authentication not enabled'
|
||||||
|
|
||||||
|
# do not use _send_email here
|
||||||
_run_in_container_bash 'openssl s_client -quiet -connect 0.0.0.0:465 < /tmp/docker-mailserver-test/auth/sasl-ldap-smtp-auth.txt'
|
_run_in_container_bash 'openssl s_client -quiet -connect 0.0.0.0:465 < /tmp/docker-mailserver-test/auth/sasl-ldap-smtp-auth.txt'
|
||||||
assert_output --partial 'Authentication successful'
|
assert_output --partial 'Authentication successful'
|
||||||
|
|
||||||
|
# do not use _send_email here
|
||||||
_run_in_container_bash 'openssl s_client -quiet -starttls smtp -connect 0.0.0.0:587 < /tmp/docker-mailserver-test/auth/sasl-ldap-smtp-auth.txt'
|
_run_in_container_bash 'openssl s_client -quiet -starttls smtp -connect 0.0.0.0:587 < /tmp/docker-mailserver-test/auth/sasl-ldap-smtp-auth.txt'
|
||||||
assert_output --partial 'Authentication successful'
|
assert_output --partial 'Authentication successful'
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ teardown_file() {
|
||||||
_reload_postfix mail_smtponly_second_network
|
_reload_postfix mail_smtponly_second_network
|
||||||
|
|
||||||
# we should be able to send from the other container on the second network!
|
# we should be able to send from the other container on the second network!
|
||||||
run docker exec mail_smtponly_second_network_sender /bin/sh -c "nc mail_smtponly_second_network 25 < /tmp/docker-mailserver-test/emails/smtp-only.txt"
|
run docker exec mail_smtponly_second_network_sender /bin/sh -c "nc mail_smtponly_second_network 25 < /tmp/docker-mailserver-test/emails/nc_raw/smtp-only.txt"
|
||||||
assert_output --partial "250 2.0.0 Ok: queued as "
|
assert_output --partial "250 2.0.0 Ok: queued as "
|
||||||
repeat_in_container_until_success_or_timeout 60 mail_smtponly_second_network /bin/sh -c 'grep -cE "to=<user2\@external.tld>.*status\=sent" /var/log/mail/mail.log'
|
repeat_in_container_until_success_or_timeout 60 mail_smtponly_second_network /bin/sh -c 'grep -cE "to=<user2\@external.tld>.*status\=sent" /var/log/mail/mail.log'
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ teardown_file() {
|
||||||
_reload_postfix mail_smtponly_force_authentication
|
_reload_postfix mail_smtponly_force_authentication
|
||||||
|
|
||||||
# the mailserver should require authentication and a protocol error should occur when using TLS
|
# the mailserver should require authentication and a protocol error should occur when using TLS
|
||||||
run docker exec mail_smtponly_force_authentication /bin/sh -c "nc localhost 25 < /tmp/docker-mailserver-test/emails/smtp-only.txt"
|
run docker exec mail_smtponly_force_authentication /bin/sh -c "nc localhost 25 < /tmp/docker-mailserver-test/emails/nc_raw/smtp-only.txt"
|
||||||
assert_output --partial "550 5.5.1 Protocol error"
|
assert_output --partial "550 5.5.1 Protocol error"
|
||||||
[[ ${status} -ge 0 ]]
|
[[ ${status} -ge 0 ]]
|
||||||
}
|
}
|
||||||
|
|
|
@ -288,13 +288,15 @@ EOF
|
||||||
@test "spoofing: rejects sender forging" {
|
@test "spoofing: rejects sender forging" {
|
||||||
# rejection of spoofed sender
|
# rejection of spoofed sender
|
||||||
_wait_for_smtp_port_in_container_to_respond
|
_wait_for_smtp_port_in_container_to_respond
|
||||||
_run_in_container_bash "openssl s_client -quiet -connect 0.0.0.0:465 < /tmp/docker-mailserver-test/auth/added-smtp-auth-spoofed.txt"
|
|
||||||
|
_send_email --port 465 -tlsc --auth LOGIN --auth-user added@localhost.localdomain --auth-password mypassword --helo mail --from user2@localhost.localdomain 'auth/added-smtp-auth-spoofed'
|
||||||
assert_output --partial 'Sender address rejected: not owned by user'
|
assert_output --partial 'Sender address rejected: not owned by user'
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "spoofing: accepts sending as alias" {
|
@test "spoofing: accepts sending as alias" {
|
||||||
_run_in_container_bash "openssl s_client -quiet -connect 0.0.0.0:465 < /tmp/docker-mailserver-test/auth/added-smtp-auth-spoofed-alias.txt | grep 'End data with'"
|
_send_email --port 465 -tlsc --auth LOGIN --auth-user user1@localhost.localdomain --auth-password mypassword --helo mail --from alias1@localhost.localdomain 'auth/added-smtp-auth-spoofed-alias'
|
||||||
assert_success
|
assert_success
|
||||||
|
assert_output --partial 'End data with'
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -20,7 +20,7 @@ function setup_file() {
|
||||||
function teardown_file() { _default_teardown ; }
|
function teardown_file() { _default_teardown ; }
|
||||||
|
|
||||||
@test 'should successfully deliver mail' {
|
@test 'should successfully deliver mail' {
|
||||||
_send_email 'existing-user1'
|
_send_email 'existing/user1'
|
||||||
_wait_for_empty_mail_queue_in_container
|
_wait_for_empty_mail_queue_in_container
|
||||||
|
|
||||||
# Should be successfully sent (received) by Postfix:
|
# Should be successfully sent (received) by Postfix:
|
||||||
|
|
Loading…
Reference in New Issue