Skip to content

Remove DKIM-Signature from incoming mail after checking #533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## untagged

- Remove `DKIM-Signature` from incoming mails after verifying
([#530](https://github.com/chatmail/server/pull/530))

- Send SNI when connecting to outside servers
([#524](https://github.com/chatmail/server/pull/524))

Expand Down
16 changes: 13 additions & 3 deletions cmdeploy/src/cmdeploy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ def _configure_opendkim(domain: str, dkim_selector: str = "dkim") -> bool:
)
need_restart |= service_file.changed


return need_restart


Expand Down Expand Up @@ -275,7 +274,18 @@ def _configure_postfix(config: Config, debug: bool = False) -> bool:
)
need_restart |= master_config.changed

header_cleanup = files.put(
incoming_header_cleanup = files.put(
src=importlib.resources.files(__package__).joinpath(
"postfix/incoming_header_cleanup"
),
dest="/etc/postfix/incoming_header_cleanup",
user="root",
group="root",
mode="644",
)
need_restart |= incoming_header_cleanup.changed

submission_header_cleanup = files.put(
src=importlib.resources.files(__package__).joinpath(
"postfix/submission_header_cleanup"
),
Expand All @@ -284,7 +294,7 @@ def _configure_postfix(config: Config, debug: bool = False) -> bool:
group="root",
mode="644",
)
need_restart |= header_cleanup.changed
need_restart |= submission_header_cleanup.changed

# Login map that 1:1 maps email address to login.
login_map = files.put(
Expand Down
1 change: 1 addition & 0 deletions cmdeploy/src/cmdeploy/postfix/incoming_header_cleanup
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/^DKIM-Signature:/ IGNORE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this also scrub Authentication-Results then?

Copy link
Contributor Author

@link2xt link2xt Mar 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see Authentication-Results, there is nothing that adds them. OpenDKIM is not configured to add them apparently.

Above the Content-Type header (the last one added by the client) I only see DKIM-Signature, Received and Return-Path. Maybe Received and Return-Path can be removed to reduce the amount of stored metadata further. These headers come from the receiving server.

1 change: 1 addition & 0 deletions cmdeploy/src/cmdeploy/postfix/master.cf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ smtps inet n - y - 5000 smtpd
#628 inet n - y - - qmqpd
pickup unix n - y 60 1 pickup
cleanup unix n - y - 0 cleanup
-o header_checks=regexp:/etc/postfix/incoming_header_cleanup
qmgr unix n - n 300 1 qmgr
#qmgr unix n - n 300 1 oqmgr
tlsmgr unix - - y 1000? 1 tlsmgr
Expand Down
Loading