mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
Merge pull request #104 from Chris54721/relay
Relay support & duplicate DKIM fix
This commit is contained in:
commit
55cfa30491
14
Makefile
14
Makefile
|
@ -9,6 +9,7 @@ build:
|
||||||
run:
|
run:
|
||||||
# Copy test files
|
# Copy test files
|
||||||
cp test/accounts.cf postfix/
|
cp test/accounts.cf postfix/
|
||||||
|
cp test/main.cf postfix/
|
||||||
cp test/virtual postfix/
|
cp test/virtual postfix/
|
||||||
# Run containers
|
# Run containers
|
||||||
docker run -d --name mail \
|
docker run -d --name mail \
|
||||||
|
@ -18,6 +19,7 @@ run:
|
||||||
-e SA_TAG=1.0 \
|
-e SA_TAG=1.0 \
|
||||||
-e SA_TAG2=2.0 \
|
-e SA_TAG2=2.0 \
|
||||||
-e SA_KILL=3.0 \
|
-e SA_KILL=3.0 \
|
||||||
|
-e SASL_PASSWD=testing \
|
||||||
-h mail.my-domain.com -t $(NAME)
|
-h mail.my-domain.com -t $(NAME)
|
||||||
docker run -d --name mail_pop3 \
|
docker run -d --name mail_pop3 \
|
||||||
-v "`pwd`/postfix":/tmp/postfix \
|
-v "`pwd`/postfix":/tmp/postfix \
|
||||||
|
@ -36,11 +38,11 @@ run:
|
||||||
|
|
||||||
fixtures:
|
fixtures:
|
||||||
# Sending test mails
|
# Sending test mails
|
||||||
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/test/email-templates/amavis-spam.txt"
|
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/test/email-templates/amavis-spam.txt"
|
||||||
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/test/email-templates/amavis-virus.txt"
|
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/test/email-templates/amavis-virus.txt"
|
||||||
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/test/email-templates/existing-alias-external.txt"
|
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/test/email-templates/existing-alias-external.txt"
|
||||||
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/test/email-templates/existing-alias-local.txt"
|
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/test/email-templates/existing-alias-local.txt"
|
||||||
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/test/email-templates/existing-user.txt"
|
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/test/email-templates/existing-user.txt"
|
||||||
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/test/email-templates/non-existing-user.txt"
|
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/test/email-templates/non-existing-user.txt"
|
||||||
# Wait for mails to be analyzed
|
# Wait for mails to be analyzed
|
||||||
sleep 10
|
sleep 10
|
||||||
|
@ -51,6 +53,6 @@ tests:
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
# Get default files back
|
# Get default files back
|
||||||
git checkout postfix/accounts.cf postfix/virtual
|
git checkout postfix/accounts.cf postfix/main.cf postfix/virtual
|
||||||
# Remove running test containers
|
# Remove running test containers
|
||||||
docker rm -f mail mail_pop3 mail_smtponly
|
docker rm -f mail mail_pop3 mail_smtponly
|
||||||
|
|
|
@ -97,6 +97,9 @@ Example:
|
||||||
* *6.31* (default) => add 'spam detected' headers at that level
|
* *6.31* (default) => add 'spam detected' headers at that level
|
||||||
* SA_KILL
|
* SA_KILL
|
||||||
* *6.31* (default) => triggers spam evasive actions)
|
* *6.31* (default) => triggers spam evasive actions)
|
||||||
|
* SASL_PASSWORD
|
||||||
|
* *empty* (default) => No sasl_passwd will be created
|
||||||
|
* *string* => A /etc/postfix/sasl_passwd will be created with that content and postmap will be run on it
|
||||||
|
|
||||||
Please read [how the container starts](https://github.com/tomav/docker-mailserver/blob/master/start-mailserver.sh) to understand what's expected.
|
Please read [how the container starts](https://github.com/tomav/docker-mailserver/blob/master/start-mailserver.sh) to understand what's expected.
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,7 @@ smtp-amavis unix - - - - 2 smtp
|
||||||
-o smtp_send_xforward_command=yes
|
-o smtp_send_xforward_command=yes
|
||||||
-o disable_dns_lookups=yes
|
-o disable_dns_lookups=yes
|
||||||
-o max_use=20
|
-o max_use=20
|
||||||
|
-o smtp_tls_security_level=none
|
||||||
|
|
||||||
127.0.0.1:10025 inet n - n - - smtpd
|
127.0.0.1:10025 inet n - n - - smtpd
|
||||||
-o content_filter=
|
-o content_filter=
|
||||||
|
@ -92,3 +93,4 @@ smtp-amavis unix - - - - 2 smtp
|
||||||
-o smtpd_client_connection_count_limit=0
|
-o smtpd_client_connection_count_limit=0
|
||||||
-o smtpd_client_connection_rate_limit=0
|
-o smtpd_client_connection_rate_limit=0
|
||||||
-o receive_override_options=no_header_body_checks,no_unknown_recipient_checks
|
-o receive_override_options=no_header_body_checks,no_unknown_recipient_checks
|
||||||
|
-o smtp_tls_security_level=none
|
||||||
|
|
|
@ -4,6 +4,7 @@ UMask 002
|
||||||
Syslog yes
|
Syslog yes
|
||||||
SyslogSuccess Yes
|
SyslogSuccess Yes
|
||||||
LogWhy Yes
|
LogWhy Yes
|
||||||
|
RemoveOldSignatures Yes
|
||||||
|
|
||||||
Canonicalization relaxed/simple
|
Canonicalization relaxed/simple
|
||||||
|
|
||||||
|
@ -18,4 +19,4 @@ SignatureAlgorithm rsa-sha256
|
||||||
|
|
||||||
UserID opendkim:opendkim
|
UserID opendkim:opendkim
|
||||||
|
|
||||||
Socket inet:12301@localhost
|
Socket inet:12301@localhost
|
||||||
|
|
|
@ -196,6 +196,26 @@ case $DMS_SSL in
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
if [ -f /tmp/postfix/main.cf ]; then
|
||||||
|
while read line; do
|
||||||
|
postconf -e "$line"
|
||||||
|
done < /tmp/postfix/main.cf
|
||||||
|
echo "Loaded '/tmp/postfix/main.cf'"
|
||||||
|
else
|
||||||
|
echo "'/tmp/postfix/main.cf' not provided. No extra postfix settings loaded."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -z "$SASL_PASSWD" ]; then
|
||||||
|
echo "$SASL_PASSWD" > /etc/postfix/sasl_passwd
|
||||||
|
postmap hash:/etc/postfix/sasl_passwd
|
||||||
|
rm /etc/postfix/sasl_passwd
|
||||||
|
chown root:root /etc/postfix/sasl_passwd.db
|
||||||
|
chmod 0600 /etc/postfix/sasl_passwd.db
|
||||||
|
echo "Loaded SASL_PASSWORD"
|
||||||
|
else
|
||||||
|
echo "==> Warning: 'SASL_PASSWORD' is not provided. /etc/postfix/sasl_passwd not created."
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Fixing permissions"
|
echo "Fixing permissions"
|
||||||
chown -R 5000:5000 /var/mail
|
chown -R 5000:5000 /var/mail
|
||||||
mkdir -p /var/log/clamav && chown -R clamav:root /var/log/clamav
|
mkdir -p /var/log/clamav && chown -R clamav:root /var/log/clamav
|
||||||
|
|
2
test/main.cf
Normal file
2
test/main.cf
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
max_idle = 600s
|
||||||
|
readme_directory = /tmp
|
|
@ -105,6 +105,11 @@
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "checking sasl: sasl_passwd.db exists" {
|
||||||
|
run docker exec mail [ -f /etc/postfix/sasl_passwd.db ]
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# smtp
|
# smtp
|
||||||
#
|
#
|
||||||
|
@ -217,6 +222,13 @@
|
||||||
[ "${lines[1]}" = "otherdomain.tld" ]
|
[ "${lines[1]}" = "otherdomain.tld" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "checking postfix: main.cf overrides" {
|
||||||
|
run docker exec mail grep -q 'max_idle = 600s' /tmp/postfix/main.cf
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
run docker exec mail grep -q 'readme_directory = /tmp' /tmp/postfix/main.cf
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# spamassassin
|
# spamassassin
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in a new issue