LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Mail is looping back (https://www.linuxquestions.org/questions/linux-server-73/mail-is-looping-back-677192/)

alitrix 10-17-2008 03:52 PM

Mail is looping back
 
Hi,

I'm having some strange things going on my email server.
I have my own domain, alitrix.nl
Which includes IMAP (dovecot) and postfix (smpt and the relay part).

With fetchmail I login on some POP3 accounts and get the mails and put them in the IMAP mailbox of my own home-dir (so I have a "central" place for my mail)
Everything works fine, until here.

With /etc/procmailrc I check the mail headers and put the mail in the correct directory.


I've installed Thunderbird and configured my IMAP server.
I added identies into Thunderbird, so I can send as alitrix@alitrix.nl, postfix@alitrix.nl, etc. etc. With the same IMAP account.

The strange part is, for some reason my email is looping back as well

This is what I do
alitrix@gmail.com receives the email, just like it should.
Raw email:
Code:

                                                                                                                                                                                                                                                             
Delivered-To: alitrix@gmail.com
Received: by 10.151.85.17 with SMTP id n17cs180247ybl;
        Fri, 17 Oct 2008 13:47:48 -0700 (PDT)
Received: by 10.66.220.12 with SMTP id s12mr418204ugg.5.1224276466809;
        Fri, 17 Oct 2008 13:47:46 -0700 (PDT)
Return-Path: <alitrix@alitrix.nl>
Received: from kdiss.alitrix.nl (217.170.21.50 [217.170.21.50])
        by mx.google.com with ESMTP id k30si1117910ugc.43.2008.10.17.13.47.46;
        Fri, 17 Oct 2008 13:47:46 -0700 (PDT)
Received-SPF: neutral (google.com: 217.170.21.50 is
neither permitted nor denied by best guess record for domain of alitrix@alitrix.nl)
client-ip=217.170.21.50;
Authentication-Results: mx.google.com; spf=neutral (google.com: 217.170.21.50 is neither
 permitted nor denied by best guess record for domain of alitrix@alitrix.nl) smtp.mail=alitrix@alitrix.nl
Received: by kdiss.alitrix.nl (Postfix, from userid 1007)
        id 97DEB45827A; Fri, 17 Oct 2008 22:55:33 +0200 (CEST)
X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on r1k7s19.kdiss.com
X-Spam-Level:
X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00
        autolearn=ham version=3.2.4
Received: from [192.168.1.76] (195-240-191-88.ip.telfort.nl [195.240.191.88])
        by kdiss.alitrix.nl (Postfix) with ESMTPA id 553B9458172
        for <alitrix@gmail.com>; Fri, 17 Oct 2008 22:55:18 +0200 (CEST)
Message-ID: <48F8F9B4.6070604@alitrix.nl>
Date: Fri, 17 Oct 2008 22:46:44 +0200
From: AliTrix <alitrix@alitrix.nl>
User-Agent: Thunderbird 2.0.0.17 (Windows/20080914)
MIME-Version: 1.0
To: alitrix@gmail.com
Subject: Test LQ
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Loop, why?

In Thunderbird I cee the same mail coming back as well
Raw email:
Code:

Return-Path: <alitrix@alitrix.nl>
X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on r1k7s19.kdiss.com
X-Spam-Level:
X-Spam-Status: No, score=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00
        autolearn=ham version=3.2.4
X-Original-To: alitrix@alitrix.nl
Delivered-To: alitrix@r1k7s19.kdiss.com
Received: by kdiss.alitrix.nl (Postfix, from userid 1007)
        id 97DEB45827A; Fri, 17 Oct 2008 22:55:33 +0200 (CEST)
Received: from [192.168.1.76] (195-240-191-88.ip.telfort.nl [195.240.191.88])
        by kdiss.alitrix.nl (Postfix) with ESMTPA id 553B9458172
        for <alitrix@gmail.com>; Fri, 17 Oct 2008 22:55:18 +0200 (CEST)
Message-ID: <48F8F9B4.6070604@alitrix.nl>
Date: Fri, 17 Oct 2008 22:46:44 +0200
From: AliTrix <alitrix@alitrix.nl>
User-Agent: Thunderbird 2.0.0.17 (Windows/20080914)
MIME-Version: 1.0
To: alitrix@gmail.com
Subject: Test LQ
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Loop, why?

/etc/procmailrc
Code:

DROPPRIVS=yes
PATH=/usr/local/bin:/usr/bin:/bin
MAILDIR=$HOME/.mailbox/
DEFAULT=$HOME/.mailbox/
LOGFILE=$MAILDIR/procmail.logfile
VERBOSE=on
LOGABSTRACT=all

:0fw: spamassassin.lock
| spamassassin
:0
* ^X-Spam-Flag:.*YES
.INBOX.Spam/

:0
* ^(To|Cc):.*alitrix@alitrix\.nl
.INBOX.alitrix_nl.ali/

:0
* ^(To|Cc):.*postfix@alitrix\.nl
.INBOX.alitrix_nl.ali/

What could be the reason for the loopback?
Did I miss something in the configuration?

If you need too see any other configuration, please tell me.

Greetz,

Alitrix

billymayday 10-17-2008 04:21 PM

What does you mail log file show during the delivery cycle?

Edit - can you put a couple of line breaks in your first code section so the page automatically narrows?

alitrix 10-17-2008 04:35 PM

I added some enters, but the width isn't changeing :(

My log:
Code:

==> mail.info <==
Oct 17 23:40:05 r1k7s19 postfix/smtpd[9698]: connect from 195-240-191-xx.ip.telfort.nl[195.240.191.xx]
Oct 17 23:40:06 r1k7s19 postfix/smtpd[9698]: 339B4458172: client=195-240-191-xx.ip.telfort.nl[195.240.191.xx], sasl_method=PLAIN, sasl_username=alitrix

==> mail.log <==
Oct 17 23:40:05 r1k7s19 postfix/smtpd[9698]: connect from 195-240-191-xx.ip.telfort.nl[195.240.191.xx]
Oct 17 23:40:06 r1k7s19 postfix/smtpd[9698]: 339B4458172: client=195-240-191-xx.ip.telfort.nl[195.240.191.xx], sasl_method=PLAIN, sasl_username=alitrix

==> mail.info <==
Oct 17 23:40:06 r1k7s19 postfix/cleanup[9702]: 339B4458172: message-id=<48F90436.1030001@alitrix.nl>
Oct 17 23:40:06 r1k7s19 postfix/qmgr[26071]: 339B4458172: from=<alitrix@alitrix.nl>, size=540, nrcpt=1 (queue active)
Oct 17 23:40:06 r1k7s19 postfix/smtpd[9698]: disconnect from 195-240-191-xx.ip.telfort.nl[195.240.191.xx]

==> mail.log <==
Oct 17 23:40:06 r1k7s19 postfix/cleanup[9702]: 339B4458172: message-id=<48F90436.1030001@alitrix.nl>
Oct 17 23:40:06 r1k7s19 postfix/qmgr[26071]: 339B4458172: from=<alitrix@alitrix.nl>, size=540, nrcpt=1 (queue active)
Oct 17 23:40:06 r1k7s19 postfix/smtpd[9698]: disconnect from 195-240-191-xx.ip.telfort.nl[195.240.191.xx]

==> mail.info <==
Oct 17 23:40:07 r1k7s19 dovecot: imap-login: Login: user=<alitrix>, method=PLAIN, rip=195.240.191.xx, lip=217.170.21.50, TLS

==> mail.log <==
Oct 17 23:40:07 r1k7s19 dovecot: imap-login: Login: user=<alitrix>, method=PLAIN, rip=195.240.191.xx, lip=217.170.21.50, TLS

==> mail.info <==
Oct 17 23:40:21 r1k7s19 postfix/pipe[9703]: 339B4458172: to=<alitrix@gmail.com>, relay=spamfilter, delay=15, delays=0.26/0/0/15, dsn=2.0.0,
status=sent (delivered via spamfilter service)
Oct 17 23:40:21 r1k7s19 postfix/qmgr[26071]: 339B4458172: removed
Oct 17 23:40:21 r1k7s19 postfix/pickup[9423]: 6516F45827A: uid=1007 from=<alitrix@alitrix.nl>
Oct 17 23:40:21 r1k7s19 postfix/cleanup[9702]: 6516F45827A: message-id=<48F90436.1030001@alitrix.nl>
Oct 17 23:40:21 r1k7s19 postfix/qmgr[26071]: 6516F45827A: from=<alitrix@alitrix.nl>, size=855, nrcpt=2 (queue active)

==> mail.log <==
Oct 17 23:40:21 r1k7s19 postfix/pipe[9703]: 339B4458172: to=<alitrix@gmail.com>, relay=spamfilter, delay=15, delays=0.26/0/0/15, dsn=2.0.0,
status=sent (delivered via spamfilter service)
Oct 17 23:40:21 r1k7s19 postfix/qmgr[26071]: 339B4458172: removed
Oct 17 23:40:21 r1k7s19 postfix/pickup[9423]: 6516F45827A: uid=1007 from=<alitrix@alitrix.nl>
Oct 17 23:40:21 r1k7s19 postfix/cleanup[9702]: 6516F45827A: message-id=<48F90436.1030001@alitrix.nl>
Oct 17 23:40:21 r1k7s19 postfix/qmgr[26071]: 6516F45827A: from=<alitrix@alitrix.nl>, size=855, nrcpt=2 (queue active)

==> mail.info <==
Oct 17 23:40:22 r1k7s19 postfix/smtp[9681]: 6516F45827A: to=<alitrix@gmail.com>, relay=gmail-smtp-in.l.google.com[66.249.93.114]:25, delay=16, delays=15/0/0.04/0.87,
dsn=2.0.0, status=sent (250 2.0.0 OK 1224279154 j27si631390ugc.7)

==> mail.log <==
Oct 17 23:40:22 r1k7s19 postfix/smtp[9681]: 6516F45827A: to=<alitrix@gmail.com>, relay=gmail-smtp-in.l.google.com[66.249.93.114]:25, delay=16, delays=15/0/0.04/0.87,
dsn=2.0.0, status=sent (250 2.0.0 OK 1224279154 j27si631390ugc.7)

==> mail.info <==
Oct 17 23:40:36 r1k7s19 postfix/local[9715]: 6516F45827A: to=<alitrix@r1k7s19.kdiss.com>, orig_to=<alitrix@alitrix.nl>, relay=local, delay=30, delays=15/0.01/0/15,
dsn=2.0.0, status=sent (delivered to command: procmail -a "$EXTENSION")
Oct 17 23:40:36 r1k7s19 postfix/qmgr[26071]: 6516F45827A: removed

==> mail.log <==
Oct 17 23:40:36 r1k7s19 postfix/local[9715]: 6516F45827A: to=<alitrix@r1k7s19.kdiss.com>, orig_to=<alitrix@alitrix.nl>, relay=local, delay=30, delays=15/0.01/0/15,
dsn=2.0.0, status=sent (delivered to command: procmail -a "$EXTENSION")
Oct 17 23:40:36 r1k7s19 postfix/qmgr[26071]: 6516F45827A: removed


billymayday 10-17-2008 04:40 PM

This doesn't show a local delivery though

alitrix 10-17-2008 04:57 PM

Well, this part:
Oct 17 23:40:36 r1k7s19 postfix/local[9715]: 6516F45827A: to=<alitrix@r1k7s19.kdiss.com>, orig_to=<alitrix@alitrix.nl>, relay=local, delay=30, delays=15/0.01/0/15,
dsn=2.0.0, status=sent (delivered to command: procmail -a "$EXTENSION")

Doesn't look good. Why if the From-address = alitrix@alitrix.nl, it gets back to the server? (r1k7s19.kdiss.com = servername + host)
I didn't understand that part.

billymayday 10-17-2008 05:07 PM

Can you show ALL the relevant parts of the log.

That would be from 23:40:21 to after 23:40:36 at least

alitrix 10-17-2008 05:31 PM

This is all of it, but in tail -f mail.log mail.info

But incase it's a bit confusing:
mail.log
Code:

Oct 17 23:40:05 r1k7s19 postfix/smtpd[9698]: connect from 195-240-191-xx.ip.telfort.nl[195.240.191.xx]
Oct 17 23:40:06 r1k7s19 postfix/smtpd[9698]: 339B4458172: client=195-240-191-xx.ip.telfort.nl[195.240.191.xx], sasl_method=PLAIN, sasl_username=alitrix
Oct 17 23:40:06 r1k7s19 postfix/cleanup[9702]: 339B4458172: message-id=<48F90436.1030001@alitrix.nl>
Oct 17 23:40:06 r1k7s19 postfix/qmgr[26071]: 339B4458172: from=<alitrix@alitrix.nl>, size=540, nrcpt=1 (queue active)
Oct 17 23:40:06 r1k7s19 postfix/smtpd[9698]: disconnect from 195-240-191-xx.ip.telfort.nl[195.240.191.xx]
Oct 17 23:40:07 r1k7s19 dovecot: imap-login: Login: user=<alitrix>, method=PLAIN, rip=195.240.191.xx, lip=217.170.21.50, TLS
Oct 17 23:40:21 r1k7s19 postfix/pipe[9703]: 339B4458172: to=<alitrix@gmail.com>, relay=spamfilter, delay=15, delays=0.26/0/0/15, dsn=2.0.0, status=sent (delivered via spamfilter service)
Oct 17 23:40:21 r1k7s19 postfix/qmgr[26071]: 339B4458172: removed
Oct 17 23:40:21 r1k7s19 postfix/pickup[9423]: 6516F45827A: uid=1007 from=<alitrix@alitrix.nl>
Oct 17 23:40:21 r1k7s19 postfix/cleanup[9702]: 6516F45827A: message-id=<48F90436.1030001@alitrix.nl>
Oct 17 23:40:21 r1k7s19 postfix/qmgr[26071]: 6516F45827A: from=<alitrix@alitrix.nl>, size=855, nrcpt=2 (queue active)
Oct 17 23:40:22 r1k7s19 postfix/smtp[9681]: 6516F45827A: to=<alitrix@gmail.com>, relay=gmail-smtp-in.l.google.com[66.249.93.114]:25, delay=16, delays=15/0/0.04/0.87,
dsn=2.0.0, status=sent (250 2.0.0 OK 1224279154 j27si631390ugc.7)
Oct 17 23:40:36 r1k7s19 postfix/local[9715]: 6516F45827A: to=<alitrix@r1k7s19.kdiss.com>, orig_to=<alitrix@alitrix.nl>, relay=local, delay=30, delays=15/0.01/0/15,
dsn=2.0.0, status=sent (delivered to command: procmail -a "$EXTENSION")
Oct 17 23:40:36 r1k7s19 postfix/qmgr[26071]: 6516F45827A: removed

mail.info
Code:

Oct 17 23:40:05 r1k7s19 postfix/smtpd[9698]: connect from 195-240-191-xx.ip.telfort.nl[195.240.191.xx]
Oct 17 23:40:06 r1k7s19 postfix/smtpd[9698]: 339B4458172: client=195-240-191-xx.ip.telfort.nl[195.240.191.xx], sasl_method=PLAIN, sasl_username=alitrix
Oct 17 23:40:06 r1k7s19 postfix/cleanup[9702]: 339B4458172: message-id=<48F90436.1030001@alitrix.nl>
Oct 17 23:40:06 r1k7s19 postfix/qmgr[26071]: 339B4458172: from=<alitrix@alitrix.nl>, size=540, nrcpt=1 (queue active)
Oct 17 23:40:06 r1k7s19 postfix/smtpd[9698]: disconnect from 195-240-191-xx.ip.telfort.nl[195.240.191.xx]
Oct 17 23:40:07 r1k7s19 dovecot: imap-login: Login: user=<alitrix>, method=PLAIN, rip=195.240.191.xx, lip=217.170.21.50, TLS
Oct 17 23:40:21 r1k7s19 postfix/pipe[9703]: 339B4458172: to=<alitrix@gmail.com>, relay=spamfilter, delay=15, delays=0.26/0/0/15, dsn=2.0.0, status=sent (delivered via spamfilter service)
Oct 17 23:40:21 r1k7s19 postfix/qmgr[26071]: 339B4458172: removed
Oct 17 23:40:21 r1k7s19 postfix/pickup[9423]: 6516F45827A: uid=1007 from=<alitrix@alitrix.nl>
Oct 17 23:40:21 r1k7s19 postfix/cleanup[9702]: 6516F45827A: message-id=<48F90436.1030001@alitrix.nl>
Oct 17 23:40:21 r1k7s19 postfix/qmgr[26071]: 6516F45827A: from=<alitrix@alitrix.nl>, size=855, nrcpt=2 (queue active)
Oct 17 23:40:22 r1k7s19 postfix/smtp[9681]: 6516F45827A: to=<alitrix@gmail.com>, relay=gmail-smtp-in.l.google.com[66.249.93.114]:25, delay=16, delays=15/0/0.04/0.87,
dsn=2.0.0, status=sent (250 2.0.0 OK 1224279154 j27si631390ugc.7)
Oct 17 23:40:36 r1k7s19 postfix/local[9715]: 6516F45827A: to=<alitrix@r1k7s19.kdiss.com>, orig_to=<alitrix@alitrix.nl>, relay=local, delay=30, delays=15/0.01/0/15,
dsn=2.0.0, status=sent (delivered to command: procmail -a "$EXTENSION")
Oct 17 23:40:36 r1k7s19 postfix/qmgr[26071]: 6516F45827A: removed


billymayday 10-17-2008 05:36 PM

What is kdiss.com?

Are you sure you don't have any forwards in gmail?

Are any of your aliases applicable?

Can you post "postconf -n" please

alitrix 10-17-2008 05:54 PM

kdiss.com is the hosting company of the dedicated server.

# postconf -n
Code:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
home_mailbox = .mailbox/
inet_interfaces = all
local_recipient_maps =
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
mydestination = localhost, r1k7s19, r1k7s19.kdiss.com
myhostname = kdiss.alitrix.nl
mynetworks = 127.0.0.0/8
myorigin = /etc/mailname
recipient_delimiter = +
relayhost =
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_helo_required = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,        permit_mynetworks,        reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf
virtual_mailbox_base = /home/
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf

mysql-virtual_forwardings.cf contains a sql query (query = SELECT goto FROM alias WHERE address='%s'), which contains:
Code:

+--------------------+---------+------------+---------------------+---------------------+--------+
| address            | goto    | domain    | created            | modified            | active |
+--------------------+---------+------------+---------------------+---------------------+--------+
| alitrix@alitrix.nl | alitrix | alitrix.nl | 2008-06-01 18:32:48 | 2008-06-01 18:32:48 |      1 |
| @alitrix.nl        | alitrix | alitrix.nl | 2008-06-01 21:39:17 | 2008-06-01 21:39:17 |      1 |
+--------------------+---------+------------+---------------------+---------------------+--------+

mysql-virtual_domains.cf contains a sql query (query = SELECT domain AS virtual FROM domain WHERE domain='%s'), which contains:
Code:

+------------+-------------+---------+-----------+----------+-------+-----------+----------+---------------------+---------------------+--------+
| domain    | description | aliases | mailboxes | maxquota | quota | transport | backupmx | created            | modified            | active |
+------------+-------------+---------+-----------+----------+-------+-----------+----------+---------------------+---------------------+--------+
| ALL        |            |      0 |        0 |        0 |    0 | NULL      |        0 | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 |      1 |
| alitrix.nl | alitrix.nl  |      0 |        0 |        0 |    0 |          |        0 | 2008-06-01 18:13:55 | 2008-06-01 22:48:35 |      1 |
+------------+-------------+---------+-----------+----------+-------+-----------+----------+---------------------+---------------------+--------+


billymayday 10-17-2008 06:00 PM

I'm expecting you have an aliase of

alitrix@alitrix.com: alitrix@r1k7s19.kdiss.com

What else is in there?

Again, are you sure you don't have any forwards set in gmail?

alitrix 10-18-2008 05:02 AM

That's all I have, I dont have any other aliases nor alias files.
I only put them in that table if I need any alias/forward.

I checked my gmail, I dont have a forward there as well.
I think it's the alias-table that is getting used, but I dont understand why postfix is doing a check on the From-address?
Doesn't sound logic to me, cause this way the email is looping and then it loops that mail and that mail, etc.

billymayday 10-18-2008 05:26 AM

See /etc/aliases.

I agree - something is weird.

alitrix 10-18-2008 06:01 AM

# cat /etc/aliases
Code:

# Added by installer for initial user
root: serveradmin

Nothing special inside

I've monitored the queries, check this:
Sending mail to alitrix...@hotmail.com
Code:

081018 13:09:59  78473 Connect    postfix@localhost on postfix
                  78473 Query      SELECT goto FROM alias WHERE address='alitrix.nl'
                  78474 Connect    postfix@localhost on postfix
                  78474 Query      SELECT domain AS virtual FROM domain WHERE domain='alitrix.nl'
                  78473 Query      SELECT goto FROM alias WHERE address='hotmail.com'
                  78474 Query      SELECT domain AS virtual FROM domain WHERE domain='hotmail.com'
                  78473 Query      SELECT goto FROM alias WHERE address='alitrixxxx@hotmail.com'
                  78473 Query      SELECT goto FROM alias WHERE address='@hotmail.com'
                  78473 Query      SELECT goto FROM alias WHERE address='alitrixxxx@hotmail.com'
                  78473 Query      SELECT goto FROM alias WHERE address='@hotmail.com'

The mail looping back
Code:

081018 13:10:14  78475 Connect    postfix@localhost on postfix
                  78475 Query      SELECT goto FROM alias WHERE address='alitrixxxx@hotmail.com'
                  78475 Query      SELECT goto FROM alias WHERE address='@hotmail.com'
                  78475 Query      SELECT goto FROM alias WHERE address='alitrix@alitrix.nl'
                  78475 Query      SELECT goto FROM alias WHERE address='alitrix@r1k7s19.kdiss.com'
                  78475 Query      SELECT goto FROM alias WHERE address='alitrix'
                  78475 Query      SELECT goto FROM alias WHERE address='@r1k7s19.kdiss.com'
                  78475 Query      SELECT goto FROM alias WHERE address='hotmail.com'
                  78476 Connect    postfix@localhost on postfix
                  78476 Query      SELECT domain AS virtual FROM domain WHERE domain='hotmail.com'
                  78475 Query      SELECT goto FROM alias WHERE address='r1k7s19.kdiss.com'
                  78476 Query      SELECT domain AS virtual FROM domain WHERE domain='r1k7s19.kdiss.com'

You see, the first time it's doing a check on alitrix.nl, but it's a From-address.
Really strange... :(

alitrix 10-18-2008 04:02 PM

Nobody a clue? :(?

billymayday 10-18-2008 04:10 PM

I'll have a look later in the day if you don't hear anything.

What is the intention of the virtual forwardings? I don't use SQL tables, but it looks to me like you are copying anything to altrix.nl to altrix (which I assume is a valid user on your domain - the kdiss one)


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