Skip to content

Commit

Permalink
Hide sender client IP
Browse files Browse the repository at this point in the history
  • Loading branch information
Spitfireap committed Jan 13, 2025
1 parent a1d480b commit 1f04d41
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
11 changes: 11 additions & 0 deletions modoboa_installer/scripts/files/postfix/anonymize_headers.pcre.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
if /^\s*Received:.*Authenticated sender.*\(Postfix\)/
/^Received: from .*? \([\w\-.]* \[.*?\]\)(.*|\n.*)\(Authenticated sender: (.+)\)\s+by.+\(Postfix\) with (.*)/
REPLACE Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with $3
endif
if /^\s*Received: from .*rspamd.localhost .*\(Postfix\)/
/^Received: from.* (.*|\n.*)\((.+) (.+)\)\s+by (.+) \(Postfix\) with (.*)/
REPLACE Received: from rspamd (rspamd $3) by $4 (Postfix) with $5
endif
/^\s*X-Enigmail/ IGNORE
/^\s*X-Originating-IP/ IGNORE
/^\s*X-Forward/ IGNORE
3 changes: 3 additions & 0 deletions modoboa_installer/scripts/files/postfix/master.cf.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ submission inet n - - - - smtpd
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=reject_sender_login_mismatch
-o milter_macro_daemon_name=ORIGINATING
-o cleanup_service_name=ascleanup
%{amavis_enabled} -o smtpd_proxy_filter=inet:[127.0.0.1]:10026
#smtps inet n - - - - smtpd
# -o syslog_name=postfix/smtps
Expand All @@ -42,6 +43,8 @@ submission inet n - - - - smtpd
#628 inet n - - - - qmqpd
pickup unix n - - 60 1 pickup
cleanup unix n - - - 0 cleanup
ascleanup unix n - - - 0 cleanup
-o header_checks=pcre:/etc/postfix/anonymize_headers.pcre
qmgr unix n - n 300 1 qmgr
#qmgr unix n - n 300 1 oqmgr
tlsmgr unix - - - 1000? 1 tlsmgr
Expand Down
5 changes: 2 additions & 3 deletions modoboa_installer/scripts/postfix.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ class Postfix(base.Installer):

appname = "postfix"
packages = {
"deb": ["postfix"],
"rpm": ["postfix"],
"deb": ["postfix", "postfix-pcre"],
}
config_files = ["main.cf", "master.cf"]
config_files = ["main.cf", "master.cf", "anonymize_headers.pcre"]

def get_packages(self):
"""Additional packages."""
Expand Down

0 comments on commit 1f04d41

Please sign in to comment.