Skip to content
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

Detect and break forwarding loops #79

Closed
foxcpp opened this issue May 25, 2019 · 2 comments
Closed

Detect and break forwarding loops #79

foxcpp opened this issue May 25, 2019 · 2 comments
Labels
mta-in Related to incoming message processing part of the MTA functionality (mail exchanger). new feature New feature. std-requirement The Internet Standard requirement is not followed or followed incorrectly.

Comments

@foxcpp
Copy link
Owner

foxcpp commented May 25, 2019

My initial idea is to inspect Received fields in the headers of the messages.
If it contains value mentioning the recipient address we are handling and our hostname - we bounce the message because it was processed by our server already.

It is important to check hostname because a single recipient may be processed by multiple servers and each will include its own Received field.
Another consideration to take into account: We should skip Received fields we can't process as some MTAs include information using non-standard formats (qmail, for example). Actually, SMTP RFC requires MTA to not fail delivery if an invalid Received field is present in the header.

Postfix relies on Delivered-To (non-standard AFAIK) fields for this purpose. We might want to include this field when the message leaves the pipeline. Currently, it is included only when the message is stored in an IMAP mailbox.

@foxcpp foxcpp added new feature New feature. mta-in Related to incoming message processing part of the MTA functionality (mail exchanger). labels May 25, 2019
@foxcpp
Copy link
Owner Author

foxcpp commented Aug 26, 2019

Alternatively, we may want to reject messages that contain a lot of Received fields in header.
Borrowing default limits from Postfix: It rejects messages if they contain more than 50 Received fields.

@foxcpp foxcpp added this to the X.Y - "Eventually" milestone Feb 10, 2020
@foxcpp foxcpp added the std-requirement The Internet Standard requirement is not followed or followed incorrectly. label Feb 15, 2020
@foxcpp
Copy link
Owner Author

foxcpp commented Feb 15, 2020

https://tools.ietf.org/html/rfc5321#section-6

Whatever mechanisms are used, servers MUST
contain provisions for detecting and stopping trivial loops.

Interestingly, it is actually a "MUST" requirement in RFC 5321.

@foxcpp foxcpp closed this as completed in 5bf8cb9 Feb 15, 2020
@foxcpp foxcpp modified the milestones: X.Y - "Eventually", 0.1 - "It works" Feb 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mta-in Related to incoming message processing part of the MTA functionality (mail exchanger). new feature New feature. std-requirement The Internet Standard requirement is not followed or followed incorrectly.
Projects
None yet
Development

No branches or pull requests

1 participant