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

feat: add localName to smtp config #2445

Merged
merged 1 commit into from
May 13, 2022
Merged

Conversation

sthh
Copy link
Contributor

@sthh sthh commented May 3, 2022

This PR introduces a new configuration courier.smtp.local_name that is passed to the SMTP dialer used in kratos courier.
The config value is used in the SMTP HELO/EHLO command and was previously hardcoded to localhost.
Some SMTP relays (e.g. Gmail) require a unique identifier during the HELO command and close the connection if a generic value like localhost is used. Therefore those SMTP relays can currently not be used with Kratos.

See https://support.google.com/a/answer/2956491?product_name=UnuFlow&hl=en&visit_id=637871815371283723-3216367043&rd=1&src=supportwidget0&hl=en

We recommend that you configure your mail server to present a unique identifier (such as your domain name or the name of your mail server) in the HELO or EHLO command in the SMTP relay connections your server makes to Google. Avoid using generic names such as "localhost" or "smtp-relay.gmail.com," which can occasionally result in issues with DoS limits.

Note that you may not be able to reproduce the bug with an Gmail SMTP relay, since Gmail does not close every connection. For us, it worked fine for some time before Gmail started to close the connections.

Related issue(s)

#2425

Checklist

  • I have read the contributing guidelines.
  • I have referenced an issue containing the design document if my change
    introduces a new feature.
  • I am following the
    contributing code guidelines.
  • I have read the security policy.
  • I confirm that this pull request does not address a security
    vulnerability. If this pull request addresses a security. vulnerability, I
    confirm that I got green light (please contact
    [email protected]) from the maintainers to push
    the changes.
  • I have added tests that prove my fix is effective or that my feature
    works.
  • I have added or changed the documentation.

Further Comments

@sthh sthh requested review from aeneasr and zepatrik as code owners May 3, 2022 13:52
@codecov
Copy link

codecov bot commented May 3, 2022

Codecov Report

Merging #2445 (ab19cac) into master (50bdba9) will decrease coverage by 0.04%.
The diff coverage is 100.00%.

❗ Current head ab19cac differs from pull request most recent head 4524927. Consider uploading reports for the commit 4524927 to get more accurate results

@@            Coverage Diff             @@
##           master    #2445      +/-   ##
==========================================
- Coverage   76.52%   76.47%   -0.05%     
==========================================
  Files         316      316              
  Lines       17596    17600       +4     
==========================================
- Hits        13465    13460       -5     
- Misses       3197     3205       +8     
- Partials      934      935       +1     
Impacted Files Coverage Δ
courier/smtp.go 75.00% <100.00%> (+0.42%) ⬆️
driver/config/config.go 82.05% <100.00%> (+0.05%) ⬆️
cmd/courier/watch.go 64.40% <0.00%> (-11.87%) ⬇️
persistence/sql/persister_courier.go 86.76% <0.00%> (-2.95%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 50bdba9...4524927. Read the comment docs.

Copy link
Member

@aeneasr aeneasr left a comment

Choose a reason for hiding this comment

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

Looking good! Could you please add this new key to the documentation? :)

https://www.ory.sh/docs/kratos/concepts/email-sms#sending-e-mails-via-smtp

@sthh
Copy link
Contributor Author

sthh commented May 13, 2022

Thank! I've added some docs in ory/docs#810

@aeneasr aeneasr merged commit 27336b6 into ory:master May 13, 2022
@vinckr
Copy link
Member

vinckr commented May 20, 2022

Hello @sthh
Congrats on merging your first PR in Ory 🎉 !
Your contribution will soon be helping secure millions of identities around the globe 🌏.
As a small token of appreciation we send all our first time contributors a gift package to welcome them to the community.
Please drop me an email and I will forward you the form to claim your Ory swag!

@sthh sthh deleted the feature/localNameConfig branch May 20, 2022 14:07
peturgeorgievv pushed a commit to senteca/kratos-fork that referenced this pull request Jun 30, 2023
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.

3 participants