]> git.madduck.net Git - etc/mailfilter.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge branch 'no-more-albatross'
authormartin f. krafft <madduck@seamus.madduck.net>
Fri, 17 Aug 2007 15:11:30 +0000 (17:11 +0200)
committermartin f. krafft <madduck@seamus.madduck.net>
Fri, 17 Aug 2007 15:11:30 +0000 (17:11 +0200)
16 files changed:
config/cclists [new file with mode: 0644]
config/ignore-lists
procmail/addheaders [new file with mode: 0644]
procmail/autoreplies
procmail/defines
procmail/dejavu [new file with mode: 0644]
procmail/duplicates
procmail/eqdomains
procmail/justme
procmail/listquirks [new file with mode: 0644]
procmail/marknew [deleted file]
procmail/procmailrc
procmail/rules/mass
procmail/spamfilter
procmail/spammers
procmail/spamtraps

diff --git a/config/cclists b/config/cclists
new file mode 100644 (file)
index 0000000..931115f
--- /dev/null
@@ -0,0 +1 @@
+^git@vger\.kernel\.org$
index 9d22f50f4860973d83fbec3e672fac5e78660226..03cded3379c9c9d294f8c57238b3a960452d2299 100644 (file)
@@ -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 (file)
index 0000000..cbfc9ed
--- /dev/null
@@ -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
index cc1bd62fa87f6df969c77520817bee39f3212efe..02e29f0f7624fe58033e79d03cb8d6a861f8e9f6 100644 (file)
@@ -1,4 +1,4 @@
 :0
-*$ !$REPROC_MESSAGE
+*$ !$MSG_DEJAVU
 {
 }
index f37bdcac7b4e2914ae19549159f7bef9aec28604..511e614baa14dc1707865155bed2011fcda819ca 100644 (file)
@@ -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 (file)
index 0000000..298abae
--- /dev/null
@@ -0,0 +1,6 @@
+:0
+*$ ^$DEJAVU_HEADER: $ID
+{
+  LOG="dejavu:      re-processing message $MSGID$NL"
+  MSG_DEJAVU
+}
index fc47f03a280cd992004b90b97957437e887e0eb0..eb14d4bb73190859d30a9d7a629b4ac4b51388f2 100644 (file)
@@ -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
 {
index d1f39603f0539221b434d128830c16a26a94ae2f..b5e434d6aad8f5b1730c661ef26b7d39dcb9b214 100644 (file)
@@ -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"
   }
 }
 
index f6edc50d32b7590a727f52950a81b380540524aa..9c1269786f6e8e3215e306330353bc6778757010 100644 (file)
@@ -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 (file)
index 0000000..ffb540f
--- /dev/null
@@ -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 (file)
index 63236c0..0000000
+++ /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"
index 0ecd6929668e6f449d7269180b30a3b34353fbcc..9a5562534ae87a0b87d1ed0504572cc85245f91d 100755 (executable)
@@ -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
index f7d539fc4694c0aae384cd45f14f06875775d225..59b6bd3ee9515b7a2d2c918fef946b71510023d3 100644 (file)
@@ -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}/
 }
index 66a725e37e5cb406e3ff76bef1887d2c5697c275..066b9cbd7845ca878c43036ee08559eb33e55bd0 100755 (executable)
@@ -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
index b5dd34b5fc49f4e05a5acd084e91c0bdb7c4aa17..f1a1fa5630643923d3499b76bef15d596a7289dd 100644 (file)
@@ -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
 
index adb108751e911524ec692a5dfbe1941bc9254595..51c37064888da47711fcfbe718812790f851b085 100644 (file)
@@ -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