7 messages in net.sourceforge.lists.courier-maildropRe: [maildropl] checking all Received...
FromSent OnAttachments
PollywogSep 27, 2005 2:33 pm 
Tony EarnshawSep 27, 2005 10:48 pm 
Jay LeeSep 28, 2005 6:49 am 
PollywogSep 28, 2005 11:27 am 
PollywogSep 28, 2005 11:33 am 
Jay LeeSep 28, 2005 11:38 am 
PollywogSep 28, 2005 11:40 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [maildropl] checking all Received: headersActions...
From:Jay Lee (jl@pbu.edu)
Date:Sep 28, 2005 11:38:08 am
List:net.sourceforge.lists.courier-maildrop

Pollywog wrote:

On 09/27/2005 10:23 pm, Tony Earnshaw wrote:

Pollywog wrote:

I am unable to get maildrop to examine all the "Received:" headers of messages. It only looks at the topmost "Received:" headers. Is it

possible

to get maildrop to examine all the Received: headers without having to concatenate them first?

Which version?

Using every version of maildrop I've ever used at debug -V5 and scrolling the output on an xterm on my rigs has always shown it searching every header.

hi courier-authda 0.47-4 Courier Mail Server - Authentication daemon hi courier-authmy 0.47-4 Courier Mail Server - MySQL authentication hi courier-authpo 0.47-4 Courier Mail Server - PostgreSQL Authenticat hi courier-base 0.47-4 Courier Mail Server - Base system ii courier-doc 0.47-4 Courier Mail Server - Additional documentati hi courier-imap 3.0.8-4 Courier Mail Server - IMAP server hi courier-imap-s 3.0.8-4 Courier Mail Server - IMAP over SSL hi courier-ldap 0.47-4 Courier Mail Server - LDAP support hi courier-maildr 0.47-4 Courier Mail Server - Mail delivery agent hi courier-ssl 0.47-4 Courier Mail Server - SSL/TLS Support hi courier-webadm 0.47-4 Courier Mail Server - Web-based administrati

I will try to find out how to do what you suggested, but it appears that only the first header is being examined:

FILTERS=$HOME/.filters if ( /^Received:.*/ && lookup( $MATCH, "$FILTERS/dat.badrcvd" )) { to "$HOME/Maildir/.Spam-rcvd/" }

dat.badrcvd consists of spam domains and IP addresses. It seems to work but only on the first "Received:" header and I can have Postfix deal with those (I use Postfix not Courier-MTA). I know I could have Postfix check all Received headers but would rather not do that primarily because I want to deal with it on a per-user basis.

Only the *first match* is examined. After the pattern match is found, maildrop returns 1 and continues (as is explained in the section I pointed you to under Weighted Scoring). If you want to search for multiple occurances, you'll need to use an external script via backticks. I use this to grab the 2nd Received header myself when the mail comes in from my backup MX server:

/^Received: from .*\[!.*!\].*/:h SENDER_IP=$MATCH2 if ($SENDER_IP eq '1.2.3.4') #where 1.2.3.4 is my backup mx ip { $SENDER_IP=`/var/php/bmx-block.php` }

bmx-block.php parses the entire headers and returns the IP Address from the 2nd Received: header. Yes, it's php and I know it's much less efficient than perl but I know PHP much better than I do perl and I'm on a Dual Opteron so I can afford the wasted CPU time :) Of course, Maildrop 2.0 and pcre would require some changes, until I get time to test those out, I just added the MAILDROP_OLD_REGEXP=1 line to maildroprc.

Jay