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

Both SMTP and LMTP servers may listen either TCP or UNIX domain socket #212

Merged
merged 1 commit into from Nov 9, 2023

Conversation

ikedas
Copy link
Collaborator

@ikedas ikedas commented Feb 24, 2023

  • RFC2033 does not state that "LMTP mode cannot be used with a TCP listener": It states that it "MUST NOT be used on the TCP service port 25". In fact, most LMTP implementations support TCP, and the default port number is often 24.
  • There is at least one implementation that supports SMTP over UNIX domain socket: OpenSMTPD.
  • TLS over UNIX domain socket seems worthwhile. On some systems, since permissions of pathname socket are ignored, they cannot be relied upon (See unix(7)).

That's why this PR makes changes to allow both SMTP and LMTP servers to be used on either TCP or UNIX domain socket with optional TLS.


Some other changes:

  • The server address is treated as UNIX domain socket when the value of Server.Addr contains "/".
  • New field Network for the type of connection, defaulting "tcp", is introduced. LMTP field no longer affects the type.
  • The default address for ListenAndServeTLS() was changed to ":465" because on several systems ":smtps" cannot be resolved.

@ikedas
Copy link
Collaborator Author

ikedas commented Feb 24, 2023

I noticed that a part of the goals of this PR is duplicated in the PR #123 by @patrick246 . However I believe my changes are better.

@emersion
Copy link
Owner

I am not a fan of making Server.Addr handling more complicated.

@ikedas
Copy link
Collaborator Author

ikedas commented Mar 24, 2023

I am not a fan of making Server.Addr handling more complicated.

Is another option like Server.Network preferred? I don't care either way.

@ikedas
Copy link
Collaborator Author

ikedas commented Mar 27, 2023

@emersion , I removed auto-detection of network type.
If I should squash the commits, let me know.

Co-authored-by: Simon Ser <contact@emersion.fr>
@emersion
Copy link
Owner

emersion commented Nov 9, 2023

Changed the logic a bit, thanks!

@emersion emersion enabled auto-merge (rebase) November 9, 2023 10:08
@emersion emersion merged commit 53bb8bb into emersion:master Nov 9, 2023
1 check passed
@emersion emersion mentioned this pull request Nov 9, 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.

None yet

2 participants