Added HEADER_CHECKS configuration option

This commit is contained in:
malware-watch 2019-09-25 17:20:35 +02:00
parent 4d6919e54c
commit 505863ed93
4 changed files with 23 additions and 1 deletions

View file

@ -40,6 +40,7 @@ RUN true && \
COPY supervisord.conf /etc/supervisord.conf
COPY rsyslog.conf /etc/rsyslog.conf
COPY opendkim.conf /etc/opendkim/opendkim.conf
COPY header_checks /etc/header_checks
COPY run.sh /run.sh
COPY opendkim.sh /opendkim.sh
RUN chmod +x /run.sh /opendkim.sh

View file

@ -138,6 +138,10 @@ Example:
docker run --rm --name postfix -e "ALLOWED_SENDER_DOMAINS=example.com example.org" -e "MASQUERADED_DOMAINS=example.com" -p 1587:587 boky/postfix
```
### `HEADER_CHECKS`
Each message header line is compared against a pre-configured list of patterns. When a match is found the corresponding action is executed. Set to a non-empty string (usually "1" or "yes") enable.
## `DKIM`
**This image is equiped with support for DKIM.** If you want to use DKIM you will need to generate DKIM keys yourself.

11
header_checks Normal file
View file

@ -0,0 +1,11 @@
# Sample For Dropping Headers:
#/^Header: IfContains/ IGNORE
/^Received:.*with ESMTPSA/ IGNORE
/^Received:.*with ESMTPS/ IGNORE
/^Received:.*with SMTP/ IGNORE
/^Received:/ IGNORE
/^X-Originating-IP:/ IGNORE
/^X-Mailer:/ IGNORE
/^X-PHP-Originating-Script:/ IGNORE
/^User-Agent:/ IGNORE
/^Mime-Version:/ REPLACE Mime-Version: 1.0

8
run.sh
View file

@ -195,11 +195,17 @@ else
fi
if [ ! -z "$MASQUERADED_DOMAINS" ]; then
echo -en "$notice Setting up address masquerading: ${emphasis}$MASQUERADED_DOMAINS${reset}"
echo -e "$notice Setting up address masquerading: ${emphasis}$MASQUERADED_DOMAINS${reset}"
postconf -e "masquerade_domains = $MASQUERADED_DOMAINS"
postconf -e "local_header_rewrite_clients = static:all"
fi
if [ ! -z "$HEADER_CHECKS" ]; then
echo -e "$notice Setting header_checks"
postconf -e smtp_header_checks="regexp:/etc/header_checks"
fi
DKIM_ENABLED=
if [ -d /etc/opendkim/keys ] && [ ! -z "$(find /etc/opendkim/keys -type f ! -name .)" ]; then
DKIM_ENABLED=", ${emphasis}opendkim${reset}"