haraka / Haraka

A fast, highly extensible, and event driven SMTP server
https://haraka.github.io
MIT License
5.09k stars 662 forks source link

Allow server-specific configuration #1689

Closed typingArtist closed 7 years ago

typingArtist commented 8 years ago

If Haraka is listening on multiple addresses it should be possible to setup individual settings for each server port. E.g. Haraka on port 25, external IP, should have different setup than port 587 or internal mail relay. The current approach of implicitly allowing some things based on address (private address space) should be abandoned and made explicit instead.

msimerson commented 7 years ago

This issue come up from time to time. The standard answer has always been, run more instances of Haraka with different configs.

The current approach of implicitly allowing some things based on address (private address space) should be abandoned and made explicit instead.

These are different things. Connection handling that is altered based on private space is based on the client having a private IP, not the server. In my case, every Haraka listener is running on private IP space. ;-)

An idea maybe worth considering is instead of having multiple Haraka instances, a clustered Haraka master could run children that each have at a different Haraka config.

I'm closing this because this is a feature request with few interested parties. When the cost of running two Haraka's is small and the dev effort required to add this feature is larger than small, it'll be up to you to land a PR implementing this.

aaronlumsden commented 1 year ago

One way I got around this (in my custom plugin) was to listen on both ports and then use connection.local.port to determine which port is being requested.


exports.hook_rcpt = function (next, connection) {

  if (connection.local.port == 25) {
      // incoming mail
  }

 if (connection.local.port == 587) {
   // outgoing mail
 }

  next();
};