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

prevent local delivery loop when target exchange resolves to a local hostname #3002

Merged
merged 3 commits into from
Dec 20, 2021
Merged

Conversation

DoobleD
Copy link
Contributor

@DoobleD DoobleD commented Nov 28, 2021

Fixes #2809 also for host names (#2952 solved it for IPs only). Requires merge of haraka-net-utils#63 first.

Changes proposed in this pull request:

  • new function net_utils.is_local_host is used instead of net_utils.is_local_ip to check if the exchange is localhost.

Checklist:

  • docs updated
  • tests updated
  • Changes updated

@msimerson msimerson merged commit 786daac into haraka:master Dec 20, 2021
@DoobleD
Copy link
Contributor Author

DoobleD commented Dec 29, 2021

The call to is_local_host seems to badly impact performance for some reason. Applying the change to production made CPU jump from ~15% to 99%.

@msimerson
Copy link
Member

Yes, there's a bug in it somewhere that is calling done when done is undefined. I haven't had a chance to investigate further.

@DoobleD
Copy link
Contributor Author

DoobleD commented Jan 1, 2022

Yes, there's a bug in it somewhere that is calling done when done is undefined. I haven't had a chance to investigate further.

Thanks for the feedback @msimerson. Indeed the call to is_local_host in mx_lookup.js simply doesn't use the callback...I'll open fix PRs soon.

@DoobleD
Copy link
Contributor Author

DoobleD commented Jan 2, 2022

Here are the fix PRs:

Not sure if that works for you as it uses promises.

To be sure I tested this version on a production server and it seems to be working fine so far.

msimerson added a commit that referenced this pull request Jan 6, 2022
* prevent local delivery loop when target exchange resolves to a local hostname
* fix mx_lookup call to is_local_host
* bumped haraka-net-utils required version to ^1.3.3

Co-authored-by: Matt Simerson <[email protected]>
@msimerson msimerson mentioned this pull request Jun 4, 2022
13 tasks
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.

Localhost mail loop problem
2 participants