From 93eded7fb02715796d41a446b22ae381e560607f Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Tue, 3 Jun 2008 22:47:16 +0000 Subject: [PATCH] add remote mail and procmailrc --- .procmailrc | 362 +++++++++++++++++++++++++++++++++++++++++++++++++ sa_remote_mail | 1 + 2 files changed, 363 insertions(+) create mode 100644 .procmailrc create mode 100644 sa_remote_mail diff --git a/.procmailrc b/.procmailrc new file mode 100644 index 0000000..3492f45 --- /dev/null +++ b/.procmailrc @@ -0,0 +1,362 @@ +PATH=/bin:/usr/bin:/usr/X11R6/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin + +SHELL=/bin/bash + +# "VERBOSE=on" is only used for debugging. +VERBOSE=off + +SENDMAIL=sendmail +MAILDIR=$HOME/Maildir +DEFAULT=$MAILDIR/Inbox/ +LOGFILE=$HOME/.procmail_log +# LOGABSTRACT = "all" + +# TODO + +:0 c: +$HOME/Mail/temp/ + +# Add filter for "your message to foo awaits moderator approval" +# filter out owner mails + + +# where to send spam +HIGHSPAM=spam/HIGHSPAM/ +SPAM=spam/SPAM/ + +# A list (one per line) of people I KNOW are spammers :-) +# can match any part of name so you can use fred, fred@aol.com or aol.com to +# match a user, mail address or domain. +# Note that this file is case-insensitive. +SPAMMERS=$HOME/.procmail/spammers + +# name of the file containing a list of people we +# always want to get mail from, one per line. If +# any substring of the From: or Sender: line matches +# a line of this file, it will go through, so this +# can be used to denote entire sites that we always +# wish to get mail from as well as individuals. +# E.g. "user", "user@aol.com" or "aol.com". +# Note that this file is case-insensitive. +# Putting all of the people or lists you get lots +# of mail from here will not only insure you get +# it, but will speed up procmail. +FRIENDS=$HOME/.procmail/friends + +# ====================================== +# Preventing duplicates using 16Kb cache +# They get shoved in duplicates folder +#:0 Whc: .msgid.lock +#| formail -D 16384 msgid.cache.new +#:0 a: +#/dev/null + +:0 H +* ^Subject:.*Rnm-devel moderator request +/dev/null + +:0 H +* ^Subject:.*Cron.*debbugs@master +/dev/null + + +:0 Hc +* !Message-Id: .*delay[0-9]+@ +* ^TO \/don\+de[^@]+ +$HOME/Mail/delay + +:0 Hhbw +* !Message-Id: .*delay[0-9]+@ +* ^TO \/don\+delay\+[^@]+ +|/home/don/bin/delay_mail --mailto don@donarmstrong.com --enqueue --email --delay $MATCH + + +# ========================================================================== +# Correct crap or broken mails using sed +# ========================================================================== +# Correct wrong sig-dashes, ie add a space for lines with only "--" in them: +# from: ^--$ +# to: ^-- $ +#:0 fBw +#* ^--$ +#| sed -e 's/^--$/-- /' + +# preconverts all plain-text mail arriving in certain encoded +# MIME formats into a more compact 8-bit format which can be +# used and displayed more easily by most programs. +#:0 +#* ^Content-Type: *text/plain +#{ +#:0 fbw +#* ^Content-Transfer-Encoding: *quoted-printable +#| mimencode -u -q + +#:0 Afhw +#| formail -I "Content-Transfer-Encoding: 8bit" + +#:0 fbw +#* ^Content-Transfer-Encoding: *base64 +#| mimencode -u -b + +#:0 Afhw +#| formail -I "Content-Transfer-Encoding: 8bit" +#} + +# Convert old-style PGP messages to MIME +:0 +* !^Content-Type: multipart/ +* !^Content-Type: application/pgp +{ + :0 fBw + * ^-----BEGIN PGP MESSAGE----- + * ^-----END PGP MESSAGE----- + | formail \ + -i "Content-Type: application/pgp; format=text; x-action=encrypt" + + :0 fBw + * ^-----BEGIN PGP SIGNED MESSAGE----- + * ^-----BEGIN PGP SIGNATURE----- + * ^-----END PGP SIGNATURE----- + | formail \ + -i "Content-Type: application/pgp; format=text; x-action=sign" +} + +###################################################################### +# Here we search the list of people we always want to get mail from, # +# and deliver the mail if it's from one of them, no matter what. # +# The FRIENDS file is set and described above. # +###################################################################### +:0: +* ! ? (formail -x From: -x Sender: | fgrep -iqf $FRIENDS) +{ + +# $DEFAULT +# deliver to default mailbox + +#spamassasin is being run sitewide. + +# Mails with a score of 15 or higher are almost certainly spam (with 0.05% +# false positives according to rules/STATISTICS.txt). Let's put them in a +# different mbox. (This one is optional.) +:0: +* ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\* +#definetly_spam +/dev/null + +# Mails that are clearly spam, but we don't want to toss immediately +:0: +* ^X-Spam-Level: \*\*\*\*\*\*\*\* +$HIGHSPAM + +# All mail tagged as spam (eg. with a score higher than the set threshold) +# is moved to "probably-spam". +:0: +* ^X-Spam-Status: Yes +$SPAM + + + +# Work around procmail bug: any output on stderr will cause the "F" in "From" +# to be dropped. This will re-add it. +:0 H +* ! ^From[ ] +* ^rom[ ] +{ + LOG="*** Dropped F off From_ header! Fixing up. " + + :0 fhw + | sed -e 's/^rom /From /' +} + + + + +################################################################## +# SPAM filter. I don't like spam. I just don't # +################################################################## + +# Here we search a file with a list of people we _never_ want to +# get anything from, tossing the mail if it's from one of them. +# SPAMMERS is set and described above. +# Note, you can use the following line instead to be even more +# strict, they can't have even relayed it via an adress in the +# spammers file: +# * ? (formail -x From: -x Sender: -x Reply-To: -x Received: | fgrep -iqf $SPAMMERS) +:0: +* ? (formail -x From: -x Sender: -x Reply-To: | fgrep -iqf $SPAMMERS) +| formail -A "X-SPAM-RULE: address found in spammers file" >> $SPAM + +# look for X-Advertisement header or 'advertisement' in the subject, +# accounting for possible sp. error. "Nice" spammers use this header. +:0: +* ^X-Adverti[sz]ement: +| formail -A "X-SPAM-RULE: X-Advertisement header" >> $SPAM + +:0: +* ^Subject:.*adverti[sz]ement +| formail -A "X-SPAM-RULE: Advertisement in subject" >> $SPAM + +# snag the To: and From: headers +TO=`formail -zx To:` +CC=`formail -zx Cc:` +FROM=`formail -zX From: | formail -zrx To:` + +# no To: line AND no Cc: line. You could filter out anything with no To:, +# but there are lots of mailinglist idiots who Cc the list and don't To: +# anyone ;-) +:0: +* TO??^$ +* CC??^$ +| formail -A "X-SPAM-RULE: no To: or Cc: header" >> $SPAM + +# bogus pegasus header, very common with spammers, and I've never +# seen it used by anyone else. +:0: +* ^Comment: Authenticated sender is +* ! ^X-Mailer: Pegasus +| formail -A "X-SPAM-RULE: bogus pegasus header" >> $SPAM + +#large number of spaces then number in subject +:0: +* ^Subject:.*\ \ \ \ \ \ \ \ \ [0-9][0-9]+ +| formail -A "X-SPAM-RULE: too many spaces followed by number in subject" >> $SPAM + +#laser toner cartridges. (I mean, come, on!) +:0: +* ^Subject: laser cartridges +| formail -A "X-SPAM-RULE: laser cartridges suck" >> $SPAM + +} + +# Debian role accounts + +:0: +* ^Delivered-To: (owner@bugs.debian.org) +bugs.debian.org/ + +:0: +* ^Delivered-To: (listmaster@lists.debian.org) +lists.debian.org/ + + +# OFTC stuff +:0: +* ^TO (oftc@spi-inc.org) +oftc/ + +# Chili ALRM +:0: +* ^Subject:\ (\[comment\])?\[ALRM\ \# +chili_alarm/ + +:0: +* ^From:\ nagios@nagios-global.lab.propel.com +chili_alarm/ + +# +:0: +* ^From:\ noreply@dragongoserver.net +lists/dragongo/ + +################### +# Mailing lists # +5B5B################### + +:0: +* X-Mailing-List: <\/[^@]+ +lists/`echo $MATCH | sed -e 's/[\/]/_/g'`/ + +:0: +* ^Delivered-To: mailing list \/[^@]+ +lists/`echo $MATCH | sed -e 's/[\/]/_/g'`/ + +:0: +* ^Sender: owner-\/[^@]+ +lists/`echo $MATCH | sed -e 's/[\/]/_/g'`/ + +:0: +* ^Sender: \/[^@]+-bounces? +lists/`echo $MATCH | sed -e 's/\-bounces*//g; s/[\/]/_/g'`/ + +:0: +* ^X-BeenThere: \/[^@]+ +lists/`echo $MATCH | sed -e 's/[\/]/_/g'`/ + + +# Dumb apache mailing lists +:0: +* ^List-Post: > $SPAM + + +##################################### +# Last rule: Put mail into mailbox # +##################################### + +:0: +$DEFAULT + +# End of file diff --git a/sa_remote_mail b/sa_remote_mail new file mode 100644 index 0000000..f01c42d --- /dev/null +++ b/sa_remote_mail @@ -0,0 +1 @@ +~/.home_modules/remote_mail ~/bin/svnmerge '^\.' ~/ -- 2.39.2