At 09:30 2006-08-15 +0200, Udi Mottelo wrote:
On Tue, 15 Aug 2006, Brandon Enright wrote:
On Mon, 2006-08-14 at 19:42 -0500, Jack Stone wrote:
I am trying to use a procmail recipe that first runs a perl script to get
the "remote IP" of a message, but I have a syntax error in the perl
script.
Got the script from SORBS.
I'm not a perl expert but I think that if you get a message with
Subject: Matlab ver. [9.44.300.6] The following scripts will give
you junk.
You should ask your self and fine the answer in the place where
you took the script, what is "remote IP".
Well, let's face it, the thing looks for IP-octet-like constructs, not even
limited to the octet ranges, or limited to Received: type headers.
I pointed out that it can be easily accomplished within procmail. I
probably should have specifically pointed the OP to my sandbox page, where
the following code can be found as part of the standard setup. This is
also part of my standard .procmailrc, executed on each and every message
that reaches my inbox:
# Obtain the hostname of the host which relayed the message to us.
# This is found in the topmost received header.
# can do this, at expense of additional process:
# RELAYHOSTX=`formail -u Received: -czx Received:`
:0
* ^Received:\/ from.*
{
RELAYHOSTX=$MATCH
}
# The hostname provided in the SMTP EHLO exchange will be the first
# token on this line.
:0
* RELAYHOSTX ?? ^from \/[^ ]*
{
RELAYHOSTEHLO=$MATCH
}
# Then isolate the hostname portion (if any) in the parenthetical.
:0
* RELAYHOSTX ?? ^from [^ ]* \(\/[^)]*\)\>+by\>
* MATCH ?? ^\/[^)]+
{
RELAYHOSTX=$MATCH
:0
* RELAYHOSTX ?? ^\/[^[ ]+
{
# grab whatever up to the first space or the open
# brackets for the IP.
RELAYHOST=$MATCH
}
:0
* RELAYHOSTX ?? ()\[\/[^] ]+
{
# grab the apparent host IP from the brackets
# Since this should have been generated and
# inserted by the local mailhost, it should follow
# standard format, and not be "hokified" by a spammer.
RELAYHOSTIP=$MATCH
}
}
# null out RELAYHOSTX (temp variable used in the extraction process)
RELAYHOSTX=
# if the relay host has no rDNS, RELAYHOST should be undefined.
---
Sean B. Straw / Professional Software Engineering
Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
Please DO NOT carbon me on list replies. I'll get my copy from the list.
____________________________________________________________
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