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.
4 PATH=$HOME/bin:/usr/local/bin:/usr/bin:/bin
11 PMVAR=$HOME/.var/procmail
12 MAILFILT=$HOME/.etc/mailfilter
15 REPLIES=$MAILFILT/autoreplies
17 LOGFILE=${LOGFILE:-$PMVAR/log}
20 #NICE='/usr/bin/nice -20'
22 PROCMAIL="$NICE /usr/bin/procmail -p $PMDIR/procmailrc"
23 FORMAIL="$NICE /usr/bin/formail -f"
24 EGREP="$NICE /bin/egrep"
26 DELIVER="$NICE /usr/lib/dovecot/deliver"
28 CRM114="$NICE /usr/share/crm114/mailreaver.crm -u $MAILFILT/crm114/"
29 SA_PREFS="$MAILFILT/spamassassin/user_prefs"
30 SPAMASSASSIN="$NICE /usr/bin/spamassassin --prefs-file=$SA_PREFS"
31 SPAMC="$NICE /usr/bin/spamc --log-to-stderr --no-safe-fallback"
32 #SPAMC="$SPAMASSASSIN"
33 TRAINER="$MAILFILT/bin/train"
36 OURDATE_SHORT=`date +%Y.%m.%d.%H.%M.%N`
42 ORGMAIL=$HOME/BOUNCED-MAIL
44 # maximum message size for spam checking
45 SPAMCHECK_MAX_MESSAGE_SIZE=2500000
47 # if crm114 is unsure and SA returns a score less-than-or-equal to this,
48 # autotrain crm114 with ham
49 CRM_UNSURE_SA_AUTOTRAIN_LIMIT_HAM=2.0
50 # if crm114 classifies a message as spam but SA returns a score
51 # less-than-or-equal to this, retrain crm114
52 CRM_MISCLASSIFY_SA_AUTOTRAIN_LIMIT_HAM=-1.0
53 # if crm114 is unsure and SA returns a score greater than this, autotrain
55 CRM_UNSURE_SA_AUTOTRAIN_LIMIT_SPAM=8.0
56 # if crm114 classifies a message as ham but SA returns a score
57 # greate than this, retrain crm114
58 CRM_MISCLASSIFY_SA_AUTOTRAIN_LIMIT_SPAM=11
60 ### constants used in rules
63 RE_MYDOMAIN="(.+\.)*madduck\.net"
64 RE_MAILRELAYS="(seamus|clegg)\.madduck\.net"
65 RE_SPACE_NEWLINE="(^|[ ])"
66 RE_FIRSTNAME="martin($RE_SPACE_NEWLINE+f(\.?|elix))?"
68 RE_EXTRACT_HEADER_VALUE="[ ]*\/[^ ].*"
70 DEJAVU_HEADER=X-Deja-Vu
73 DISCARD=$BASE/.discard/
74 #DISCARD="'|$DELIVER -m BASE.discard'"
76 ### variables from the message
78 ### local recipient data
79 # user+foobar@my.domain.org
85 USER="${USER:-$LOGNAME}"
86 EXTENSION="${EXTENSION:-}"
87 LOCAL="${LOCAL:-$USER${EXTENSION:++$EXTENSION}}"
88 HOSTNAME="`hostname --fqdn`"
89 DOMAIN="${DOMAIN:-$HOSTNAME}"
90 RECIPIENT="${RECIPIENT:-$LOCAL@$DOMAIN}"
91 ID="$LOGNAME@$HOSTNAME"
94 INCLUDERC=$PMDIR/get-msgid
96 # if $SENDER is undefined or not an email address, get it from the message
99 *$ ^Sender:$RE_EXTRACT_HEADER_VALUE
103 *$ ^Date:$RE_EXTRACT_HEADER_VALUE
107 *$ ^From:$RE_EXTRACT_HEADER_VALUE
111 *$ ^Subject:$RE_EXTRACT_HEADER_VALUE
114 # TODO: can be removed as soon as albatross is out of the loop
116 * ^X-Original-To-Saved: \/.*
117 |$FORMAIL -R X-Original-To-Saved X-Original-To
120 *$ ^X-Original-To:$RE_EXTRACT_HEADER_VALUE
121 { ORIGINAL_TO="$MATCH" }
123 { LOG="NO ORIGINAL_TO: $MSGID" }
125 # fix variable values for special cases
126 INCLUDERC=$PMDIR/normalise
129 * ORIGINAL_TO ?? ^\/[^@]+
130 { ORIG_LOCAL="$MATCH" }
133 * ORIGINAL_TO ?? .+@\/.+
134 { ORIG_DOMAIN="$MATCH" }
136 ### run-time variables
139 # a procmail-style flag, which is true if unset and false if set (to !).
140 # unset by dejavu if the message has already been seen by the filter (according
141 # to the X-Been-There header).
145 # if set, cuases spamchecks to be skipped, value lists reason
149 # set by spamtrapped and eqdomains and used to bypass spamchecks and handle as
150 # spam immediately. The value identifies who unset the variable.
154 # if set, then the mailfilter is as sure as it gets that the message is spam.
155 # The value identifies who set the variable.
159 # if set, then the various spamchecks disagree about spaminess of the mail.
160 # The value can hold additional information.
164 # if set, then the various spamchecks are unsure about spaminess of the mail.
165 # The value can hold additional information.
169 # if set, the spamchecks were skipped. The value gives the reason for
174 # if set, causes spamfilters to be retrained, according to the variable's value
178 # if set, contains reason why justme message was passed