From: martin f. krafft Date: Fri, 17 Aug 2007 15:11:30 +0000 (+0200) Subject: Merge branch 'no-more-albatross' X-Git-Url: https://git.madduck.net/etc/mailfilter.git/commitdiff_plain/8dde77c861da2fb8c14e2ce651423691db664f47?hp=b03ebf331e5a24fa85af0926b1706745906a3988 Merge branch 'no-more-albatross' --- diff --git a/config/cclists b/config/cclists new file mode 100644 index 0000000..931115f --- /dev/null +++ b/config/cclists @@ -0,0 +1 @@ +^git@vger\.kernel\.org$ diff --git a/config/ignore-lists b/config/ignore-lists index 9d22f50..03cded3 100644 --- a/config/ignore-lists +++ b/config/ignore-lists @@ -1,2 +1,4 @@ ^Sender: owner-mutt-users@mutt\.org$ ^Sender: owner-postfix-users@postfix\.org$ +$^ prevent CCs from git mailing list. +^([Tt]o|[Cc]{2}):.*git@vger\.kernel.org diff --git a/procmail/addheaders b/procmail/addheaders new file mode 100644 index 0000000..cbfc9ed --- /dev/null +++ b/procmail/addheaders @@ -0,0 +1,17 @@ +:0 fw +*$ !$MSG_DEJAVU +|$FORMAIL -A"$DEJAVU_HEADER: $ID" + +:0 fw +* SPAMTRAPPED ?? . +|$FORMAIL -A"X-Spamtrapped: $SPAMTRAPPED" + +:0 fw +* JUSTME ?? . +|$FORMAIL -A"X-Justme: $JUSTME" + +:0 fw +* EQ_DOMAIN ?? . +|$FORMAIL -A"X-EqDomain: $ORIG_DOMAIN" -A"X-EqTo: $EQ_LOCAL@$EQ_DOMAIN" + +# vim:ft=procmail diff --git a/procmail/autoreplies b/procmail/autoreplies index cc1bd62..02e29f0 100644 --- a/procmail/autoreplies +++ b/procmail/autoreplies @@ -1,4 +1,4 @@ :0 -*$ !$REPROC_MESSAGE +*$ !$MSG_DEJAVU { } diff --git a/procmail/defines b/procmail/defines index f37bdca..511e614 100644 --- a/procmail/defines +++ b/procmail/defines @@ -67,6 +67,8 @@ RE_FIRSTNAME="martin($RE_SPACE_NEWLINE+f(\.?|elix))?" RE_LASTNAME="kraff?t" RE_EXTRACT_HEADER_VALUE="[ ]*\/[^ ].*" +DEJAVU_HEADER=X-Deja-Vu + NULL=/dev/null DISCARD=$BASE/.discard/ #DISCARD="'|$DELIVER -m BASE.discard'" @@ -128,11 +130,11 @@ INCLUDERC=$PMDIR/normalise ### run-time variables -# REPROC_MESSAGE +# MSG_DEJAVU # a procmail-style flag, which is true if unset and false if set (to !). -# unset by marknew if the message has already been seen by the filter (according +# unset by dejavu if the message has already been seen by the filter (according # to the X-Been-There header). -REPROC_MESSAGE=! +MSG_DEJAVU=! # SKIP_SPAMCHECKS # if set, cuases spamchecks to be skipped, value lists reason @@ -166,3 +168,7 @@ SPAM_UNKNOWN # RETRAIN # if set, causes spamfilters to be retrained, according to the variable's value RETRAIN + +# JUSTME +# if set, contains reason why justme message was passed +JUSTME diff --git a/procmail/dejavu b/procmail/dejavu new file mode 100644 index 0000000..298abae --- /dev/null +++ b/procmail/dejavu @@ -0,0 +1,6 @@ +:0 +*$ ^$DEJAVU_HEADER: $ID +{ + LOG="dejavu: re-processing message $MSGID$NL" + MSG_DEJAVU +} diff --git a/procmail/duplicates b/procmail/duplicates index fc47f03..eb14d4b 100644 --- a/procmail/duplicates +++ b/procmail/duplicates @@ -3,7 +3,7 @@ MID_CACHE_FILE = $PMVAR/msgid.cache LOCKFILE = $MID_CACHE_FILE$LOCKEXT :0 *$ !SKIP_DUP ?? . -*$ !$REPROC_MESSAGE +*$ !$MSG_DEJAVU * ^Message-ID: * ? $FORMAIL -D 16384 $MID_CACHE_FILE { diff --git a/procmail/eqdomains b/procmail/eqdomains index d1f3960..b5e434d 100644 --- a/procmail/eqdomains +++ b/procmail/eqdomains @@ -4,26 +4,30 @@ :0 * !ORIGINAL_TO ?? =.+@.+ { - LOG="eqdomain: spamtrap message due to missing = in localpart ($ORIGINAL_TO)$NL" - :0 fw - |$FORMAIL -A"X-Spamtrapped: missing equal sign in eqdomain ($ORIGINAL_TO)" - SPAMTRAPPED=eqdomain + SPAMTRAPPED="missing equal sign in eqdomain ($ORIGINAL_TO)" + LOG="eqdomain: $SPAMTRAPPED$NL" } :0 E { :0 * ORIG_LOCAL ?? ^\/[^=]+ - { EQ_LOCAL="$MATCH" } + { + EQ_LOCAL="$MATCH" + EQ_TO="$MATCH" + } :0 * ORIG_LOCAL ?? .+=\/.+ - { EQ_DOMAIN="$MATCH" } + { + EQ_DOMAIN="$MATCH" - LOG="eqdomain: message to $EQ_LOCAL@$EQ_DOMAIN via $ORIG_DOMAIN$NL" + :0 + * EQ_LOCAL ?? . + { EQ_TO="$EQ_TO@$EQ_DOMAIN" } + } - :0 fw - |$FORMAIL -A"X-EqDomain: $ORIG_DOMAIN" -A"X-EqTo: $EQ_LOCAL@$EQ_DOMAIN" + LOG="eqdomain: message to $EQ_TO via $ORIG_DOMAIN$NL" } } diff --git a/procmail/justme b/procmail/justme index f6edc50..9c12697 100644 --- a/procmail/justme +++ b/procmail/justme @@ -4,65 +4,58 @@ :0 H *$ MSGID ?? ^<.+@$RE_MYDOMAIN> { - LOG="justme: passing; from machine in my domain$NL" - :0 fw - |$FORMAIL -I'X-Justme: from machine in my domain' + JUSTME="from machine in my domain" + LOG="justme: passing; $JUSTME$NL" SKIP_SPAMCHECKS=from-mydomain } :0 EH *$ ^(References|In-Reply-To):.*<.+@$RE_MYDOMAIN> { - LOG="justme: passing; in-reply-to/referenced$NL" - :0 fw - |$FORMAIL -I'X-Justme: in-reply-to/referenced' + JUSTME="in-reply-to/referenced" + LOG="justme: passing; $JUSTME$NL" SKIP_SPAMCHECKS=in-reply-to/referenced } :0 E * ? echo "$ORIGINAL_TO" | $EGREP -qif $CONF/justme-address-exceptions - { - LOG="justme: passing; explicitly excepted address$NL" - :0 fw - |$FORMAIL -I'X-Justme: in-reply-to/referenced' + { + JUSTME="explicitly excepted address" + LOG="justme: passing; $JUSTME$NL" } :0 EBH *$ 1^0 B ?? $RE_FIRSTNAME$RE_SPACE_NEWLINE+$RE_LASTNAME *$ 1^0 B ?? $RE_LASTNAME[,]?$RE_SPACE_NEWLINE*$RE_FIRSTNAME { - LOG="justme: passing; full name reference$NL" - :0 fw - |$FORMAIL -I'X-Justme: full name reference' + JUSTME="full name reference" + LOG="justme: passing; $JUSTME$NL" } :0 EBH *$ B ?? $RE_LASTNAME { - LOG="justme: passing; last name reference$NL" - :0 fw - |$FORMAIL -I'X-Justme: last name reference' + JUSTME="last name reference" + LOG="justme: passing; $JUSTME$NL" } :0 EBH * 1^0 B ?? madduck * -1^0 B ?? mass\.madduck\.net { - LOG="justme: passing; nickname reference$NL" - :0 fw - |$FORMAIL -I'X-Justme: nickname reference' + JUSTME="nickname reference" + LOG="justme: passing; $JUSTME$NL" } :0 EBH *$ ? $EGREP -qif $CONF/justme-keyword-exceptions { - LOG="justme: passing; keyword reference$NL" - :0 fw - |$FORMAIL -I'X-Justme: keyword reference' + JUSTME="keyword reference" + LOG="justme: passing; $JUSTME$NL" } :0 E - { + { LOG="justme: discarding$NL" :0 $DISCARD diff --git a/procmail/listquirks b/procmail/listquirks new file mode 100644 index 0000000..ffb540f --- /dev/null +++ b/procmail/listquirks @@ -0,0 +1,10 @@ +:0 +* ? echo "$EQ_TO" | $EGREP -qif $CONF/cclists +{ + CORRESPONDENTS=`formail -cxTo: -xCc: -xFrom: | tr -s '\n' ,` + LOG="listquirks: adding M-F-T header for message on list $EQ_TO$NL" + :0 fw + |$FORMAIL -a "Mail-Followup-To: $CORRESPONDENTS" +} + +# vim:ft=procmail diff --git a/procmail/marknew b/procmail/marknew deleted file mode 100644 index 63236c0..0000000 --- a/procmail/marknew +++ /dev/null @@ -1,9 +0,0 @@ -:0 -*$ ^X-Been-There: $ID -{ - LOG="marknew: re-processing message $MSGID$NL" - REPROC_MESSAGE -} - -:0 Efw -|$FORMAIL -A"X-Been-There: $ID" diff --git a/procmail/procmailrc b/procmail/procmailrc index 0ecd692..9a55625 100755 --- a/procmail/procmailrc +++ b/procmail/procmailrc @@ -18,7 +18,7 @@ INCLUDERC=$PMDIR/smsmail INCLUDERC=$PMDIR/logging -INCLUDERC=$PMDIR/marknew +INCLUDERC=$PMDIR/dejavu INCLUDERC=$PMDIR/eqdomains INCLUDERC=$PMDIR/duplicates @@ -31,8 +31,14 @@ INCLUDERC=$PMDIR/spamtraps INCLUDERC=$PMDIR/spammers INCLUDERC=$PMDIR/spamfilter +INCLUDERC=$PMDIR/addheaders + +INCLUDERC=$PMDIR/handlespam + #INCLUDERC=$PMDIR/autoreplies INCLUDERC=$PMDIR/lurker +INCLUDERC=$PMDIR/listquirks + INCLUDERC=$PMRULES/all diff --git a/procmail/rules/mass b/procmail/rules/mass index f7d539f..59b6bd3 100644 --- a/procmail/rules/mass +++ b/procmail/rules/mass @@ -2,14 +2,7 @@ * ORIG_DOMAIN ?? ^mass\.madduck\.net$ { DESTDIR=$BASE/.mass - - :0 - * ORIG_LOCAL ?? ^git=vger\.kernel\.org$ - { - CORRESPONDENTS=`formail -cxTo: -xCc: -xFrom: | tr -s '\n' ,` - :0 fw - |$FORMAIL -a "Mail-Followup-To: $CORRESPONDENTS" - } + :0 ${DESTDIR}/ } diff --git a/procmail/spamfilter b/procmail/spamfilter index 66a725e..066b9cb 100755 --- a/procmail/spamfilter +++ b/procmail/spamfilter @@ -23,7 +23,7 @@ PMDIR=${PMDIR:-$HOME/.etc/mailfilter/procmail} # Note: add E flag to next recipe when uncommenting #:0 #* SPAMTRAPPED ?? . -#{ +#{ # LOG="spamfilter: skipping checks for spamtrapped message$NL" # :0 fw # |$FORMAIL -I"X-Spam: spamtrapped" @@ -32,7 +32,7 @@ PMDIR=${PMDIR:-$HOME/.etc/mailfilter/procmail} # check whether this message is being reinjected TRAINED_AS :0 -*$ $REPROC_MESSAGE +*$ $MSG_DEJAVU * ^X-Trained-As: \/(h|sp)am { LOG="spamfilter: skipping already trained $MATCH$NL" @@ -44,8 +44,8 @@ TRAINED_AS # let earlier parts of the mailfilter cause bypassing the checks :0 E * SKIP_SPAMCHECKS ?? . -{ - LOG="spamfilter: skipping checks as requested: $SKIP_SPAMCHECKS$NL" +{ + LOG="spamfilter: skipping checks as requested: $SKIP_SPAMCHECKS$NL" :0 fw |$FORMAIL -I"X-Spam: unknown (skip requested)" SPAM_UNKNOWN=skip-requested @@ -240,7 +240,7 @@ TRAINED_AS :0 E * CRM_SPAM ?? SPAM * SA_SPAM ?? Yes - { + { IS_SPAM=sa+crm :0 fw |$FORMAIL -I"X-Spam: yes (crm114:$CRM_SCORE SA:$SA_SCORE)" @@ -255,7 +255,7 @@ TRAINED_AS * SPAMTRAPPED ?? . * ! SKIP_SPAMCHECKS ?? . * ! IS_SPAM ?? . -{ +{ LOG="spamfilter: found spamtrapped ham, retraining...$NL" :0 fw |$FORMAIL -I"X-Spam: spamtrapped ham" @@ -263,5 +263,4 @@ TRAINED_AS RETRAIN=spam } -INCLUDERC=$PMDIR/handlespam #VERBOSE=no diff --git a/procmail/spammers b/procmail/spammers index b5dd34b..f1a1fa5 100644 --- a/procmail/spammers +++ b/procmail/spammers @@ -10,10 +10,8 @@ SPAMMER :0 * SPAMMER ?? @ { - LOG="spammers: message from known spam sender$NL" - :0 fw - |$FORMAIL -A"X-Spamtrapped: from known spammer ($SPAMMER)" - SPAMTRAPPED=known-spammer + SPAMTRAPPED='from known spammer ($SPAMMER)' + LOG="spammers: $SPAMTRAPPED$NL" } SPAMMER diff --git a/procmail/spamtraps b/procmail/spamtraps index adb1087..51c3706 100644 --- a/procmail/spamtraps +++ b/procmail/spamtraps @@ -1,10 +1,8 @@ :0 * ? echo "$ORIGINAL_TO" | $EGREP -qif $CONF/spamtraps { - LOG="spamtraps: message to known spamtrap$NL" - :0 fw - |$FORMAIL -A"X-Spamtrapped: message to known spamtrap ($ORIGINAL_TO)" - SPAMTRAPPED=known-spamtrap + SPAMTRAPPED="message to known spamtrap ($ORIGINAL_TO)" + LOG="spamtraps: $SPAMTRAPPED$NL" } # vim:ft=procmail