LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   postfix/fetchmail mail filtering trouble (https://www.linuxquestions.org/questions/linux-server-73/postfix-fetchmail-mail-filtering-trouble-4175447412/)

compused 01-27-2013 07:59 AM

postfix/fetchmail mail filtering trouble
 
Mail from Internode's (an ISP) mail server is ending up in the
.INBOX.Internode maildir folder as configured on my home NAS device, but even after upgrading fetchmail , mail downloaded
to the NAS device, from my self-managed Dallas server is ending up in the DEFAULT maildir directory when it should be in the .INBOX.lists maildir,

ie to keep it simple I have listed in ~/.mailfilter:
Code:

DEFAULT="$HOME/Maildir"
LISTS="$HOME/Maildir/.INBOX.lists"
INTERNODE="$HOME/Maildir/.INBOX.Internode"

This is whats currently & was previously tried in maildrop for intended
mail to the $LISTS maildir:
Code:

#if (/^To:.*lists@mydomain\.com\.au/)
#if /^To:.*lists@mydomain\.com\.au/
#if (/lists@mydomain\.com\.au/)
#if (/^(X\-Original\-To):.*lists@mydomain\.com\.au/)
#if (/(X-Original-To|Delivered-To):.*lists@mydomain\.com\.au/)
#if (/^(To|Cc|Bcc):.*lists@mydomain\.com\.au/)
if (/(X-Original-To):.*lists@mydomain\.com\.au/)
{
 to $LISTS
}


and the maildrop rule for mail to $INTERNODE:
Code:

if (/^(To|Cc|Bcc):.*michaeldaly@internode\.on\.net/)
{
 to $INTERNODE  <--$LISTS here delivers to LISTS
}


Funnily enough, there's no entry at all in maildrop's log for these anomalous mail deliveries from my Dallas based server...the only maildrop log entries I find relate to mail delivered from Internode. It seems to suggest maildrop is being bypassed for mail from Dallas?

Subsequently manually running the mis-delivered emails through the maildrop program on command line sees the same emails delivered
*correctly* ie a regex MATCH is produced, as configured in the maildrop mailfilter file. Perhaps a reason for this, as I noticed from the fetchmail logs, is that headers on the emails are 're-written' on delivery?

Am using maildir settings and as far as I can see, the ~/maildir configuration is consistent across postfix, dovecot and maildrop.

Whats even more anomalous is the mail from one server *is* delivered as expect, but not mail from a different server.

Am running postfix, dovecot, fetchmail and maildrop

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
The header information for the Internode sourced mail, which is working:
Code:

X-Default-Received-SPF: pass (skip=trusted (res=PASS))
x-ip-name=150.101.137.129;
Received: from mail.internode.on.net [203.16.214.182]
        by NASC2089B with POP3 (fetchmail-6.3.21)
        for <mdtesting@localhost> (single-drop); Sun, 27 Jan 2013 11:21:23 +1100
(EST)
Received: from ipmail06.adl2.internode.on.net (unverified [150.101.137.129])
        by mail.internode.on.net (SurgeMail 5.3i) with ESMTP id 98726825-1927428
        for <michaeldaly@internode.on.net>; Sun, 27 Jan 2013 09:29:18 +1030 (CDT)
Return-Path: <michaeldaly@internode.on.net>
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result:
AtMEAOteBFGWZYqG/2dsb2JhbAAjIYVdabg3c4I+Cm4GAQI8AnqICJ1wjlSFBYxwjXeCFoETA6ZVgwo
Received: from webmail3.internode.on.net (HELO localhost) ([150.101.138.134])
  by ipmail06.adl2.internode.on.net with ESMTP; 27 Jan 2013 09:29:18 +1030
Message-Id:
<1eeb7860523810cac154fe8109212d7f463e8629@webmail.internode.on.net>
From: michaeldaly@internode.on.net
To: michaeldaly@internode.on.net
X-Mailer: Atmail 6.20.12
Subject: from internode, to self, 9.59am
Date: Sun, 27 Jan 2013 09:29:18 +1030
Content-Type: multipart/alternative;
 boundary="=_d699a8f58b9516b55b25e96fab103fba"
MIME-Version: 1.0
X-Rcpt-To: <michaeldaly@internode.on.net>
X-SpamDetect: : -9.161000 IronPort SPAM scanned=-10.0, From: does not
include a real name=0.8
X-NotAscii: charset=utf-8
X-LangGuess: Unknown
X-IP-stats: Incoming Last 0, First 682, in=12751, out=0, spam=0
ip=150.101.138.134
Status: RO
X-UIDL: 35

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

The header information for mail from the Dallas server, which is NOT working as expected (note the msg was initially sent from Internode to Dallas):
Code:

Return-Path: <michaeldaly@internode.on.net>
X-Original-To: mdtesting@localhost
Delivered-To: mdtesting@localhost.localdomain
Received: from NASC2089B (localhost [127.0.0.1])
        by NASC2089B.localdomain (Postfix) with ESMTP id A67305020C11
        for <mdtesting@localhost>; Sun, 27 Jan 2013 13:18:14 +1100 (EST)
X-Original-To: lists@mydomain.com.au
Delivered-To: lists@mydomain.com.au
Received: from mydomain.com.au
        by NASC2089B with POP3 (fetchmail-6.3.24)
        for <mdtesting@localhost> (single-drop); Sun, 27 Jan 2013 13:18:14 +1100
(EST)
Received: from ipmail06.adl2.internode.on.net
(ipmail06.adl2.internode.on.net [150.101.137.129])
        by mydomain.com.au (Postfix) with ESMTP id 49A3C7C198
        for <lists@mydomain.com.au>; Sun, 27 Jan 2013 13:12:50 +1100 (EST)
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result:
AtMEAAKNBFGWZYqG/2dsb2JhbAAkIYVdabg1c4JIbgYBAjwCeogInX+OVIUFjHONd4IWgRMDplWDCg
Received: from webmail3.internode.on.net (HELO localhost) ([150.101.138.134])
  by ipmail06.adl2.internode.on.net with ESMTP; 27 Jan 2013 12:47:25 +1030
Message-Id:
<02f6b14d3673d4cfa3f4d2ceb093838a61d950e5@webmail.internode.on.net>
From: michaeldaly@internode.on.net
To: lists@mydomain.com.au
X-Mailer: Atmail 6.20.12
Subject: from internode to lists, fetch 6.3.24,
(/(X-Original-To):.*lists@mydomain\.com\.au/) ie no caret
Date: Sun, 27 Jan 2013 12:47:25 +1030
Content-Type: multipart/alternative;
 boundary="=_5f0713c2737273fc59c2cbceab283353"
MIME-Version: 1.0

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This is the fetchmail log for a message received by
Code:

list@mydomain.com.au
(as sent from Internode, as it happens):

fetchmail: 6.3.24 querying mydomain.com.au (protocol POP3) at Sun Jan 27
13:58:09 2013: poll completed
fetchmail: New UID list from mydomain.com.au: <empty>
fetchmail: not swapping UID lists, no UIDs seen this query
fetchmail: Query status=1 (NOMAIL)
fetchmail: 6.3.24 querying mydomain.com.au (protocol POP3) at Sun Jan 27
13:58:09 2013: poll started
fetchmail: Trying to connect to (server's ip address)/110...connected.
fetchmail: POP3< +OK Dovecot ready.
fetchmail: POP3> CAPA
fetchmail: POP3< +OK
fetchmail: POP3< CAPA
fetchmail: POP3< TOP
fetchmail: POP3< UIDL
fetchmail: POP3< RESP-CODES
fetchmail: POP3< PIPELINING
fetchmail: POP3< STLS
fetchmail: POP3< USER
fetchmail: POP3< SASL PLAIN
fetchmail: POP3< .
fetchmail: POP3> USER lists
fetchmail: POP3< +OK
fetchmail: POP3> PASS *
fetchmail: POP3< +OK Logged in.
fetchmail: selecting or re-polling default folder
fetchmail: POP3> STAT
fetchmail: POP3< +OK 1 1357
fetchmail: POP3> UIDL
fetchmail: POP3< +OK
fetchmail: POP3< 1 00004d58473af082
fetchmail: 1 is unseen
fetchmail: POP3< .
fetchmail: 1 message for lists at mydomain.com.au (1357 octets).
fetchmail: POP3> LIST 1
fetchmail: POP3< +OK 1 1357
fetchmail: POP3> TOP 1 99999999
fetchmail: POP3< +OK
fetchmail: reading message lists@mydomain.com.au:1 of 1 (1357 octets)About
to rewrite Return-Path: <michaeldaly@internode.on.net>...
...rewritten version is Return-Path: <michaeldaly@internode.on.net>.
fetchmail: About to rewrite From: michaeldaly@internode.on.net...
...rewritten version is From: michaeldaly@internode.on.net.
fetchmail: About to rewrite To: lists@mydomain.com.au...
...rewritten version is To: lists@mydomain.com.au.
fetchmail: Trying to connect to 127.0.0.1/25...connected.
fetchmail: SMTP< 220 NASC2089B.localdomain ESMTP Postfix
fetchmail: SMTP> EHLO NASC2089B
fetchmail: SMTP< 250-NASC2089B.localdomain
fetchmail: SMTP< 250-PIPELINING
fetchmail: SMTP< 250-SIZE 10240000
fetchmail: SMTP< 250-VRFY
fetchmail: SMTP< 250-ETRN
fetchmail: SMTP< 250-ENHANCEDSTATUSCODES
fetchmail: SMTP< 250-8BITMIME
fetchmail: SMTP< 250 DSN
fetchmail: forwarding to localhost
fetchmail: SMTP> MAIL FROM:<michaeldaly@internode.on.net> SIZE=1357
fetchmail: SMTP< 250 2.1.0 Ok
fetchmail: SMTP> RCPT TO:<mdtesting@localhost>
fetchmail: SMTP< 250 2.1.5 Ok
fetchmail: SMTP> DATA
fetchmail: SMTP< 354 End data with <CR><LF>.<CR><LF>
fetchmail: SMTP>. (EOM)
fetchmail: SMTP< 250 2.0.0 Ok: queued as 621E05020C11
fetchmail:  flushed
fetchmail: POP3> DELE 1
fetchmail: POP3< +OK Marked to be deleted.
fetchmail: POP3> QUIT
fetchmail: POP3< +OK Logging out, messages deleted.
fetchmail: SMTP> QUIT
fetchmail: SMTP< 221 2.0.0 Bye

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
finally, /opt/etc/fetchmailrc has:
Code:

poll mydomain.com.au service 110 protocol pop3 uidl
user "lists" password "XXXXXX" is "mdtesting" here

poll mail.internode.on.net service 110 protocol pop3 uidl
user "michaeldaly" password "XXXXXX" is "mdtesting" here
mda "/opt/bin/maildrop -d %s"

Would really appreciate any advice on this
Thanks
Compfused


All times are GMT -5. The time now is 07:48 AM.