From bcc54602ee305294d40a7b4fdc5dc549d336b64e Mon Sep 17 00:00:00 2001 From: missytake Date: Wed, 27 Dec 2023 12:17:03 +0100 Subject: [PATCH] postfix: cleanup submission headers --- cmdeploy/src/cmdeploy/__init__.py | 9 +++++++++ cmdeploy/src/cmdeploy/postfix/main.cf.j2 | 2 ++ cmdeploy/src/cmdeploy/postfix/master.cf.j2 | 6 ------ cmdeploy/src/cmdeploy/postfix/submission_header_cleanup | 4 ++++ 4 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 cmdeploy/src/cmdeploy/postfix/submission_header_cleanup diff --git a/cmdeploy/src/cmdeploy/__init__.py b/cmdeploy/src/cmdeploy/__init__.py index 8b0e7dd4..c8f61da0 100644 --- a/cmdeploy/src/cmdeploy/__init__.py +++ b/cmdeploy/src/cmdeploy/__init__.py @@ -254,6 +254,15 @@ def _configure_postfix(config: Config, debug: bool = False) -> bool: ) need_restart |= master_config.changed + header_cleanup = files.put( + src=importlib.resources.files(__package__).joinpath("postfix/submission_header_cleanup"), + dest="/etc/postfix/submission_header_cleanup", + user="root", + group="root", + mode="644", + ) + need_restart |= header_cleanup.changed + return need_restart diff --git a/cmdeploy/src/cmdeploy/postfix/main.cf.j2 b/cmdeploy/src/cmdeploy/postfix/main.cf.j2 index 8a78d647..4a201231 100644 --- a/cmdeploy/src/cmdeploy/postfix/main.cf.j2 +++ b/cmdeploy/src/cmdeploy/postfix/main.cf.j2 @@ -48,3 +48,5 @@ virtual_mailbox_domains = {{ config.mail_domain }} smtpd_milters = unix:opendkim/opendkim.sock non_smtpd_milters = $smtpd_milters + +header_checks = regexp:/etc/postfix/submission_header_cleanup diff --git a/cmdeploy/src/cmdeploy/postfix/master.cf.j2 b/cmdeploy/src/cmdeploy/postfix/master.cf.j2 index 8620bd68..dd0cc0eb 100644 --- a/cmdeploy/src/cmdeploy/postfix/master.cf.j2 +++ b/cmdeploy/src/cmdeploy/postfix/master.cf.j2 @@ -34,7 +34,6 @@ submission inet n - y - - smtpd -o milter_macro_daemon_name=ORIGINATING -o smtpd_client_connection_count_limit=1000 -o smtpd_proxy_filter=127.0.0.1:{{ config.filtermail_smtp_port }} - -o cleanup_service_name=submission-header-cleanup smtps inet n - y - - smtpd -o syslog_name=postfix/smtps -o smtpd_tls_wrappermode=yes @@ -81,8 +80,3 @@ filter unix - n n - - lmtp # Local SMTP server for reinjecting filered mail. localhost:{{ config.postfix_reinject_port }} inet n - n - 10 smtpd -o syslog_name=postfix/reinject -### -### Cleanup-Service um MUA header zu entfernen -### -submission-header-cleanup unix n - n - 0 cleanup - -o header_checks=regexp:/etc/postfix/submission_header_cleanup diff --git a/cmdeploy/src/cmdeploy/postfix/submission_header_cleanup b/cmdeploy/src/cmdeploy/postfix/submission_header_cleanup new file mode 100644 index 00000000..6439329f --- /dev/null +++ b/cmdeploy/src/cmdeploy/postfix/submission_header_cleanup @@ -0,0 +1,4 @@ +/^Received:/ IGNORE +/^X-Originating-IP:/ IGNORE +/^X-Mailer:/ IGNORE +/^User-Agent:/ IGNORE