procmail
[Top] [All Lists]

formail recipe that queries asn.routeviews.org

2014-10-20 21:03:50
I've a formail recipe embedded in my .procmailrc file that it's purpose
is to parse out the senders ASN and CIDR. The output of looks like this:
X-senderip: 168.244.164.171
X-asn: ASN-21789
X-cidr: 168.244.164.0/24

Here is the recipe:

RAW_ASN=`host -W 6 -R 10 -t txt $REVERSE_SENDERIP.asn.routeviews.org |
sed -e 's/.* text //' -e 's/"//g'`

ASN = `echo $RAW_ASN | cut -d ' ' -f 1`
ASN_CIDR = `echo $RAW_ASN | cut -d ' ' -f 2`/`echo $RAW_ASN | cut -d ' '
-f 3`
LOG = "ASN= $ASN"

Then the procmail recipes that add this to the message header:

------------------------------------------------------------------------ 
# Add X-SenderIP header.
:0 fhw
* ! ^X-SenderIP:
| $FORMAIL -a "X-SenderIP: $SENDERIP"
#
------------------------------------------------------------------------ 

#
------------------------------------------------------------------------ 
# Add X-ASN header.
:0 fhw
* ! ^X-ASN:
| $FORMAIL -a "X-ASN: ASN-$ASN"
#
------------------------------------------------------------------------ 

#
------------------------------------------------------------------------ 
# Add X-CIDR header.
:0 fhw
* ! ^X-CIDR:
| $FORMAIL -a "X-CIDR: $ASN_CIDR"
#
------------------------------------------------------------------------  

The problem I'm having is that in my procmaillog I'm seeing this
periodically:

host: '.asn.routeviews.org' is not a legal name (empty label)
ASN= From cpollock(_at_)embarqmail(_dot_)com  Mon Oct 20 11:41:44 2014
 Subject: Cron <chris@localhost> fetchmail
--quit; /usr/local/bin/fetchmail -v 
  Folder: /home/chris/Maildir/new/1413823304.2785_1.localhost   

It's not constant as far as what incoming messages it decides to fail
on. I've contacted routeviews.org and they've assured me that the issue
doesn't seem to be there. Since this is a new setup using Ubuntu and
previously in my old Mandriva box I had no issues I'm wondering if it's
a system problem or a problem with the recipes?

Thanks
Chris

-- 
Chris
KeyID 0xE372A7DA98E6705C
31.11°N 97.89°W (Elev. 1092 ft)
20:23:04 up 55 min, 2 users, load average: 0.08, 0.21, 0.27
Ubuntu 14.04.1 LTS, kernel 3.13.0-38-generic

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail