mirror of
https://github.com/bokysan/docker-postfix.git
synced 2024-09-20 06:46:10 +08:00
Fix for #24 + some new integration tests
This commit is contained in:
parent
ff2d080279
commit
c460941b90
|
@ -24,4 +24,7 @@ services:
|
|||
- "../tester:/code"
|
||||
build:
|
||||
context: ../tester
|
||||
command: "/"
|
||||
command: "/"
|
||||
environment:
|
||||
FROM: "demo@example.org"
|
||||
TO: "test@gmail.com"
|
32
integration-tests/no-dkim-test/docker-compose.yml
Normal file
32
integration-tests/no-dkim-test/docker-compose.yml
Normal file
|
@ -0,0 +1,32 @@
|
|||
version: '3.7'
|
||||
services:
|
||||
postfix_test_587:
|
||||
hostname: "postfix"
|
||||
image: "boky/postfix"
|
||||
build:
|
||||
context: ../..
|
||||
restart: always
|
||||
healthcheck:
|
||||
test: [ "CMD", "sh", "-c", "netstat -an | fgrep 587 | fgrep -q LISTEN" ]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
start_period: 10s
|
||||
retries: 2
|
||||
environment:
|
||||
MASQUERADED_DOMAINS: "postfix"
|
||||
ALLOWED_SENDER_DOMAINS: ""
|
||||
ALLOW_EMPTY_SENDER_DOMAINS: "true"
|
||||
POSTFIX_smtpd_end_of_data_restrictions: "check_client_access static:discard"
|
||||
LOG_FORMAT: "json"
|
||||
tests:
|
||||
image: "boky/postfix-integration-test"
|
||||
restart: "no"
|
||||
volumes:
|
||||
- "../tester:/code"
|
||||
build:
|
||||
context: ../tester
|
||||
command: "/"
|
||||
environment:
|
||||
FROM: "demo@example.org"
|
||||
TO: "test@gmail.com"
|
||||
SKIP_INVALID_DOMAIN_SEND: "1"
|
|
@ -37,3 +37,17 @@ SMTP_DATA="-smtp postfix_test_587 -port 587"
|
|||
attach \
|
||||
-file "/usr/local/bin/mailsend"
|
||||
}
|
||||
|
||||
@test "Send mail from non-supported sender" {
|
||||
if [[ "$SKIP_INVALID_DOMAIN_SEND" == "1" ]]; then
|
||||
skip
|
||||
fi
|
||||
|
||||
if mailsend \
|
||||
-sub "Test email 1" $SMTP_DATA \
|
||||
-from "test@gmail.com" -to "$TO" \
|
||||
body \
|
||||
-msg "Hello world!\nThis is a simple test message!"; then
|
||||
return 1
|
||||
fi
|
||||
}
|
|
@ -166,8 +166,6 @@ postfix_setup_sender_domains() {
|
|||
echo
|
||||
postmap $allowed_senders
|
||||
|
||||
postconf -e "smtpd_restriction_classes=allowed_domains_only"
|
||||
postconf -e "allowed_domains_only=permit_mynetworks, reject_non_fqdn_sender reject"
|
||||
postconf -e "smtpd_recipient_restrictions=reject_non_fqdn_recipient, reject_unknown_recipient_domain, check_sender_access hash:$allowed_senders, reject"
|
||||
|
||||
# Since we are behind closed doors, let's just permit all relays.
|
||||
|
|
Loading…
Reference in a new issue