Skip to content

Commit

Permalink
tests: Use swaks instead of nc for sending mail (#3732)
Browse files Browse the repository at this point in the history
See associated `CHANGELOG.md` entry for details.

---------

Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
  • Loading branch information
georglauterbach and polarathene committed Jan 3, 2024
1 parent 0889b0f commit 9e81517
Show file tree
Hide file tree
Showing 119 changed files with 353 additions and 453 deletions.
6 changes: 3 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*.yml text
### Documentation (Project, Tests, Docs site)
*.md text
### TLS certs (test/test-files/) + DHE params (target/shared/)
### TLS certs (test/files/) + DHE params (target/shared/)
*.pem text
*.pem.sha512sum text

Expand Down Expand Up @@ -90,9 +90,9 @@ TrustedHosts text
whitelist_recipients text

## MISC
### test/config/ + test/test-files/
### test/config/ + test/files/
*.txt text
### test/linting/ (.ecrc.json) + test/test-files/ (*.acme.json):
### test/linting/ (.ecrc.json) + test/files/ (*.acme.json):
*.json text

#################################################
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ All notable changes to this project will be documented in this file. The format

> **Note**: Changes and additions listed here are contained in the `:edge` image tag. These changes may not be as stable as released changes.
### Updates

- The test suite now uses `swaks` instead of `nc`, which has multiple benefits ([#3732](https://github.com/docker-mailserver/docker-mailserver/pull/3732)):
- `swaks` handles pipelining correctly, hence we can now use `reject_unauth_pipelining` in Postfix's configuration.
- `swaks` provides better CLI options that make many files superflous.
- `swaks` can also replace `openssl s_client` and handles authentication on submission ports better.

## [v13.1.0](https://github.com/docker-mailserver/docker-mailserver/releases/tag/v13.1.0)

### Added
Expand Down
2 changes: 1 addition & 1 deletion target/scripts/build/packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function _install_packages() {
# `bind9-dnsutils` provides the `dig` command
# `iputils-ping` provides the `ping` command
DEBUG_PACKAGES=(
bind9-dnsutils iputils-ping less nano
bind9-dnsutils iputils-ping less nano swaks
)

apt-get "${QUIET}" --no-install-recommends install \
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
HELO mail.external.tld
MAIL FROM: spam@external.tld
RCPT TO: user1@localhost.localdomain
DATA
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <user1@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message amavis-spam.txt
Subject: Test Message amavis/spam.txt
This is a test mail.
XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X

.
QUIT
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
HELO mail.external.tld
MAIL FROM: virus@external.tld
RCPT TO: user1@localhost.localdomain
DATA
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <user1@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message amavis-virus.txt
Subject: Test Message amavis/virus.txt

Content-type: multipart/mixed; boundary="emailboundary"
MIME-version: 1.0
Expand All @@ -27,6 +23,3 @@ ACAA/4EAAAAAZWljYXIuY29tUEsFBgAAAAABAAEANwAAAGsAAAAAAA==


--emailboundary--

.
QUIT
Original file line number Diff line number Diff line change
@@ -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>
To: Existing Local User <user1@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message
This is a test mail.

.
QUIT
Original file line number Diff line number Diff line change
@@ -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>
To: Existing Local User <user1@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message
This is a test mail.

.
QUIT
Original file line number Diff line number Diff line change
@@ -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>
To: Existing Local User <some.user@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message
This is a test mail from ldap-smtp-auth-spoofed-alias.txt

.
QUIT
Original file line number Diff line number Diff line change
@@ -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>
To: Existing Local User <some.user@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message
This is a test mail from ldap-smtp-auth-spoofed-sender-with-filter-exception.txt

.
QUIT
Original file line number Diff line number Diff line change
@@ -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>
To: Existing Local User <user1@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message
This is a test mail.

.
QUIT
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
HELO mail.external.tld
MAIL FROM: user@external.tld
RCPT TO: added@localhost.localdomain
DATA
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <added@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message existing-added.txt
This is a test mail.

.
QUIT
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
HELO mail.external.tld
MAIL FROM: user@external.tld
RCPT TO: alias1@localhost.localdomain
DATA
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <alias1@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message existing-alias-external.txt
This is a test mail.

.
QUIT
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
HELO mail.external.tld
MAIL FROM: user@external.tld
RCPT TO: alias2@localhost.localdomain
DATA
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local Alias <alias2@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message existing-alias-local.txt
This is a test mail.

.
QUIT
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
HELO mail.external.tld
MAIL FROM: user@external.tld
RCPT TO: alias1~test@localhost.localdomain
DATA
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local Alias With Delimiter <alias1+test@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message existing-alias-recipient-delimiter.txt
This is a test mail.

.
QUIT
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
HELO mail.external.tld
MAIL FROM: user@external.tld
RCPT TO: wildcard@localdomain2.com
DATA
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <wildcard@localdomain2.com>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message existing-catchall-local.txt
This is a test mail.

.
QUIT
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
HELO mail.external.tld
MAIL FROM: user@external.tld
RCPT TO: bounce-always@localhost.localdomain
DATA
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <bounce-always@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message existing-regexp-alias-external.txt
This is a test mail.

.
QUIT
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
HELO mail.external.tld
MAIL FROM: user@external.tld
RCPT TO: test123@localhost.localdomain
DATA
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <test123@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message existing-regexp-alias-local.txt
This is a test mail.

.
QUIT
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
HELO mail.external.tld
MAIL FROM: user@external.tld
RCPT TO: user1@localhost.localdomain
DATA
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <user1@localhost.localdomain>
Cc: Existing Local Alias <alias2@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message existing-user-and-cc-local-alias.txt
This is a test mail.

.
QUIT
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
HELO mail.external.tld
MAIL FROM: user@external.tld
RCPT TO: user1@localhost.localdomain
DATA
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <user1@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message existing-user1.txt
This is a test mail.

.
QUIT
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
HELO mail.external.tld
MAIL FROM: user@external.tld
RCPT TO: nouser@localhost.localdomain
DATA
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <user1@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message non-existing-user.txt
This is a test mail.

.
QUIT
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
HELO mail.external.tld
MAIL FROM: user@external.tld
RCPT TO: user1@localhost.localdomain
DATA
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <user1@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Postgrey Test Message
This is a test mail.

.
QUIT
5 changes: 5 additions & 0 deletions test/files/emails/postscreen.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
From: Docker Mail Server <user@external.tld>
To: Existing Local User <user1@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message postscreen.txt
This is a test mail for postscreen.
Original file line number Diff line number Diff line change
@@ -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>
To: Some User <user1@localhost.localdomain>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)
Gecko/20100101 Thunderbird/52.2.1
Subject: Test ESMTP Auth LOGIN and remove privacy
This is a test mail.

.
QUIT
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
HELO mail.external.tld
MAIL FROM: user@external.tld
RCPT TO: quotauser@otherdomain.tld
DATA
From: Docker Mail Server <user@external.tld>
To: Existing Local User <quotauser@otherdomain.tld>
Date: Sat, 22 May 2010 07:43:25 -0400
Expand All @@ -20,6 +16,3 @@ Et voluptatum nobis ut odio voluptatem et quibusdam fugit ut libero sapiente vel
Sit sint obcaecati et reiciendis tenetur aut dolorum culpa. Ab veritatis maxime qui necessitatibus facilis eum voluptate asperiores non totam omnis. Nam modi officia in reiciendis odit sit rerum laudantium est rerum voluptatem ut fugit cupiditate! Sit atque sint aut delectus omnis ut asperiores enim quo reprehenderit quae! In quasi nemo ut error totam ut quia harum ut commodi tenetur? Non quod dolorum eum explicabo labore vel asperiores quas est perferendis nulla eum nemo tenetur. Ut libero blanditiis ex voluptatibus repudiandae ab reiciendis nemo id debitis impedit hic quia incidunt sed quam excepturi ut magnam odit. Qui dolor deleniti aut sunt voluptas aut blanditiis distinctio nam omnis deleniti hic omnis rerum eum magni voluptatem. Nam labore facere eum molestiae dolorum ea consectetur praesentium ut cupiditate iste ad magnam aut neque maiores! Et excepturi ducimus ut nemo voluptas eum voluptas nihil hic perferendis quos vel quasi nesciunt est praesentium dolore hic quia quis. Et maxime ducimus ea cupiditate voluptatem ad quia dolores!

Sed quos quaerat vel aperiam minus non sapiente quia ut ratione dolore eum officiis rerum. Non dolor vitae qui facilis dignissimos aut voluptate odit et ullam consequuntur. Et laudantium perspiciatis sit nisi temporibus a temporibus itaque ut iure dolor a voluptatum mollitia eos officia nobis et quibusdam voluptas. Amet eligendi eos nulla corporis et blanditiis nihil vel eveniet veritatis et sunt perferendis id molestiae eius! Quo harum quod aut nemo autem ut adipisci sint sed quia sunt. Aut voluptas error ut quae perferendis eos adipisci internos. Nam rerum fugiat aut minima nostrum quo repellendus quas exercitationem tenetur. Et molestiae architecto id quibusdam reprehenderit et magnam aliquam! Quo tempora veritatis At dolorem sint ex nulla blanditiis At voluptas laudantium est molestiae exercitationem et sequi voluptates aut ipsa atque. Et animi ipsum aut atque recusandae ea nemo ullam non quisquam quos sit libero sint vel libero delectus. Eos labore quidem a velit obcaecati nam explicabo consequatur eos maxime blanditiis? Et ipsam molestiae non quia explicabo ex galisum repudiandae et tempora veniam. Sed optio repellendus ut consequatur temporibus et harum quas hic ipsa officia? Aut dolores ipsum sit nulla dignissimos id quia perferendis aut dolores dolor et quibusdam porro aut Quis consequatur.

.
QUIT
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
HELO mail.external.tld
MAIL FROM: pass@example.test
RCPT TO: user1@localhost.localdomain
DATA
From: Docker Mail Server <pass@example.test>
To: Existing Local User <user1@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message rspamd-pass.txt
Subject: Test Message rspamd/pass.txt
This mail should pass and Rspamd should not mark it.

.
QUIT
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
HELO mail.example.test
MAIL FROM: spam-header@example.test
RCPT TO: user1@localhost.localdomain
DATA
From: Docker Mail Server <spam-header@example.test>
To: Existing Local User <user1@localhost.localdomain>
Date: Sat, 21 Jan 2023 11:11:11 +0000
Subject: Test Message rspamd-spam-header.txt
YJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X

.
QUIT
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
HELO mail.example.test
MAIL FROM: spam@example.test
RCPT TO: user1@localhost.localdomain
DATA
From: Docker Mail Server <spam@example.test>
To: Existing Local User <user1@localhost.localdomain>
Date: Sat, 21 Jan 2023 11:11:11 +0000
Subject: Test Message rspamd-spam.txt
XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X

.
QUIT
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
HELO mail.example.test
MAIL FROM: virus@example.test
RCPT TO: user1@localhost.localdomain
DATA
From: Docker Mail Server <virus@example.test>
To: Existing Local User <user1@localhost.localdomain>
Date: Sat, 21 Jan 2023 11:11:11 +0000
Subject: Test Message rspamd-virus.txt
X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*

.
QUIT
File renamed without changes.
Loading

0 comments on commit 9e81517

Please sign in to comment.