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}
22 #NICE='/usr/bin/nice -20'
24 PROCMAIL="$NICE /usr/bin/procmail -p $PMDIR/procmailrc"
25 FORMAIL="$NICE /usr/bin/formail -f"
26 EGREP="$NICE /bin/egrep"
28 DELIVER="$NICE /usr/lib/dovecot/deliver"
30 CRM114="$NICE /usr/share/crm114/mailreaver.crm -u $MAILFILT/crm114/"
31 SA_PREFS="$MAILFILT/spamassassin/user_prefs"
32 SPAMASSASSIN="$NICE /usr/bin/spamassassin --prefs-file=$SA_PREFS"
33 SPAMC="$NICE /usr/bin/spamc --log-to-stderr --no-safe-fallback"
34 #SPAMC="$SPAMASSASSIN"
35 TRAINER="$NICE $MAILFILT/bin/train"
37 SQLITE="$NICE /usr/bin/sqlite3"
43 ORGMAIL=$HOME/BOUNCED-MAIL
45 # maximum message size for spam checking
46 SPAMCHECK_MAX_MESSAGE_SIZE=512000
48 # if crm114 is unsure and SA returns a score less-than-or-equal to this,
49 # autotrain crm114 with ham
50 CRM_UNSURE_SA_AUTOTRAIN_LIMIT_HAM=2.0
51 # if crm114 classifies a message as spam but SA returns a score
52 # less-than-or-equal to this, retrain crm114
53 CRM_MISCLASSIFY_SA_AUTOTRAIN_LIMIT_HAM=-1.0
54 # if crm114 is unsure and SA returns a score greater than this, autotrain
56 CRM_UNSURE_SA_AUTOTRAIN_LIMIT_SPAM=8.0
57 # if crm114 classifies a message as ham but SA returns a score
58 # greate than this, retrain crm114
59 CRM_MISCLASSIFY_SA_AUTOTRAIN_LIMIT_SPAM=11
61 ### constants used in rules
64 RE_MYDOMAIN="(.+\.)*madduck\.net"
65 RE_MAILRELAYS="(seamus|clegg)\.madduck\.net"
68 RE_SPACE_NEWLINE="(^|$RE_SPACE)"
69 RE_FIRSTNAME="martin($RE_SPACE_NEWLINE+f(\.?|elix))?"
71 RE_EXTRACT_HEADER_VALUE="$RE_SPACE*\/$RE_NOT_SPACE.*"
73 DEJAVU_HEADER=X-Deja-Vu
76 DELAYED_QUEUE=$BASE/.delayed/
77 TICKLER_QUEUE=$BASE/.tickler/
78 DISCARD=$BASE/.discard/
79 #DISCARD="'|$DELIVER -m BASE.discard'"
81 OURDATE="`date +'%s %Y.%m.%d.%H.%M.%N %a, %d %b %Y %T %z'`"
83 *$ OURDATE ?? ^\/${RE_NOT_SPACE}+
84 { OURDATE_TS="$MATCH" }
86 *$ OURDATE ?? ^[0-9]+${RE_SPACE}+\/${RE_NOT_SPACE}+
87 { OURDATE_SHORT="$MATCH" }
89 *$ OURDATE ?? ^[0-9]+${RE_SPACE}+[0-9.]+${RE_SPACE}+\/${RE_NOT_SPACE}+
92 ### variables from the message
94 ### local recipient data
95 # user+foobar@my.domain.org
101 USER="${USER:-$LOGNAME}"
102 EXTENSION="${EXTENSION:-}"
103 LOCAL="${LOCAL:-$USER${EXTENSION:++$EXTENSION}}"
104 HOSTNAME="`hostname --fqdn`"
105 DOMAIN="${DOMAIN:-$HOSTNAME}"
106 RECIPIENT="${RECIPIENT:-$LOCAL@$DOMAIN}"
107 ID="$LOGNAME@$HOSTNAME"
110 INCLUDERC=$PMDIR/get-msgid
112 # if $SENDER is undefined or not an email address, get it from the message
115 *$ ^Sender:$RE_EXTRACT_HEADER_VALUE
119 *$ ^Date:$RE_EXTRACT_HEADER_VALUE
123 *$ ^From:$RE_EXTRACT_HEADER_VALUE
127 *$ ^Subject:$RE_EXTRACT_HEADER_VALUE
131 *$ ^X-Original-To:$RE_EXTRACT_HEADER_VALUE
132 { ORIGINAL_TO="$MATCH" }
134 { LOG="NO ORIGINAL_TO: $MSGID" }
137 *$ ^X-Trained-As:$RE_EXTRACT_HEADER_VALUE
138 { TRAINED_AS="$MATCH" }
141 *$ ^X-Tickle-Delivered:$RE_EXTRACT_HEADER_VALUE
142 { TICKLE_DELIVERED="$MATCH" }
145 *$ ^X-Delayed:$RE_EXTRACT_HEADER_VALUE
148 # fix variable values for special cases
149 INCLUDERC=$PMDIR/normalise
152 * ORIGINAL_TO ?? ^\/[^@]+
153 { ORIG_LOCAL="$MATCH" }
156 * ORIGINAL_TO ?? .+@\/.+
157 { ORIG_DOMAIN="$MATCH" }
159 ### run-time variables
162 # a procmail-style flag, which is true if unset and false if set (to !).
163 # unset by dejavu if the message has already been seen by the filter (according
164 # to the X-Been-There header).
168 # set this to a folder if the message should be delivered elsewhere than the
173 # if set, cuases spamchecks to be skipped, value lists reason
177 # set by spamtrapped and eqdomains and used to bypass spamchecks and handle as
178 # spam immediately. The value identifies who unset the variable.
182 # if set, then the mailfilter is as sure as it gets that the message is spam.
183 # The value identifies who set the variable.
187 # if set, then the various spamchecks disagree about spaminess of the mail.
188 # The value can hold additional information.
192 # if set, then the various spamchecks are unsure about spaminess of the mail.
193 # The value can hold additional information.
197 # if set, the spamchecks were skipped. The value gives the reason for
202 # if set, causes spamfilters to be retrained, according to the variable's value
206 # if set, contains reason why justme message was passed