procmail
[Top] [All Lists]

Re: Preventing malicious subscriptions to mailing lists

1997-04-10 06:12:00
On Wednesday 9 April 97, at 16 h 18, the keyboard of Philip Guenther 
<guenther(_at_)gac(_dot_)edu> wrote:

Actually, the envelope sender address should appear in either the
Return-Path: header or the "From " pseudo-header.  It's the envelope
_recipient_ address that is not normally availible.

OK, I see. So, following Era Eriksson's advice and Philip Guenther's help 
(thanks a lot!), I rewrote the recipe as:


# Warning: the regular expression below *needs* procmail 3.11 or more.
# You can change it to '* $ ^TO$ADDRESS' but it will not be as sharp.
:0
* $ ^TO_$ADDRESS\>
! $REALDESTINATION

:0
{

        # See sendmail source, src/sysexits.h, for a list of exit codes.
        # Warning: sendmail will reply with a message containing the 
expansion
        # of the alias :-( Set EXITCODE to 0 to avoid this (but in that 
case,
        # messages will continue to arrive).

        #EXITCODE=77

        # Suppress the automatic reply if you use EXITCODE=77

        EXITCODE=0

        RETURN=`formail -x Return-Path`

        # We should test there *is* a Return-Path...

        :0hc
        | (formail -rt -I"Precedence: junk" -i"From: postmaster" \
                        -i"X-Diagnostic: Permission denied" \
                        -i"X-Reason: Mail coming for a mailing list" ; \
                echo "Mail not delivered and rejected."; \
                echo "------" ; \
                echo "$ADDRESS never subscribes to mailing lists. This 
is"; \
                echo " certainly an error or the result of an 
unconfirmed"; \
                echo " subscription. Please cancel it." ) | \
                $SENDMAIL $RETURN

        :0
        /dev/null

}


<Prev in Thread] Current Thread [Next in Thread>