How to properly send e-mails behind a HAProxy LAN server pool?
Posted on 2015-01-11
I noticed when I send out emails through PHP or through the server's console the e-mails are sent out from the firewall's public IP.
Current setup is:
1 juniper firewall
2 haproxy servers (load balancers, active/backup)
4 virtual servers (each site)
The firewall's public side is: 70.x.x.10, and the LAN IP is 10.0.1.1 and also 10.0.50.1
Both haproxy servers have a public NIC and private NIC
All the virtual servers (running CentOS 6.5 Linux) have 1 NIC configured with a LAN IP address (10.0.1.x and 10.0.50.x), gateway matches the subnet.
The hostname for each server is a FQDN pointing to the site's Public IP.
All traffic is directed to the HAProxy IP (site specific), where it has a pool of 4 LAN IP (servers) per site.
The actual e-mail accounts are not hosted on these virtual servers, they are either on gmail servers or another provider.
When sending out an e-mail from any virtual server the "client-ip" and "Received: from" on the e-mail's header is the firewall's public ip: 70.x.x.10. Which makes sense because it only comes in through HAProxy, but it doesn't go out through it.
sendmail is install and running with default configuration, no changes so far.
I would like suggestions on what I can do to have the e-mail headers to list the actual website's IP address and not the firewall's public ip for every site. I'm researching on sendmail options, but still nothing.
Hopefully I made it clear. Let me know your thoughts. Thank you very much in advance!