[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] procmailrc generation




This patch adds a script to generate a spam-filtering procmailrc.
It seems to work OK for me.

thanks
john


diff -Naur -x CVS spamfilter/rebuild.sh new/rebuild.sh
--- spamfilter/rebuild.sh	Tue Apr 10 00:45:47 2001
+++ new/rebuild.sh	Fri Apr 27 11:53:37 2001
@@ -13,3 +13,5 @@
 # Uncomment the script you want to run...
 
 # scripts/majordomo.sh
+
+# scripts/procmailrc.sh
diff -Naur -x CVS spamfilter/scripts/README.procmail new/scripts/README.procmail
--- spamfilter/scripts/README.procmail	Tue Apr 10 00:45:48 2001
+++ new/scripts/README.procmail	Fri Apr 27 12:21:45 2001
@@ -1,3 +1,14 @@
+		Creating a rule set for procmail as a user
+
+Use the provided script procmailrc.sh to create a
+$HOME/.procmailrc.spam file that contains rules to filter
+out spam on delivery. You will need to alter the settings
+in the file procmailrc.conf, and add :
+
+INCLUDERC=$HOME/.procmailrc.spam
+
+to your main .procmailrc file.
+
 		Procmail rules to catch things from spamfilter
 
 
diff -Naur -x CVS spamfilter/scripts/procmailrc.conf new/scripts/procmailrc.conf
--- spamfilter/scripts/procmailrc.conf	Thu Jan  1 01:00:00 1970
+++ new/scripts/procmailrc.conf	Fri Apr 27 12:14:12 2001
@@ -0,0 +1,20 @@
+# procmailrc.conf
+#
+# configuration parameters for procmailrc.sh
+
+# the procmail file to write to
+RCFILE=$HOME/.procmailrc.spam
+
+# CVS root of spamfilter - update this if necessary !
+SPAMFILTERDIR=$HOME/spamfilter
+
+# where to put the spam. /dev/null if you don't like it
+# this assumes a correctly set MAILDIR variable in the main
+# .procmailrc
+SPAMACTION='$MAILDIR/junk'
+
+# path to the rebuild script for the spamfilter
+REBUILD=$SPAMFILTERDIR/rebuild.sh
+
+# path to the actual regexps
+REGEXPDIR=$SPAMFILTERDIR/regexps
diff -Naur -x CVS spamfilter/scripts/procmailrc.sh new/scripts/procmailrc.sh
--- spamfilter/scripts/procmailrc.sh	Thu Jan  1 01:00:00 1970
+++ new/scripts/procmailrc.sh	Fri Apr 27 12:16:23 2001
@@ -0,0 +1,44 @@
+#!/bin/sh
+#
+# create a .procmailrc.spam file to filter it out
+# script started by John Levon <moz@compsoc.man.ac.uk>,
+# so vile sh coding is my fault
+
+# read in config file to set RCFILE, REBUILD
+. `dirname $0`/procmailrc.conf
+
+>$RCFILE
+
+cat >$RCFILE << EOF
+# .procmailrc.spam file
+#
+# include this in your main .procmailrc with INCLUDERC
+
+# this rule will update this file automatically ;)
+:0 c:
+* ^Sender.*spamfilter
+* ^Subject:..CVS..humb
+| /path/to/spamfilter/rebuild.sh
+EOF
+
+cat $REGEXPDIR/taboo_headers | while read ln
+do
+	cat >>$RCFILE << EOF
+
+:0
+EOF
+	MATCH=`echo $ln | sed 's+^/++;s+/i$++'`
+	echo "* $MATCH" >>$RCFILE
+	echo "$SPAMACTION" >>$RCFILE
+done
+
+cat $REGEXPDIR/taboo_body | while read ln
+do
+	cat >>$RCFILE << EOF
+
+:0 B
+EOF
+	MATCH=`echo $ln | sed 's+^/++;s+^m%++;s+/i$++;s+%i++;'`
+	echo "* $MATCH" >>$RCFILE
+	echo "$SPAMACTION" >>$RCFILE
+done

-
Spamfilter:    spam magnet and regexp collector / blocker
Archive:       http://mail.nl.linux.org/