I have haproxy in transparent mode to load balance two mail server. I have a problem with outgoing mail messages. The receiving party see that the IP of our mail server is the ip of haproxy and not the server itself.

I need suggestion how to fix this because other mail server block our email because they category it as spam.

Here is my sample config on haproxy.

listen mail_smtp 
bind 68.128.X.X:25
mode tcp
option tcplog
balance leastconn
source 0.0.0.0 usesrc clientip
server mail1 68.138.x.x:25 check port 80 inter 3s rise 2 fall 2
server mail2 68.138.x.x:25 check port 80 inter 3s rise 2 fall 2 backup
link|improve this question
feedback

1 Answer

This is how haproxy works. You can't use the IPs of the hosts behind the proxy IP. So you cant even change this.

You have to fix the underlaying Spam problem. And the classification of "Spammer" depends only to 5% on the IP. Do you really think that using 68.138.x.x instead of 68.128.X.X will change the spammyness?

Configure everything - as you would do without haproxy - for the IP 68.128.X.X and you are done. DKIM, PTR and SPF to mention just a few IP related anti-look-as-spammer mechanisms.

But the real question remains: Why do you need a haproxy for outgoing mails? This is the wrong direction for a proxy. You should only need a proxy for incoming mails.

link|improve this answer
Yes I need only proxy for incoming mails. But I can't setup or I'm lazy at all that I cannot figure out how to forward client IP from haproxy to mail server without transparent enable on ha-proxy. Originally my plan are to load balance incoming mails only and the outgoing mail are directly send from mail server itself. But when I try this mail server only see Haproxy IP and not client IP. I need client IP for filtering purpose like antispam. – dhyn lav Oct 21 '11 at 0:25
@dhynlav You do have a client IP on the Postfix machine. Use that one as outgoing IP (in main.cf: smtp_bind_address = 68.138.x.x). Make sure that this IP is routed to Internet. – mailq Oct 21 '11 at 9:28
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.