# This is important PMDIR=/home/wash/.LOG/ # Define the password PASSWD_=za8Y-174 SUBJECT=`formail -xSubject: \ | sed -e 's/[;\`\\]/ /g' \ | expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'` FROM=`formail -rt -xTo: \ | sed -e 's/[;\`\\]/ /g' \ | expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'` ME=(des(_at_)FreeBSD\(_dot_)or\(_dot_)ke|admin(_at_)FreeBSD\(_dot_)or\(_dot_)ke) # Variables for convenience and efficiency sender = "From: W a s h i n g t o n " to = `formail -rt -xTo: | sed -e 's/[;\`\\]/ /g' | expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'` # Generate a reply header :0 hw header=| formail -rt -I"$sender" -I"$to" -A"Precedence: Junk" -I"Reply-To: null(_at_)wananchi(_dot_)com" \ -I "Subject: Returned e-mail: Password or privileges required" # At another level, lemme see the variance #Define getting the sender's address #Discard any leading and trailing whitespaces FROM_=`formail -rt -xTo: \ | expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'` # My friends FRIENDS="(`perl -p0e ' s/\012(.)/\|$1/g; s/\015//g; s/\|{2,}/\|/g; s/\./\\\./g' < $PMDIR/green.lst`)" # :0:passwd.lock # Check for (the lack of) the password * $ ! ^Subject:.*${PASSWD_} ## Let mails cc-ed to lists I am subscribed to pass. * ! ^(From|To):.*(owner-freebsd-questions|owner-freebsd-isp|owner-freebsd-stable|techrepublic|openldap-software|\ hylafax-users|mml-general|win98-dialup|winnt-dialup|proftpd|tpc-rp|tpc-oper|mutt-users|mutt-users-owner|\ samba|netatalk-admins|procmail-admin|procmail-users|kde-nonlinux|openroot|exim-users|owner-newbie|\ owner-bind-users|comp-protocols-dns-bind|bind-users-bouce|hoods|theteam|imp|horde|6bone-owner|owner-freebsd-ia64) # # Don't do this to my friends * ! ^From:.*(${FRIENDS}) # ## Avoid e-mail loops and accept mail from lists. #* ! $ ^To:.*\<$\LOGNAME\> * ! ^(To|Cc):.*wash * ! ^(To|Cc):.*$ME * ! ^From:.*iconnect\.co\.ke * ! ^(To|Cc):.*(cs|admin)@wananchi\.com * ! ^From:.*wananchi\.com * ! ^To:.*idt\.Unitymail\.Net * ! ^From:.*opensrs\.org * ! ^From:.*techrepublic\.com * ! ^From:.*brainbench\.com * ! ^FROM_DAEMON * ! ^FROM_MAILER * ! ^List- * ! ^(Mailing-List|Approved-By|BestServHost|Resent-(Message-ID|Sender)): * ! ^Sender: (.*-errors@|owner-) * ! ^Sender: .*bind-users * ! ^X-[^:]*-List: * ! ^X-(Authentication-Warning|Loop|Sent-To|(Listprocessor|Mailman|Listar)-Version): * ! ^Precedence: (junk|bulk|list) * ! ^X-Loop: wash(_at_)wananchi\(_dot_)com * ! ^From:.*wash@([-a-z0-9_]+\.)*wananchi\.com # # Avoid forgeries that pretend to be from my own site * ! $ ? echo ${FROM_} | fgrep -is 'wananchi.com' * $ ? echo ${FROM_} | fgrep -is '.' * $ ? echo ${FROM_} | fgrep -is '@' { # Make a temporary file of the message to be returned :0c:formail.lock # Discard whitespaces, insert a leading blank | expand | sed -e 's/[ ]*$//g' | sed -e 's/^/ /' > return.tmp # :0 hc # Prepare and send notification # Be sure to customize for your sendmail path | (echo "$header" ; \ echo "************************************************" ; \ echo "* This response message is computer-generated.*" ; \ echo "************************************************" ; \ echo "" ; \ echo "Dear ${FROM}," ; \ echo "" ; \ echo "Thank you for your mail regarding <<"${SUBJECT}">>" ; \ echo "" ; \ echo "Your e-mail address has not (yet) been listed as privileged" ; \ echo "in the database of my email filter. Your mail is therefore being" ; \ echo "temporarily returned." ; \ echo "Here's my simple step against Unsolicited Commercial Emails (aka spam)." ; \ echo "If you wish your e-mail to reach me promptly, then it's my humble" ; \ echo "request that you include the magic word (${PASSWD_}) anywhere on the" ; \ echo "_ORIGINAL_subject line and then resend it to ." ; \ echo "For instance, you can have this as your subject: " ; \ echo "" ; \ echo "(${PASSWD_}) "${SUBJECT}"" ; \ echo "" ; \ echo "Please take note: Simply hitting the reply button now will not work." ; \ echo "" ; \ echo "A copy of your original email is attached for convenience at the end" ; \ echo "of this automatic response." ; \ echo "" ; \ echo "Thank you." ; \ echo "" ; \ echo "Odhiambo Washington" ; \ echo "" ; \ echo "" ; \ echo "==+==+==+==+==+==+==+== begin rejected mail ==+==+==+==+==+==+==+==" ; \ cat return.tmp ; \ echo "==+==+==+==+==+==+==+== end rejected mail ==+==+==+==+==+==+==+==" ; \ rm -f return.tmp) | $SENDMAIL -t :0 c | /usr/local/bin/formail -rtzxTo: >> /home/wash/.LOG/black.lst :0: RETURNED } #EOF