procmail
[Top] [All Lists]

Re: Rejecting unknown users

2001-02-07 14:16:24
on 2/7/01 12:18 PM, D E Hammond at procmail1(_at_)tradersdata(_dot_)com said:
On  7 Feb, Postmaster wrote:
| 
| -Can I have a global procmailrc file that checks the username (all of our
| middle school students account names begin with 05, 06, and 07) and let
| through e-mail from a list of approved addresses (and quietly discard all
| others)?

If an acceptable sender to one recipient is acceptable to all, then
it's fairly simple. This is a common setup, and has been discussed
recently. You could begin by searching for "green list" and "white list"
in the archives:

http://www.xray.mpe.mpg.de/mailing-lists/procmail/

Thanks, I'll start reading!!

I have been playing around with it all day, but have run into a snag. When I
use the following recipes, everything gets rejected. All the high school
students usernames begin with 01,02,03, or 04. I want to trash any username
that begins with those characters, and then let through anything with
@kenton.k12.oh.us (which would presumable be the teachers). The
.localprocmailrc is for future use, where I can list addresses of allowed
senders for individual students.

I have the following .procmailrc:

#Preliminaries
SHELL=/bin/sh               #Use the Bourne shell (check your path!)
MAILDIR=${HOME}/mail            #First check what your mail directory is!
LOGFILE=${MAILDIR}/procmail.log
LOG="--- Logging ${LOGFILE} for ${LOGNAME}, "
PMDIR=/etc/procmail

#System Wide
INCLUDERC=${HOME}/.localprocmailrc
INCLUDERC=$PMDIR/reject.rc
INCLUDERC=$PMDIR/accept.rc
INCLUDERC=$PMDIR/trash.rc

Here is the reject.rc:
#Reject High School Students
:0
* ^From*(01|02|03|04)*
| (formail -rk \
        -A "X-Loop: MAIL-REJECTION" \
        -A "Precendence: junk"; \
        echo "This e-mail account is restricted on";\
        echo "who it can receive e-mail from and has";\
        echo "not received this message.";\
        echo " ";\
        echo "If you believe this to be in error, please";\
        echo "notify postmaster(_at_)kenton(_dot_)k12(_dot_)oh(_dot_)us" ) | 
$SENDMAIL -t -oi

Here is my accept.rc:
#Accept from KCS Teachers
:0:
* ^From*(_at_)kenton\(_dot_)k12\(_dot_)oh\(_dot_)us
${DEFAULT}

And finally my trash.rc:
# Trash all others with a reply.
:0
* !^FROM_DAEMON
* !^FROM_MAILER
* !^X-Loop: MAIL-REJECTION
| (formail -rk \
        -A "X-Loop: MAIL-REJECTION" \
        -A "Precendence: junk"; \
        echo "This e-mail account is restricted on";\
        echo "who it can receive e-mail from and has";\
        echo "not received this message.";\
        echo " ";\
        echo "If you believe this to be in error, please";\
        echo "notify postmaster(_at_)kenton(_dot_)k12(_dot_)oh(_dot_)us" ) | 
$SENDMAIL -t -oi

#Anything that is looping will get trashed
:0
/dev/null

-- 
Ryan Collins             Kenton City Schools Technology Coordinator
collinsr(_at_)kenton(_dot_)k12(_dot_)oh(_dot_)us              
http://www.kenton.k12.oh.us/
Help Desk- http://www.kenton.k12.oh.us/helpdesk/

"When will the public cease to insult the teacher's calling with empty
flattery? When will men who would never for a moment encourage their own
sons to enter the work of the public schools cease to tell us that education
is the greatest and noblest of all human callings?"
-William C. Bagley

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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