I have set up a HAProxy server which is proxying all emails to my email server. That was done for security purposes.
Proxy server (HAProxy 1.3.26): 192.168.0.1 Mail server (Exim 4.63): 192.168.0.2 Both servers are CentOS 5.8.
Here is a part of my HAProxy config:
defaults mode tcp log global option dontlognull option httpclose option tcplog option forwardfor option redispatch listen smtp 192.168.0.1:25 server mail0 192.168.0.2:25 maxconn 5000 listen imap 192.168.0.1:143 server mail0 192.168.0.2:143 maxconn 5000
Here is the problem:
2012-09-13 22:47:04 1TCERM-0000aP-1A => email@example.com R=dnslookup T=remote_smtp H=example.com [192.168.0.1] X=TLSv1:AES256-SHA:256 DN="/C=XX/ST=XX/L=XX/O=XX/OU=XX/CN=example.com/emailAddressfirstname.lastname@example.org" C="250 OK id=1TCERM-0000aS-IJ" 2012-09-13 22:47:04 1TCERM-0000aP-1A Completed 2012-09-13 22:47:04 1TCERM-0000aS-IJ ** email@example.com: Too many "Received" headers - suspected mail loop 2012-09-13 22:47:04 1TCERM-0000aU-KD <= <> R=1TCERM-0000aS-IJ U=exim P=local S=9409 from <> for firstname.lastname@example.org 2012-09-13 22:47:04 1TCERM-0000aS-IJ Completed
There are number of such entries in the Exim logs. You see that I am sending from email@example.com to firstname.lastname@example.org The email is received by the HAProxy server and proxied to the mail server. The problem is the email is gettied looped afterwards. And I can't understand where the problem is.
MX record of my domain example.com is pointed to 192.168.0.1. Mailboxes were created on the 192.168.0.2 server.
Here is a part of the bounced email header (those sections are repeated many times):
Received: from example.com ([192.168.0.1] helo=example.com) by dc.example.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1TCDdv-0007PI-Jf for email@example.com; Thu, 13 Sep 2012 21:55:59 +0400 Received: from example.com ([192.168.0.1]) by dc.example.com with smtp (Exim 4.63) (envelope-from ) or firstname.lastname@example.org; Thu, 13 Sep 2012 21:55:59 +0400 test1
I would be very grateful if someone helps me on this issue. Let me know if you need some details, logs, etc.