From a581bddff965825841d550551d264837a4fbf7b6 Mon Sep 17 00:00:00 2001 From: ret marut Date: Fri, 3 Jun 2016 18:18:47 +0200 Subject: [PATCH] Some extra filters to reply-headers for outbound mail --- .../templates/postfix/plain/smtp_reply_filter | 8 ------- data/templates/postfix/smtp_reply_filter | 24 +++++++++++++++++++ 2 files changed, 24 insertions(+), 8 deletions(-) delete mode 100644 data/templates/postfix/plain/smtp_reply_filter create mode 100644 data/templates/postfix/smtp_reply_filter diff --git a/data/templates/postfix/plain/smtp_reply_filter b/data/templates/postfix/plain/smtp_reply_filter deleted file mode 100644 index 5f15648f1..000000000 --- a/data/templates/postfix/plain/smtp_reply_filter +++ /dev/null @@ -1,8 +0,0 @@ -# Google Mail bounces email sent via IPv6, while this works ok with IPv4. -# -# Convert Google Mail IPv6 complaint permanent error into a temporary error. -# Turn 550 error containing gsmtp in the message into 450 error. -# This way Postfix will attempt to deliver this e-mail using another MX -# (via IPv4). -# -/^5(\d\d )5(.*information. \S+ - gsmtp.*)/ 4${1}4$2 diff --git a/data/templates/postfix/smtp_reply_filter b/data/templates/postfix/smtp_reply_filter new file mode 100644 index 000000000..690c40532 --- /dev/null +++ b/data/templates/postfix/smtp_reply_filter @@ -0,0 +1,24 @@ +# Google Mail bounces email sent via IPv6, while this works ok with IPv4. +# +# Convert Google Mail IPv6 complaint permanent error into a temporary error. +# Turn 550 error containing gsmtp in the message into 450 error. +# This way Postfix will attempt to deliver this e-mail using another MX +# (via IPv4). +# +/^5(\d\d )5(.*information. \S+ - gsmtp.*)/ 4${1}4$2 + +# Remove the first line of the Received: header. Note that we cannot fully remove the Received: header +# because OpenDKIM requires that a header be present when signing outbound mail. The first line is +# where the user's home IP address would be. +/^\s*Received:[^\n]*(.*)/ REPLACE Received: from authenticated-user ({{ main_domain }} [{{ main_ip }}])$1 + +# Remove other typically private information. +/^\s*User-Agent:/ IGNORE +/^\s*X-Enigmail:/ IGNORE +/^\s*X-Mailer:/ IGNORE +/^\s*X-Originating-IP:/ IGNORE +/^\s*X-Pgp-Agent:/ IGNORE + +# The Mime-Version header can leak the user agent too, e.g. in Mime-Version: 1.0 (Mac OS X Mail 8.1 \(2010.6\)). +/^\s*(Mime-Version:\s*[0-9\.]+)\s.+/ REPLACE $1 +