LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Postfix : mail for domain.com loops back to myself (https://www.linuxquestions.org/questions/linux-server-73/postfix-mail-for-domain-com-loops-back-to-myself-4175462218/)

yobogs 05-16-2013 07:59 AM

Postfix : mail for domain.com loops back to myself
 
Hello,

I have an postfix with 5 IP and only one domain "domain.com"

When i try to send an email to user@domain.com, i have this error :

Code:

This is the mail system at host domain.com.

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

                  The mail system

<user@domain.com>: mail for domain.com loops back to myself

Final-Recipient: rfc822; user@domain.com
Original-Recipient: rfc822;user@domain.com
Action: failed
Status: 5.4.6
Diagnostic-Code: X-Postfix; mail for domain.com loops back to myself

The postfix conf is :
Code:

command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
html_directory = no
inet_protocols = ipv4
mail_owner = postfix
mailq_path = /usr/bin/mailq
manpage_directory = /usr/local/man
milter_default_action = accept
mydestination = localhost.$mydomain, localhost, domain.com
mydomain = domain.com
myhostname = domain.com
mynetworks = 127.0.0.1 198.XXX.XX.17 198.XXX.XX.18 198.XXX.XX.66 198.XXX.XX.67 198.XXX.XX.68
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases
non_smtpd_milters = $smtpd_milters
queue_directory = /var/spool/postfix
readme_directory = no
sample_directory = /etc/postfix
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
smtpd_milters = inet:127.0.0.1:8891
transport_maps = tcp:[127.0.0.1]:2527
unknown_local_recipient_reject_code = 550
virtual_alias_maps = hash:/etc/postfix/virtual

DNS for my domain.com
Code:

@        IN SOA dns104.ovh.net. tech.ovh.net. (2013051603 86400 3600 3600000 300)
                            IN NS    ns104.ovh.net.
                            IN NS    dns104.ovh.net.
                            IN NS    ns1.domain.com.
                            IN MX 20  domain.com.
                            IN A      198.xxx.xx.18
                            IN A      198.xxx.xx.17
                            IN A      198.xxx.xx.68
                            IN A      198.xxx.xx.66
                            IN A      198.xxx.xx.67
                            IN TXT    "v=spf1 a ptr mx:domain.com -all"
_domainkey.domain.com        IN TXT    "t=y; o=-;".
default._domainkey          IN TXT    "( k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqAp1WvQBqAGqrtwM2dN4TWmTZB1r5yZwQR7YzIcPAZKp/TJJeNJzY3FUPCOT95PbelP/24leKriCvdP85squ5gcSU3Xb7/NpbcS1G5NzUNimUSnoLnfR7DfeTrCabn2UnHOLzv8PflS7TtFiHlQIDAQAB )"
ftp                        IN CNAME  domain.com.
imap                        IN CNAME  domain.com.
mail                        IN MX 10  domain.com.
mail                        IN A      198.xxx.xx.18
mail                        IN A      198.xxx.xx.17
mail                        IN A      198.xxx.xx.68
mail                        IN A      198.xxx.xx.66
mail                        IN A      198.xxx.xx.67
ns1                        IN A      198.xxx.xx.17
pop3                        IN CNAME  domain.com.
smtp                        IN CNAME  domain.com.
www                        IN CNAME  domain.com.

I'm running on centos 6.

Thanks in advance for anyone who has any insight one this.

siremaxus 05-16-2013 08:15 AM

Hello,

Do you have any log from file "/var/log/maillog" that could help troubleshoot this problem?

Sire Maxus

yobogs 05-16-2013 08:18 AM

sorry, i forgot it :

Code:

May 16 17:17:00 server1 postfix-rotate5/smtp[28332]: 2BF18240152A: to=<user@domain.com>, relay=none, delay=1.1, delays=0.64/0.01/0.42/0, dsn=5.4.6, status=bounced (mail for domain.com loops back to myself)
May 16 17:17:00 server1 postfix/cleanup[28331]: 0FC7F2402EEA: message-id=<20130516131700.0FC7F2402EEA@domain.com>
May 16 17:17:00 server1 postfix/bounce[28333]: 2BF18240152A: sender non-delivery notification: 0FC7F2402EEA
May 16 17:17:00 server1 postfix/qmgr[28159]: 0FC7F2402EEA: from=<>, size=3735, nrcpt=1 (queue active)
May 16 17:17:00 server1 postfix/randomizer[28330]: Using: 2 Transport Service
May 16 17:17:00 server1 postfix/qmgr[28159]: 2BF18240152A: removed


siremaxus 05-16-2013 08:29 AM

Hi,

Thanks, while you were posting the logs I checked and missed the "inet_interfaces" field, did you configure that? how?
That line should be like:
inet_interfaces=all

Good Luck

Sire Maxus

yobogs 05-16-2013 08:39 AM

Thank you for your help.

I have added "inet_interfaces=all" in main.cf and restart postfix but i have exactly the same error :(

siremaxus 05-16-2013 09:51 AM

Hi,

If "domain.com" is your domain, what do you have when you do this:
#dig -t mx domain.com

then try again to send an email, but post a longer extract from maillog, one that shows the initial connection and the steps taken after that point.

Sire Maxus

yobogs 05-16-2013 11:13 AM

Code:

dig -t mx domain.com

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.4 <<>> -t mx domain.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 3746
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;domain.com.                    IN      MX

;; ANSWER SECTION:
domain.com.              10800  IN      MX      50 domain.com.

;; Query time: 225 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Thu May 16 20:06:44 2013
;; MSG SIZE  rcvd: 43

And maillog

Code:

May 16 20:09:09 server1 postfix/smtpd[30089]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
May 16 20:09:09 server1 postfix/smtpd[30089]: connect from mail-la0-f41.google.com[209.85.215.41]
May 16 20:09:09 server1 postfix/randomizer[30097]: Using: 4 Transport Service
May 16 20:09:09 server1 postfix/randomizer[30097]: Using: 3 Transport Service
May 16 20:09:09 server1 postfix/randomizer[30097]: Using: 1 Transport Service
May 16 20:09:10 server1 postfix/randomizer[30097]: Using: 0 Transport Service
May 16 20:09:10 server1 postfix/smtpd[30089]: 090FA2402D28: client=mail-la0-f41.google.com[209.85.215.41]
May 16 20:09:10 server1 postfix/cleanup[30098]: 090FA2402D28: message-id=<CAHc-r7_pW8+1aWgMXsy4QGEUKvSTanrB9qaqMNk+5ce6mJuQgw@mail.gmail.com>
May 16 20:09:10 server1 opendkim[17484]: 090FA2402D28: mail-la0-f41.google.com [209.85.215.41] not internal
May 16 20:09:10 server1 opendkim[17484]: 090FA2402D28: not authenticated
May 16 20:09:10 server1 opendkim[17484]: 090FA2402D28: DKIM verification successful
May 16 20:09:10 server1 opendkim[17484]: 090FA2402D28: s=20120113 d=gmail.com SSL
May 16 20:09:10 server1 postfix/qmgr[28742]: 090FA2402D28: from=<mymail@gmail.com>, size=1842, nrcpt=1 (queue active)
May 16 20:09:10 server1 postfix/randomizer[30097]: Using: 0 Transport Service
May 16 20:09:10 server1 postfix/smtpd[30089]: disconnect from mail-la0-f41.google.com[209.85.215.41]
May 16 20:09:10 server1 postfix-rotate1/smtp[30100]: 090FA2402D28: to=<user@domain.com>, relay=none, delay=1.1, delays=0.85/0.01/0.22/0, dsn=5.4.6, status=bounced (mail for domain.com loops back to myself)
May 16 20:09:10 server1 postfix/cleanup[30098]: E3EF12402EEE: message-id=<20130516160910.E3EF12402EEE@domain.com>
May 16 20:09:10 server1 postfix/qmgr[28742]: E3EF12402EEE: from=<>, size=3736, nrcpt=1 (queue active)
May 16 20:09:10 server1 postfix/bounce[30103]: 090FA2402D28: sender non-delivery notification: E3EF12402EEE
May 16 20:09:10 server1 postfix/randomizer[30097]: Using: 2 Transport Service
May 16 20:09:10 server1 postfix/qmgr[28742]: 090FA2402D28: removed
May 16 20:09:12 server1 postfix-rotate3/smtp[30104]: E3EF12402EEE: to=<mymail@gmail.com>, relay=gmail-smtp-in.l.google.com[173.xxx.xx.26]:25, delay=1.6, delays=0.01/0.01/0.68/0.95, dsn=2.0.0, status=sent (250 2.0.0 OK 1368720552 gf3si1919096bkc.200 - gsmtp)
May 16 20:09:12 server1 postfix/qmgr[28742]: E3EF12402EEE: removed

Thanks for your help

siremaxus 05-16-2013 11:39 AM

Hi,

It seems that the DNS query through dig does not have enough information, I can't check properly because I can't your server.
Besides, your dig query asks the server 8.8.8.8 and not any of your DNS server 198.X.X.Y.

maybe that's what is causing your problems

Compare the output from this commands:
#dig -t mx domain.com
and
#dig -t mx yahoo.com

Good Luck,

Sire Maxus

nbhadauria 05-16-2013 02:20 PM

Hi yobogs,

The problem is with your randomizer script. You have to skip your domainname in the script.

Best
Nitin B.

yobogs 05-18-2013 01:37 PM

nbhadauria, It's not working

nbhadauria 05-18-2013 02:12 PM

Can you share the script you are using..

Quote:

Originally Posted by yobogs (Post 4953869)
nbhadauria, It's not working


yobogs 05-18-2013 02:15 PM

Yes of course :

Code:

#!/usr/bin/perl -w
# author: Hari Hendaryanto <hari.h -at- csmcom.com>
 
use strict;
use warnings;
use Sys::Syslog qw(:DEFAULT setlogsock);
 
#
# our transports array, we will define this in master.cf as transport services
#
 
our @array = (
'rotate1:',
'rotate2:',
'rotate3:',
'rotate4:',
'rotate5:'
);
 
#
# Initalize and open syslog.
#
openlog('postfix/randomizer','pid','mail');
 
#
# Autoflush standard output.
#
select STDOUT; $|++;
 
while (<>) {
        chomp;
        # randomizing transports array
        my $random_smtp = int(rand(scalar(@array)));
        if (/^get\s(.+)$/i) {
                print "200 $array[$random_smtp]\n";
                syslog("info","Using: %s Transport Service", $random_smtp);
                next;
        }
 
    print "200 smtp:";
}

Thanks for your help

yobogs 05-18-2013 02:17 PM

Just another information.
When i delete this line in main.cf i have any error, but ip rotation not working :

transport_maps = tcp:[127.0.0.1]:2527
127.0.0.1:2527_time_limit = 3600s

nbhadauria 05-18-2013 02:18 PM

yes the problem is in the script, edit it here to send mails to local:

if (/^get\s(.+)$/i) {
print "200 $array[$random_smtp]\n";
syslog("info","Using: %s Transport Service", $random_smtp);
next;
}


Quote:

Originally Posted by yobogs (Post 4953885)
Yes of course :

Code:

#!/usr/bin/perl -w
# author: Hari Hendaryanto <hari.h -at- csmcom.com>
 
use strict;
use warnings;
use Sys::Syslog qw(:DEFAULT setlogsock);
 
#
# our transports array, we will define this in master.cf as transport services
#
 
our @array = (
'rotate1:',
'rotate2:',
'rotate3:',
'rotate4:',
'rotate5:'
);
 
#
# Initalize and open syslog.
#
openlog('postfix/randomizer','pid','mail');
 
#
# Autoflush standard output.
#
select STDOUT; $|++;
 
while (<>) {
        chomp;
        # randomizing transports array
        my $random_smtp = int(rand(scalar(@array)));
        if (/^get\s(.+)$/i) {
                print "200 $array[$random_smtp]\n";
                syslog("info","Using: %s Transport Service", $random_smtp);
                next;
        }
 
    print "200 smtp:";
}

Thanks for your help


yobogs 05-18-2013 02:39 PM

I'm sorry, I'm not sure I understood what I should do...


All times are GMT -5. The time now is 07:09 PM.