At 16:32 -0400 7/27/99, ryanm wrote:
I have a user who is getting spammed by an ex boyfriend and I want to
send an email back to him telling him he is UNAUTHORIZED to send
mail here, log it and send an administrator email notification. How
can I do this with procmail?? After reading the man pages and examples
I came up with:
:0:
* ^From(_dot_)*1296herman(_at_)aol(_dot_)com
| cat /etc/procmail/abuse.note /usr/ucb/mail -s "UNAUTHORIZED ACCESS"
1296herman(_at_)aol(_dot_)com
Where can I add the logging and also the administrator notification??
Make your recipe something like this (substitute where needed; it should be
obvious):
------------------------------------------------------------------------->8
:0
* ^From(_dot_)*badguy(_at_)bad\(_dot_)domain
* ^TOharassed(_at_)our\(_dot_)domain
{
LOG="mail to harassed(_at_)our(_dot_)domain rejected from
badguy(_at_)bad(_dot_)domain
"
:0 c
| /usr/ucb/mail -s "Unauthorized mail from badguy(_at_)bad(_dot_)domain"
postmaster
:0
| cat /etc/procmail/abuse.note /usr/ucb/mail -s "UNAUTHORIZED ACCESS"
1296herman(_at_)aol(_dot_)com
}
------------------------------------------------------------------------->8
Yes, that LOG line has the quotes around the newline. :^)
If you're willing to just give the bad guy Sendmail bounces, you can use this
instead:
------------------------------------------------------------------------->8
:0
* ^From(_dot_)*badguy(_at_)bad\(_dot_)domain
* ^TOharassed(_at_)our\(_dot_)domain
{
EXITCODE=77
LOG="mail to harassed(_at_)our(_dot_)domain rejected from
badguy(_at_)bad(_dot_)domain
"
:0
| /usr/ucb/mail -s "Unauthorized mail from badguy(_at_)bad(_dot_)domain"
postmaster
}
------------------------------------------------------------------------->8
This generates a bounce message that looks like this:
Date: Tue, 27 Jul 1999 23:12:54 -0400
From: Mail Delivery Subsystem <MAILER-DAEMON(_at_)patriot(_dot_)net>
To: <smf(_at_)pobox(_dot_)com>
MIME-Version: 1.0
Subject: Returned mail: Insufficient permission: Error 0
Auto-Submitted: auto-generated (failure)
Sender: MAILER-DAEMON(_at_)pobox(_dot_)com
Status:
The original message was received at Tue, 27 Jul 1999 23:12:51 -0400
from pool180-148.patriot.net [209.249.180.148]
----- The following addresses had permanent fatal errors -----
<spam(_at_)twocooks(_dot_)com>
----- Transcript of session follows -----
550 <spam(_at_)twocooks(_dot_)com>... Insufficient permission: Error 0
You should also make sure you have LOGFILE defined somewhere in the appropriate
procmail file:
LOGFILE="/path/to/your/logfile"
If you eliminate the "* ^TOharassed" line, you'll reject all mail from this
user to any account on your system, including postmaster, if this is in the
/etc/procmailrc line. Also, this won't prevent the other person from changing
AOL screen names and sending mail that way.
Disclaimer: This was done late at night, from memory. You'd do well to check
the procmailex(5) man page -- that explains all this much better than I can.
Also, watch the line wraps. I turned off auto-wrapping (I think), but who
knows.
Regards,
Scott