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

Skip SPF check for outbound mail when context is not 'myself' #1763

Merged
merged 1 commit into from
Jan 18, 2017

Conversation

gramakri
Copy link
Collaborator

Fixes #1762

@msimerson
Copy link
Member

The edge case I see with this change affects orgs that have to send all their emails via a 3rd party (typically their ISP) mail server. Think of a small local business with an internal mail server who has outbound port 25 blocked by their ISP (this is not unusual). In that case, they set up their MTA to relay through their ISP. Their SPF records cover their and their ISPs mail server and everyone is happy. I can't see any reason not to evaluate SPF in that case.

If you were to amend this PR such that it disabled the same check but only for private IP space (see attached diff), then I'd +1 that.

diff --git a/plugins/spf.js b/plugins/spf.js
index 0e880e7..0e55915 100644
--- a/plugins/spf.js
+++ b/plugins/spf.js
@@ -114,9 +114,10 @@ exports.hook_helo = exports.hook_ehlo = function (next, connection, helo) {
 exports.hook_mail = function (next, connection, params) {
     var plugin = this;
 
-    // For inbound message from a private IP, skip MAIL FROM check
-    if (!connection.relaying && connection.remote.is_private) {
-        return next();
+    // For messages from private IP space...
+    if (connection.remote.is_private) {
+        if (!connection.relaying) return next();
+        if (connection.relaying && plugin.cfg.relay.context !== 'myself') return next();
     }
 
     var txn = connection.transaction;

@gramakri
Copy link
Collaborator Author

@msimerson Thanks for the review. I have modified the patch accordingly.

@msimerson
Copy link
Member

+1

@msimerson msimerson merged commit 84ccc45 into haraka:master Jan 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants