procmail
[Top] [All Lists]

Re: Rejecting unknown users

2001-02-07 15:44:10
on 2/7/01 4:18 PM, Stephen R. Wilcoxon at wilcoxon(_at_)bridge(_dot_)com said:
On Wed 2001/02/07 14:55:49 EST, Postmaster 
<allemail(_at_)kenton(_dot_)k12(_dot_)oh(_dot_)us>
writes:
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

#Accept from KCS Teachers
:0:
* ^From*(_at_)kenton\(_dot_)k12\(_dot_)oh\(_dot_)us
${DEFAULT}

Your from conditions are probably not what you want you are looking for
lines starting with "Fro" followed by 0 or more 'm'.  You probably wanted
"^From:[     ]*(01|02|03|04)" (there is a space and a tab inside the []) or
"^From:.*(01|02|03|04)[a-z]*@" (a-z should be replaced with whatever
characters are valid after the 0[1-4] for your high school students) and
"^From:(_dot_)*(_at_)kenton\(_dot_)k12\(_dot_)oh\(_dot_)us".

Ok, my new accept.rc file that works is:
#Accept from KCS Teachers and not HS students
:0:
* ^From:(_dot_)*(_at_)kenton\(_dot_)k12\(_dot_)oh\(_dot_)us
* !^From.[      ]*(01|02|03|04)
${DEFAULT}

And my reject.rc file is empty for right now. It's working the way I want it
to, my only question is the second from line above didn't work as:
* !^From:[      ]*(01|02|03|04)
But it did work when I replaced the colon with a period. I thought I read
that I shouldn't rely on the colon after the from.

My only other question is how can I secure it further? If someone changes
their From: address to contain kenton.k12.oh.us, and it doesn't start with
the forbidden numbers, it still goes through. What other checks can I
include?

Thanks for everyone's help!

P.s. I'm assuming I can trash the LOG line once I get it working, since I
don't want to worry about 450 procmail.log files growing out of control!

-- 
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/

"The real problem is not whether machines think, but whether men do."
--B.F. Skinner


_______________________________________________
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>