Setting up different smarthosts for outbound mail relays

Questions and answers about how to do stuff
Post Reply
randomdude
Posts: 3
Joined: 11 May 2017 12:35

Setting up different smarthosts for outbound mail relays

Post by randomdude » 11 May 2017 12:47

Hello there.

Is it possible to configure EFA so I could manually set up smarthost rules, so incoming mail (which is to be relayed) would go to specific outbound smarthost?

As example: we have 2 servers (outbound mail relays in EFA terms) which send out mail to EFA instance (acting as intermediate relay) - 1.1.1.1 and 2.2.2.2.
Then, mail originating from 1.1.1.1 would be sent to final relay (outbound smarthost) 3.3.3.3.
And mail from 2.2.2.2 would go to relay 4.4.4.4.

I hope my question makes sense provided the example :) Thank you.

ovizii
Posts: 418
Joined: 11 May 2016 08:08

Re: Setting up different smarthosts for outbound mail relays

Post by ovizii » 17 May 2017 10:32

I'm pretty confused by this but I think that you do that when you setup the transport in EFA?
When setting up a new domain for EFA to accept you can decide where its emails are forwarded to.
Why don't you just set it up there? Or did I misread your request?

randomdude
Posts: 3
Joined: 11 May 2017 12:35

Re: Setting up different smarthosts for outbound mail relays

Post by randomdude » 17 May 2017 20:05

I expected my description would be confusing, sorry. Actually I've got updated scheme which should be easier to grasp.

Let's just say the scheme is:
1) mail servers A and B - outbound mail from them is to be relayed to EFA (in EFA terms they are "Outbound mail relays");
2) EFA instance C - that should accept mail from A and B - for scanning etc. and finally sending it out.

Can I set EFA up so that emails from mail server A would be sent out via one EFA instance IP - say 1.1.1.1 - and emails from server B from 1.1.1.2? (we need this because mail servers A and B serve for different brands)

ovizii
Posts: 418
Joined: 11 May 2016 08:08

Re: Setting up different smarthosts for outbound mail relays

Post by ovizii » 17 May 2017 20:19

Ah, I think I get it. Let me see if I got this right:

a number (currently 2) of your email servers forward their emails to 1 EFA and you want this 1 EFA to send them out through different IPs based on the originating email server?

as far as I know, EFA does not have this feature. You can do some postfix hacking though. Look at this thread, specifically the reply which starts like this:

Code: Select all

master.cf

Create different Interfaces. One for each domain:
That looks quite promising and like a good start to create a solution for what you are looking for. => https://serverfault.com/questions/92181 ... ip-address

Btw.I really love EFA but mostly for incoming filtering. I have been eyeing another project for outgoing but haven't gotten around to give it a try but check it out it might be better for waht you are looking for: https://github.com/atech/postal

User avatar
pdwalker
Posts: 875
Joined: 18 Mar 2015 09:16

Re: Setting up different smarthosts for outbound mail relays

Post by pdwalker » 18 May 2017 03:15

In the meantime, you can try different postfix hacks, or you can use two EFA hosts, or you can setup two "smarthosts" whos job it is to forward mail for the domains in question
e.g.

Code: Select all

  mailserver a \            / smarthost a \
                 --> efa -->               --> internet
  mailserver b /            \ smarthost b /
Of course, from a management point of view, this is a pain in the ass to add in two or more servers to handle your requirements.

stusmith
Posts: 63
Joined: 27 Jan 2017 15:24

Re: Setting up different smarthosts for outbound mail relays

Post by stusmith » 18 May 2017 15:57

I know that you can override transport maps with a filter based on client IP address. I know that you can also use sender dependent transport maps to route mail based on e-mail addresses. http://www.postfix.org/postconf.5.html# ... yhost_maps

I guess the real question should be, are you sending from the same domain? If each server 1.1.1.1 and 2.2.2.2 has clients in a different domain, such as person@1.1.1.1.com and person@2.2.2.2.com, then you can map 1.1.1.1.com to 3.3.3.3 and 2.2.2.2.com to 4.4.4.4 in your transport maps.

...

So much depends on the reason that you have two internal mail servers and need to maintain separate paths. Can you elaborate on that some? It might help us see other solutions if we could understand the need better.

User avatar
pdwalker
Posts: 875
Joined: 18 Mar 2015 09:16

Re: Setting up different smarthosts for outbound mail relays

Post by pdwalker » 18 May 2017 16:35

It might help us see other solutions if we could understand the need better.

Good point, one I often forget. Don't tell about a specific problem and ask how to solve it. Step back and tell us your real problem first. Often the solution you think you need is very different from the solution you actually need.

User avatar
shawniverson
Posts: 2442
Joined: 13 Jan 2014 23:30
Location: Rushville, Indiana, USA
Contact:

Re: Setting up different smarthosts for outbound mail relays

Post by shawniverson » 18 May 2017 18:08

The X Y problem :D
Version 3.0.2.5 released! Update now to keep your eFa secure!

randomdude
Posts: 3
Joined: 11 May 2017 12:35

Re: Setting up different smarthosts for outbound mail relays

Post by randomdude » 19 May 2017 04:58

stusmith wrote:
18 May 2017 15:57
So much depends on the reason that you have two internal mail servers and need to maintain separate paths. Can you elaborate on that some? It might help us see other solutions if we could understand the need better.
Basically we have 2 shared hosting servers (described as A and B before, each server belongs to different brand), from which mail that is sent out goes to EFA instance. And the EFA instance should be final smarthost, and send out mail received from server A via 1.1.1.1 and from B via 2.2.2.2.

Thanks for your other solutions ovizii, stusmith and pdwalker - I'll look into them.

stusmith
Posts: 63
Joined: 27 Jan 2017 15:24

Re: Setting up different smarthosts for outbound mail relays

Post by stusmith » 23 May 2017 12:33

randomdude wrote:
19 May 2017 04:58
stusmith wrote:
18 May 2017 15:57
So much depends on the reason that you have two internal mail servers and need to maintain separate paths. Can you elaborate on that some? It might help us see other solutions if we could understand the need better.
Basically we have 2 shared hosting servers (described as A and B before, each server belongs to different brand), from which mail that is sent out goes to EFA instance. And the EFA instance should be final smarthost, and send out mail received from server A via 1.1.1.1 and from B via 2.2.2.2.

Thanks for your other solutions ovizii, stusmith and pdwalker - I'll look into them.
If they are different brands and different domain names, then you're golden. You can just use transport maps to make that happen inbound, and sender-dependent-transport-maps outbound. Done deal.

Post Reply