2

Please accept my apologies if this is off topic or does not apply on a more broad scale (i've searched the internet and can't seem to find a solution anywhere). I'm not sure if this is even possible, if you have any suggestions that will work better or just let me know it won't work. I'm new to HAProxy. Be kind (lol)

I'm using HAProxy for HTTP and HTTPS proxy connections for web servers, what I'd like to do is do the same with a farm of servers I have. The only problem I am running into is that each of those servers includes email (Postfix and Dovecot usually) for the emails attached to them.

I'm trying to setup the same things but for multiple domains and for email. For example I would have a public ip address assigned to an HAProxy server, internally it would query each server and find the server that has that domain and then transfer the data to that server.

Cheesy Text Diagram:

  • joe@example.com - HAProxy >> Server 4
  • joe@example2.org - HAProxy >> Server 1
  • joe@example.net - HAProxy >> Server 2

I'm looking to do this dynamically, so if example.net is moved from Server 2 to Server 3, it will change accordingly. Again....I do not know if this is possible, and I've spent about 3 weeks researching and trying to find information on this, but not on the scale in which I'm looking to do.

Any help would be greatly appreciated, as I've said if this can be accomplished with another program other such as Nginx reverse proxy please let me know.

slm
  • 7,615
  • 16
  • 56
  • 76
  • On the machine that you are running HAProxy, you could also install postfix and use it as a relay (using the relay_domains & relay_reciepient_maps options in your main.cf). On that relay machine you could locally setup DNS records for example.com, example2.org and example.net to point to the local addresses of their respective hosts. When a domain changes hosts, you could simple update the local dns record of the relay host. – cburn11 Jul 22 '18 at 01:50
  • I was looking for a somewhat automated routing, but it looks like upon researching it further that is the way it needs to be accomplished. I have discovered that by using forwarder lookups and scripting i can verify the public ip address to see if the external IP of those servers has changed and update the postfix configuration accordingly. Thanks for the insight! If you have any sample configuration to get me started that would be insanely helpful and greatly appreciated! – PunkIsDaFunk Jul 26 '18 at 13:14

0 Answers0