procmail
[Top] [All Lists]

Re: Accept all mail sourced from IP address range

2006-06-23 13:25:56
On Fri, Jun 23, 2006 at 02:18:18PM -0400, Robert Moskowitz wrote:

I want to specially handle all mail that is ONLY from within my  network.

So let's say I have two ranges of addresses.  192.168.128.0/24 and 
205.86.56.32/27

How would I write this?

I have found this different script in my searches, but have not do the 
translation to a if ANY Recieved is not in this range, skip on down, 
otherwise route mail here.

First, you need to make your ranges into a standard regex.
I have a perl script available to me that helps with that, written
by my friend Mike Peeler.  I think your /27 starts with 32 and goes
through 63; is that correct?

Let's use scoring.  Add up all Received lines, then subtract all
that have yours.  If any are left, it's mail you don't want.


  MYSLASH27 = 205\.0?86\.0?56\.(0?3[2-9]|0?[45][0-9]|0?6[0-3]) 
    MYNAT24 = 192\.168\.128\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])

   :0
   *  1 ^1  ^Received:
   * -1 ^1  ^Received:.*\[($MYSLASH27|$MYNAT24)]]
   { HOST = abort }


This will dump all mail with any Received line that doesn't have a
bracketed IP address in your range.

Dallman

____________________________________________________________
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