diff --git a/Makefile b/Makefile index 44762f77..35e7481c 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ run: # Run containers docker run -d --name mail \ -v "`pwd`/test/config":/tmp/docker-mailserver \ - -v "`pwd`/test":/tmp/docker-mailserver-test \ + -v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \ -v "`pwd`/test/onedir":/var/mail-state \ -e ENABLE_CLAMAV=1 \ -e SPOOF_PROTECTION=1 \ @@ -51,7 +51,7 @@ run: sleep 15 docker run -d --name mail_privacy \ -v "`pwd`/test/config":/tmp/docker-mailserver \ - -v "`pwd`/test":/tmp/docker-mailserver-test \ + -v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \ -e ENABLE_CLAMAV=1 \ -e ENABLE_SPAMASSASSIN=1 \ -e SA_TAG=-5.0 \ @@ -68,7 +68,7 @@ run: sleep 15 docker run -d --name mail_pop3 \ -v "`pwd`/test/config":/tmp/docker-mailserver \ - -v "`pwd`/test":/tmp/docker-mailserver-test \ + -v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \ -v "`pwd`/test/config/letsencrypt":/etc/letsencrypt/live \ -e ENABLE_POP3=1 \ -e DMS_DEBUG=0 \ @@ -77,7 +77,7 @@ run: sleep 15 docker run -d --name mail_smtponly \ -v "`pwd`/test/config":/tmp/docker-mailserver \ - -v "`pwd`/test":/tmp/docker-mailserver-test \ + -v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \ -e SMTP_ONLY=1 \ -e PERMIT_DOCKER=network \ -e DMS_DEBUG=0 \ @@ -93,7 +93,7 @@ run: sleep 15 docker run -d --name mail_override_hostname \ -v "`pwd`/test/config":/tmp/docker-mailserver \ - -v "`pwd`/test":/tmp/docker-mailserver-test \ + -v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \ -e PERMIT_DOCKER=network \ -e DMS_DEBUG=0 \ -e ENABLE_SRS=1 \ @@ -103,7 +103,7 @@ run: sleep 15 docker run -d --name mail_domainname \ -v "`pwd`/test/config":/tmp/docker-mailserver \ - -v "`pwd`/test":/tmp/docker-mailserver-test \ + -v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \ -e PERMIT_DOCKER=network \ -e DMS_DEBUG=0 \ -e ENABLE_SRS=1 \ @@ -113,7 +113,7 @@ run: sleep 15 docker run -d --name mail_srs_domainname \ -v "`pwd`/test/config":/tmp/docker-mailserver \ - -v "`pwd`/test":/tmp/docker-mailserver-test \ + -v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \ -e PERMIT_DOCKER=network \ -e DMS_DEBUG=0 \ -e ENABLE_SRS=1 \ @@ -124,7 +124,7 @@ run: sleep 15 docker run -d --name mail_fail2ban \ -v "`pwd`/test/config":/tmp/docker-mailserver \ - -v "`pwd`/test":/tmp/docker-mailserver-test \ + -v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \ -e ENABLE_FAIL2BAN=1 \ -e POSTSCREEN_ACTION=ignore \ --cap-add=NET_ADMIN \ @@ -132,7 +132,7 @@ run: sleep 15 docker run -d --name mail_fetchmail \ -v "`pwd`/test/config":/tmp/docker-mailserver \ - -v "`pwd`/test":/tmp/docker-mailserver-test \ + -v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \ -e ENABLE_FETCHMAIL=1 \ --cap-add=NET_ADMIN \ -e DMS_DEBUG=0 \ @@ -140,7 +140,7 @@ run: sleep 15 docker run -d --name mail_disabled_clamav_spamassassin \ -v "`pwd`/test/config":/tmp/docker-mailserver \ - -v "`pwd`/test":/tmp/docker-mailserver-test \ + -v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \ -e ENABLE_CLAMAV=0 \ -e ENABLE_SPAMASSASSIN=0 \ -e DMS_DEBUG=0 \ @@ -148,7 +148,7 @@ run: sleep 15 docker run -d --name mail_manual_ssl \ -v "`pwd`/test/config":/tmp/docker-mailserver \ - -v "`pwd`/test":/tmp/docker-mailserver-test \ + -v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \ -e SSL_TYPE=manual \ -e SSL_CERT_PATH=/tmp/docker-mailserver/letsencrypt/mail.my-domain.com/fullchain.pem \ -e SSL_KEY_PATH=/tmp/docker-mailserver/letsencrypt/mail.my-domain.com/privkey.pem \ @@ -161,7 +161,7 @@ run: sleep 15 docker run -d --name mail_with_ldap \ -v "`pwd`/test/config":/tmp/docker-mailserver \ - -v "`pwd`/test":/tmp/docker-mailserver-test \ + -v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \ -e ENABLE_LDAP=1 \ -e LDAP_SERVER_HOST=ldap \ -e LDAP_START_TLS=no \ @@ -190,7 +190,7 @@ run: sleep 15 docker run -d --name mail_with_imap \ -v "`pwd`/test/config":/tmp/docker-mailserver \ - -v "`pwd`/test":/tmp/docker-mailserver-test \ + -v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \ -e ENABLE_SASLAUTHD=1 \ -e SASLAUTHD_MECHANISMS=rimap \ -e SASLAUTHD_MECH_OPTIONS=127.0.0.1 \ @@ -200,7 +200,7 @@ run: sleep 15 docker run -d --name mail_postscreen \ -v "`pwd`/test/config":/tmp/docker-mailserver \ - -v "`pwd`/test":/tmp/docker-mailserver-test \ + -v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \ -e POSTSCREEN_ACTION=enforce \ --cap-add=NET_ADMIN \ -h mail.my-domain.com -t $(NAME) @@ -208,7 +208,7 @@ run: docker run -d --name mail_lmtp_ip \ -v "`pwd`/test/config":/tmp/docker-mailserver \ -v "`pwd`/test/config/dovecot-lmtp":/etc/dovecot \ - -v "`pwd`/test":/tmp/docker-mailserver-test \ + -v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \ -e ENABLE_POSTFIX_VIRTUAL_TRANSPORT=1 \ -e POSTFIX_DAGENT=lmtp:127.0.0.1:24 \ -e DMS_DEBUG=0 \ @@ -216,7 +216,7 @@ run: sleep 30 docker run -d --name mail_with_postgrey \ -v "`pwd`/test/config":/tmp/docker-mailserver \ - -v "`pwd`/test":/tmp/docker-mailserver-test \ + -v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \ -e ENABLE_POSTGREY=1 \ -e POSTGREY_DELAY=15 \ -e POSTGREY_MAX_AGE=35 \ @@ -227,14 +227,14 @@ run: sleep 20 docker run -d --name mail_undef_spam_subject \ -v "`pwd`/test/config":/tmp/docker-mailserver \ - -v "`pwd`/test":/tmp/docker-mailserver-test \ + -v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \ -e ENABLE_SPAMASSASSIN=1 \ -e SA_SPAM_SUBJECT="undef" \ -h mail.my-domain.com -t $(NAME) sleep 15 docker run -d --name mail_with_relays \ -v "`pwd`/test/config/relay-hosts":/tmp/docker-mailserver \ - -v "`pwd`/test":/tmp/docker-mailserver-test \ + -v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \ -e RELAY_HOST=default.relay.com \ -e RELAY_PORT=2525 \ -e RELAY_USER=smtp_user \ @@ -246,7 +246,7 @@ run: sleep 15 docker run -d --name mail_with_default_relay \ -v "`pwd`/test/config/relay-hosts":/tmp/docker-mailserver \ - -v "`pwd`/test":/tmp/docker-mailserver-test \ + -v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \ -e DEFAULT_RELAY_HOST=default.relay.host.invalid:25 \ --cap-add=SYS_PTRACE \ -e PERMIT_DOCKER=host \ @@ -329,4 +329,4 @@ clean: sudo rm -rf test/config ;\ mv testconfig.bak test/config ;\ fi - -sudo rm -rf test/onedir test/alias test/relay test/config/dovecot-lmtp/userdb test/config/key* test/config/opendkim/keys/domain.tld/ test/config/opendkim/keys/example.com/ test/config/opendkim/keys/localdomain2.com/ test/config/postfix-aliases.cf test/config/postfix-receive-access.cf test/config/postfix-receive-access.cfe test/config/postfix-send-access.cf test/config/postfix-send-access.cfe test/config/relay-hosts/chksum test/config/relay-hosts/postfix-aliases.cf \ No newline at end of file + -sudo rm -rf test/onedir test/alias test/relay test/config/dovecot-lmtp/userdb test/config/key* test/config/opendkim/keys/domain.tld/ test/config/opendkim/keys/example.com/ test/config/opendkim/keys/localdomain2.com/ test/config/postfix-aliases.cf test/config/postfix-receive-access.cf test/config/postfix-receive-access.cfe test/config/postfix-send-access.cf test/config/postfix-send-access.cfe test/config/relay-hosts/chksum test/config/relay-hosts/postfix-aliases.cf diff --git a/test/auth/added-imap-auth.txt b/test/test-files/auth/added-imap-auth.txt similarity index 100% rename from test/auth/added-imap-auth.txt rename to test/test-files/auth/added-imap-auth.txt diff --git a/test/auth/added-pop3-auth.txt b/test/test-files/auth/added-pop3-auth.txt similarity index 100% rename from test/auth/added-pop3-auth.txt rename to test/test-files/auth/added-pop3-auth.txt diff --git a/test/auth/added-smtp-auth-login-wrong.txt b/test/test-files/auth/added-smtp-auth-login-wrong.txt similarity index 100% rename from test/auth/added-smtp-auth-login-wrong.txt rename to test/test-files/auth/added-smtp-auth-login-wrong.txt diff --git a/test/auth/added-smtp-auth-login.txt b/test/test-files/auth/added-smtp-auth-login.txt similarity index 100% rename from test/auth/added-smtp-auth-login.txt rename to test/test-files/auth/added-smtp-auth-login.txt diff --git a/test/auth/added-smtp-auth-plain-wrong.txt b/test/test-files/auth/added-smtp-auth-plain-wrong.txt similarity index 100% rename from test/auth/added-smtp-auth-plain-wrong.txt rename to test/test-files/auth/added-smtp-auth-plain-wrong.txt diff --git a/test/auth/added-smtp-auth-plain.txt b/test/test-files/auth/added-smtp-auth-plain.txt similarity index 100% rename from test/auth/added-smtp-auth-plain.txt rename to test/test-files/auth/added-smtp-auth-plain.txt diff --git a/test/auth/added-smtp-auth-spoofed-alias.txt b/test/test-files/auth/added-smtp-auth-spoofed-alias.txt similarity index 100% rename from test/auth/added-smtp-auth-spoofed-alias.txt rename to test/test-files/auth/added-smtp-auth-spoofed-alias.txt diff --git a/test/auth/added-smtp-auth-spoofed.txt b/test/test-files/auth/added-smtp-auth-spoofed.txt similarity index 100% rename from test/auth/added-smtp-auth-spoofed.txt rename to test/test-files/auth/added-smtp-auth-spoofed.txt diff --git a/test/auth/imap-auth.txt b/test/test-files/auth/imap-auth.txt similarity index 100% rename from test/auth/imap-auth.txt rename to test/test-files/auth/imap-auth.txt diff --git a/test/auth/imap-ldap-auth.txt b/test/test-files/auth/imap-ldap-auth.txt similarity index 100% rename from test/auth/imap-ldap-auth.txt rename to test/test-files/auth/imap-ldap-auth.txt diff --git a/test/auth/ldap-smtp-auth-spoofed-alias.txt b/test/test-files/auth/ldap-smtp-auth-spoofed-alias.txt similarity index 100% rename from test/auth/ldap-smtp-auth-spoofed-alias.txt rename to test/test-files/auth/ldap-smtp-auth-spoofed-alias.txt diff --git a/test/auth/ldap-smtp-auth-spoofed.txt b/test/test-files/auth/ldap-smtp-auth-spoofed.txt similarity index 100% rename from test/auth/ldap-smtp-auth-spoofed.txt rename to test/test-files/auth/ldap-smtp-auth-spoofed.txt diff --git a/test/auth/pop3-auth.txt b/test/test-files/auth/pop3-auth.txt similarity index 100% rename from test/auth/pop3-auth.txt rename to test/test-files/auth/pop3-auth.txt diff --git a/test/auth/sasl-ldap-smtp-auth.txt b/test/test-files/auth/sasl-ldap-smtp-auth.txt similarity index 100% rename from test/auth/sasl-ldap-smtp-auth.txt rename to test/test-files/auth/sasl-ldap-smtp-auth.txt diff --git a/test/auth/smtp-auth-login-wrong.txt b/test/test-files/auth/smtp-auth-login-wrong.txt similarity index 100% rename from test/auth/smtp-auth-login-wrong.txt rename to test/test-files/auth/smtp-auth-login-wrong.txt diff --git a/test/auth/smtp-auth-login.txt b/test/test-files/auth/smtp-auth-login.txt similarity index 100% rename from test/auth/smtp-auth-login.txt rename to test/test-files/auth/smtp-auth-login.txt diff --git a/test/auth/smtp-auth-plain-wrong.txt b/test/test-files/auth/smtp-auth-plain-wrong.txt similarity index 100% rename from test/auth/smtp-auth-plain-wrong.txt rename to test/test-files/auth/smtp-auth-plain-wrong.txt diff --git a/test/auth/smtp-auth-plain.txt b/test/test-files/auth/smtp-auth-plain.txt similarity index 100% rename from test/auth/smtp-auth-plain.txt rename to test/test-files/auth/smtp-auth-plain.txt diff --git a/test/email-templates/amavis-spam.txt b/test/test-files/email-templates/amavis-spam.txt similarity index 100% rename from test/email-templates/amavis-spam.txt rename to test/test-files/email-templates/amavis-spam.txt diff --git a/test/email-templates/amavis-virus.txt b/test/test-files/email-templates/amavis-virus.txt similarity index 100% rename from test/email-templates/amavis-virus.txt rename to test/test-files/email-templates/amavis-virus.txt diff --git a/test/email-templates/existing-added.txt b/test/test-files/email-templates/existing-added.txt similarity index 100% rename from test/email-templates/existing-added.txt rename to test/test-files/email-templates/existing-added.txt diff --git a/test/email-templates/existing-alias-external.txt b/test/test-files/email-templates/existing-alias-external.txt similarity index 100% rename from test/email-templates/existing-alias-external.txt rename to test/test-files/email-templates/existing-alias-external.txt diff --git a/test/email-templates/existing-alias-local.txt b/test/test-files/email-templates/existing-alias-local.txt similarity index 100% rename from test/email-templates/existing-alias-local.txt rename to test/test-files/email-templates/existing-alias-local.txt diff --git a/test/email-templates/existing-alias-recipient-delimiter.txt b/test/test-files/email-templates/existing-alias-recipient-delimiter.txt similarity index 100% rename from test/email-templates/existing-alias-recipient-delimiter.txt rename to test/test-files/email-templates/existing-alias-recipient-delimiter.txt diff --git a/test/email-templates/existing-catchall-local.txt b/test/test-files/email-templates/existing-catchall-local.txt similarity index 100% rename from test/email-templates/existing-catchall-local.txt rename to test/test-files/email-templates/existing-catchall-local.txt diff --git a/test/email-templates/existing-regexp-alias-external.txt b/test/test-files/email-templates/existing-regexp-alias-external.txt similarity index 100% rename from test/email-templates/existing-regexp-alias-external.txt rename to test/test-files/email-templates/existing-regexp-alias-external.txt diff --git a/test/email-templates/existing-regexp-alias-local.txt b/test/test-files/email-templates/existing-regexp-alias-local.txt similarity index 100% rename from test/email-templates/existing-regexp-alias-local.txt rename to test/test-files/email-templates/existing-regexp-alias-local.txt diff --git a/test/email-templates/existing-user-and-cc-local-alias.txt b/test/test-files/email-templates/existing-user-and-cc-local-alias.txt similarity index 100% rename from test/email-templates/existing-user-and-cc-local-alias.txt rename to test/test-files/email-templates/existing-user-and-cc-local-alias.txt diff --git a/test/email-templates/existing-user1.txt b/test/test-files/email-templates/existing-user1.txt similarity index 100% rename from test/email-templates/existing-user1.txt rename to test/test-files/email-templates/existing-user1.txt diff --git a/test/email-templates/existing-user2.txt b/test/test-files/email-templates/existing-user2.txt similarity index 100% rename from test/email-templates/existing-user2.txt rename to test/test-files/email-templates/existing-user2.txt diff --git a/test/email-templates/non-existing-user.txt b/test/test-files/email-templates/non-existing-user.txt similarity index 100% rename from test/email-templates/non-existing-user.txt rename to test/test-files/email-templates/non-existing-user.txt diff --git a/test/email-templates/postgrey.txt b/test/test-files/email-templates/postgrey.txt similarity index 100% rename from test/email-templates/postgrey.txt rename to test/test-files/email-templates/postgrey.txt diff --git a/test/email-templates/root-email.txt b/test/test-files/email-templates/root-email.txt similarity index 100% rename from test/email-templates/root-email.txt rename to test/test-files/email-templates/root-email.txt diff --git a/test/email-templates/send-privacy-email.txt b/test/test-files/email-templates/send-privacy-email.txt similarity index 100% rename from test/email-templates/send-privacy-email.txt rename to test/test-files/email-templates/send-privacy-email.txt diff --git a/test/email-templates/sieve-pipe.txt b/test/test-files/email-templates/sieve-pipe.txt similarity index 100% rename from test/email-templates/sieve-pipe.txt rename to test/test-files/email-templates/sieve-pipe.txt diff --git a/test/email-templates/sieve-spam-folder.txt b/test/test-files/email-templates/sieve-spam-folder.txt similarity index 100% rename from test/email-templates/sieve-spam-folder.txt rename to test/test-files/email-templates/sieve-spam-folder.txt diff --git a/test/email-templates/smtp-only.txt b/test/test-files/email-templates/smtp-only.txt similarity index 100% rename from test/email-templates/smtp-only.txt rename to test/test-files/email-templates/smtp-only.txt diff --git a/test/email-templates/test-email.txt b/test/test-files/email-templates/test-email.txt similarity index 100% rename from test/email-templates/test-email.txt rename to test/test-files/email-templates/test-email.txt diff --git a/test/nc_templates/postgrey_whitelist.txt b/test/test-files/nc_templates/postgrey_whitelist.txt similarity index 100% rename from test/nc_templates/postgrey_whitelist.txt rename to test/test-files/nc_templates/postgrey_whitelist.txt diff --git a/test/nc_templates/postgrey_whitelist_local.txt b/test/test-files/nc_templates/postgrey_whitelist_local.txt similarity index 100% rename from test/nc_templates/postgrey_whitelist_local.txt rename to test/test-files/nc_templates/postgrey_whitelist_local.txt diff --git a/test/nc_templates/postgrey_whitelist_recipients.txt b/test/test-files/nc_templates/postgrey_whitelist_recipients.txt similarity index 100% rename from test/nc_templates/postgrey_whitelist_recipients.txt rename to test/test-files/nc_templates/postgrey_whitelist_recipients.txt diff --git a/test/tests.bats b/test/tests.bats index 7ce954d6..803c1b88 100644 --- a/test/tests.bats +++ b/test/tests.bats @@ -880,7 +880,10 @@ load 'test_helper/bats-assert/load' MAIL_FAIL2BAN_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' mail_fail2ban) # Create a container which will send wrong authentications and should get banned - docker run --name fail-auth-mailer -e MAIL_FAIL2BAN_IP=$MAIL_FAIL2BAN_IP -v "$(pwd)/test":/tmp/docker-mailserver-test -d $(docker inspect --format '{{ .Config.Image }}' mail) tail -f /var/log/faillog + docker run --name fail-auth-mailer -e MAIL_FAIL2BAN_IP=$MAIL_FAIL2BAN_IP \ + -v "$(pwd)/test/test-files":/tmp/docker-mailserver-test \ + -d $(docker inspect --format '{{ .Config.Image }}' mail) \ + tail -f /var/log/faillog # can't pipe the file as usual due to postscreen. (respecting postscreen_greet_wait time and talking in turn): for i in {1,2}; do