Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ __OFFICIAL ENVIRONMENT VARIABLES__

- POSTFIX_RELAY_DOMAINS
- specify certain domains which will be relayed (by default all mails will be forwarded)
- with amavis enabled these domains (and their subdomains) are also amavis' local domains, so incoming mail for them gets spam headers (`X-Spam-*`, subject tag at `AMAVIS_SA_TAG2_LEVEL_DEFLT`)
- POSTFIX_MYDESTINATION
- specify the domains which this mail-gateway handles (I recommend to use only POSTFIX_RELAY_DOMAINS)

Expand Down
12 changes: 12 additions & 0 deletions scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,18 @@ EOF
if [ ! -z ${POSTFIX_RELAY_DOMAINS+x} ]; then
echo ">> POSTFIX set relay_domains = $POSTFIX_RELAY_DOMAINS"
postconf -e "relay_domains=$POSTFIX_RELAY_DOMAINS"

# amavis only treats a recipient as "local" (spam headers, subject tag,
# {RelayedInbound} instead of {RelayedOpenRelay}) if its domain is in
# @local_domains_acl, which Debian defaults to .$mydomain (/etc/mailname)
# only. The relayed domains are exactly the ones this gateway receives
# mail for, so make them local — with subdomains (leading dot).
if [ -z ${DISABLE_AMAVIS+x} ]; then
AMAVIS_LOCAL_DOMAINS=$(echo "$POSTFIX_RELAY_DOMAINS" | tr ', ' '\n\n' | grep . \
| sed 's/^\.//; s/.*/".&"/' | tr '\n' ',' | sed 's/,$//')
echo ">> AMAVIS set @local_domains_acl = ( \".\$mydomain\", $AMAVIS_LOCAL_DOMAINS )"
sed -i '/^1;/i @local_domains_acl = ( ".$mydomain", '"$AMAVIS_LOCAL_DOMAINS"' );' /etc/amavis/conf.d/50-user
fi
fi

if [ -d /etc/postfix/additional/opendkim ]; then
Expand Down
Loading