-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Don't apply SRS to locally bound mail #534
Conversation
# Handle SRS | ||
default_transport = smtp:127.0.0.1:10027 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment could do with some improvement. How does it handle SRS?
ansible/roles/postfix/tasks/main.yml
Outdated
-o sender_canonical_maps=pcre:/etc/postfix/sender-canonical-maps,tcp:127.0.0.1:10001 | ||
-o sender_canonical_classes=envelope_sender | ||
|
||
127.0.0.1:10027 inet n - - - - smtpd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use a regular service name (e.g. smtpd-optional-srs
) and a unix socket for this, please?
ansible/roles/postfix/tasks/main.yml
Outdated
-o sender_canonical_classes=envelope_sender | ||
|
||
127.0.0.1:10027 inet n - - - - smtpd | ||
-o syslog_name=postfix/srs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-o syslog_name=postfix/srs | |
-o syslog_name=postfix/smtpd/optional-srs |
ansible/roles/postfix/tasks/main.yml
Outdated
@@ -187,6 +197,19 @@ | |||
-o smtpd_sasl_type=dovecot | |||
-o smtpd_sasl_path=private/auth | |||
|
|||
cleanup-srs unix n - - - 0 cleanup | |||
-o syslog_name=postfix/srs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-o syslog_name=postfix/srs | |
-o syslog_name=postfix/cleanup/optional-srs |
Pretty smart implementation. I have to admit the intermingling of Postfix daemons is a bit hard to see through at first but it's pretty genius. Turns out that that configuration file format is very, very flexible. |
Btw, we should probably contribute docs for this upstream. It seems useful. |
Nevermind, I see, you've copied this from upstream yourself. roehling/postsrsd#76 |
This template returns the address verbatim if it's a local domain else it returns nothing. Based on this, we can use these addresses for SRS, it will either use the verbatim address or pass onto SRSd for a rewrite.
c344621
to
eb79092
Compare
Thanks! |
In #528 changes were made to prevent mail from internal domains being rewritten
with the Sender Rewrite Scheme since we can correctly authenticate any mail sent
from our domains.
Similarly, if we are the last stop on an envelopes journey (i.e. the mail will
arrive to a local mailbox) there is no need for us to apply sender rewriting as
we have no further mailservers to pass the message onto (and so the message is
fully received and validated at this point).
This PR introduces a new SMTP daemon which we set as the
default_transport
which conditionally rewrites with SRS only when the expanded destination address
is not a locally handled inbox.
This allows for mail heading for an external server such as Google or Outlook to
be rewritten and remain valid under SPF but mail that lands in our inboxes not
be rewritten (you can validate this by checking that the
Return-Path
doesn'thave SRS in it for local mail).