]> git.madduck.net Git - etc/mailfilter.git/blob - procmail/defines

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:

d0da2efbcdfc90cb6a3f67f3468c9c4663ca2db9
[etc/mailfilter.git] / procmail / defines
1 ### basic settings
2
3 SHELL=/bin/sh
4 PATH=$HOME/bin:/usr/local/bin:/usr/bin:/bin
5
6 COMSAT=no
7
8 LINEBUF=16384
9 UMASK=0077
10
11 PMVAR=$HOME/.var/procmail
12 MAILFILT=$HOME/.etc/mailfilter
13 PMRULES=$PMDIR/rules
14 CONF=$MAILFILT/config
15 REPLIES=$MAILFILT/autoreplies
16
17 LOGFILE=${LOGFILE:-$PMVAR/log}
18 LOGABSTRACT=no
19
20 LC_CTYPE=de_CH.UTF-8
21
22 #NICE='/usr/bin/nice -20'
23
24 PROCMAIL="$NICE /usr/bin/procmail -p $PMDIR/procmailrc"
25 FORMAIL="$NICE /usr/bin/formail -f"
26 EGREP="$NICE /bin/egrep"
27 SED="$NICE /bin/sed"
28 BIN_DATE="/bin/date"
29 DELIVER="$NICE /usr/lib/dovecot/deliver"
30
31 CRM114="$NICE /usr/share/crm114/mailreaver.crm -u $MAILFILT/crm114/"
32 SA_PREFS="$MAILFILT/spamassassin/user_prefs"
33 SPAMASSASSIN="$NICE /usr/bin/spamassassin --prefs-file=$SA_PREFS"
34 SPAMC="$NICE /usr/bin/spamc --log-to-stderr --no-safe-fallback"
35 #SPAMC="$SPAMASSASSIN"
36 TRAINER="$NICE $MAILFILT/bin/train"
37
38 SQLITE="$NICE /usr/bin/sqlite3"
39
40 BASE=$HOME/.maildir
41
42 #DEFAULT="|$DELIVER"
43 DEFAULT=$BASE/
44 ORGMAIL=$HOME/BOUNCED-MAIL
45
46 # maximum message size for spam checking
47 SPAMCHECK_MAX_MESSAGE_SIZE=512000
48
49 # if crm114 is unsure and SA returns a score less-than-or-equal to this,
50 # autotrain crm114 with ham
51 CRM_UNSURE_SA_AUTOTRAIN_LIMIT_HAM=2.0
52 # if crm114 classifies a message as spam but SA returns a score
53 # less-than-or-equal to this, retrain crm114
54 CRM_MISCLASSIFY_SA_AUTOTRAIN_LIMIT_HAM=-1.0
55 # if crm114 is unsure and SA returns a score greater than this, autotrain
56 # crm114 with spam
57 CRM_UNSURE_SA_AUTOTRAIN_LIMIT_SPAM=8.0
58 # if crm114 classifies a message as ham but SA returns a score
59 # greate than this, retrain crm114
60 CRM_MISCLASSIFY_SA_AUTOTRAIN_LIMIT_SPAM=11
61
62 ### constants used in rules
63 NL="
64 "
65 RE_MYDOMAIN="(.+\.)*madduck\.net"
66 RE_MAILRELAYS="(seamus|clegg)\.madduck\.net"
67 RE_SPACE="[     ]"
68 RE_NOT_SPACE="[^        ]"
69 RE_SPACE_NEWLINE="(^|$RE_SPACE)"
70 RE_FIRSTNAME="martin($RE_SPACE_NEWLINE+f(\.?|elix))?"
71 RE_LASTNAME="kraff?t"
72 RE_EXTRACT_HEADER_VALUE="$RE_SPACE*\/$RE_NOT_SPACE.*"
73
74 DEJAVU_HEADER=X-Deja-Vu
75
76 NULL=/dev/null
77 DELAYED_QUEUE=$BASE/.delayed/
78 TICKLER_QUEUE=$BASE/.tickler/
79 DISCARD=$BASE/.discard/
80 SPAM=$BASE/.spam/
81 #DISCARD="'|$DELIVER -m BASE.discard'"
82
83 DELAY_NEXT_WEEKEND='next sunday 28 hours ago' # fri night, 20:00
84 DELAY_TONIGHT='tomorrow 00:00 4 hours ago' # tonight at 20:00
85
86 OURDATE="`$BIN_DATE +'%s %Y.%m.%d.%H.%M.%N %a, %d %b %Y %T %z'`"
87 :0
88 *$ OURDATE ?? ^\/${RE_NOT_SPACE}+
89 { OURDATE_TS="$MATCH" }
90 :0
91 *$ OURDATE ?? ^[0-9]+${RE_SPACE}+\/${RE_NOT_SPACE}+
92 { OURDATE_SHORT="$MATCH" }
93 :0
94 *$ OURDATE ?? ^[0-9]+${RE_SPACE}+[0-9.]+${RE_SPACE}+\/.+
95 { OURDATE="$MATCH" }
96
97 ### variables from the message
98
99 ### local recipient data
100 # user+foobar@my.domain.org
101 # <  >                       $USER
102 #      <    >                $EXTENSION
103 # <         >                $LOCAL
104 #             <           >  $DOMAIN
105 # <                       >  $RECIPIENT
106 USER="${USER:-$LOGNAME}"
107 EXTENSION="${EXTENSION:-}"
108 LOCAL="${LOCAL:-$USER${EXTENSION:++$EXTENSION}}"
109 HOSTNAME="`hostname --fqdn`"
110 DOMAIN="${DOMAIN:-$HOSTNAME}"
111 RECIPIENT="${RECIPIENT:-$LOCAL@$DOMAIN}"
112 ID="$LOGNAME@$HOSTNAME"
113
114 # message-id
115 INCLUDERC=$PMDIR/get-msgid
116
117 # if $SENDER is undefined or not an email address, get it from the message
118 :0
119 * !SENDER ?? @
120 *$ ^Sender:$RE_EXTRACT_HEADER_VALUE
121 { SENDER="$MATCH" }
122
123 :0
124 *$ ^Date:$RE_EXTRACT_HEADER_VALUE
125 { DATE="$MATCH" }
126
127 :0
128 *$ ^From:$RE_EXTRACT_HEADER_VALUE
129 { FROM="$MATCH" }
130
131 :0
132 *$ ^Subject:$RE_EXTRACT_HEADER_VALUE
133 {
134   SUBJECT=$MATCH
135
136   :0
137   * SUBJECT ?? =\?(iso-8859-1|utf-8)\?\/..[^\?]*
138   {
139     :0
140     * MATCH ?? B\?\/[^\?]*
141     { BBB=`echo $SUBJECT | mimencode -u` }
142
143     :0
144     * MATCH ?? Q\?\/[^\?]*
145     { QQQ=`echo $SUBJECT | mimencode -u -q` }
146
147     SUBJECT="$QQQ$BBB"
148   }
149 }
150
151 :0
152 *$ ^X-Original-To:$RE_EXTRACT_HEADER_VALUE
153 { ORIGINAL_TO="$MATCH" }
154 :0 E
155 { LOG="NO ORIGINAL_TO: $MSGID" }
156
157 :0
158 *$ ^X-Trained-As:$RE_EXTRACT_HEADER_VALUE
159 { TRAINED_AS="$MATCH" }
160
161 :0
162 *$ ^X-Tickle-Delivered:$RE_EXTRACT_HEADER_VALUE
163 { TICKLE_DELIVERED="$MATCH" }
164
165 :0
166 *$ ^X-Delayed:$RE_EXTRACT_HEADER_VALUE
167 { DELAYED="$MATCH" }
168
169 # fix variable values for special cases
170 INCLUDERC=$PMDIR/normalise
171
172 :0
173 * ORIGINAL_TO ?? ^\/[^@]+
174 { ORIG_LOCAL="$MATCH" }
175
176 :0
177 * ORIGINAL_TO ?? .+@\/.+
178 { ORIG_DOMAIN="$MATCH" }
179
180 ### run-time variables
181
182 # MSG_DEJAVU
183 # a procmail-style flag, which is true if unset and false if set (to !).
184 # unset by dejavu if the message has already been seen by the filter (according
185 # to the X-Been-There header).
186 MSG_DEJAVU=!
187
188 # DEST
189 # set this to a folder if the message should be delivered elsewhere than the
190 # default
191 DEST
192
193 # SKIP_SPAMCHECKS
194 # if set, cuases spamchecks to be skipped, value lists reason
195 SKIP_SPAMCHECKS
196
197 # SPAMTRAPPED
198 # set by spamtrapped and eqdomains and used to bypass spamchecks and handle as
199 # spam immediately. The value identifies who unset the variable.
200 SPAMTRAPPED
201
202 # IS_SPAM
203 # if set, then the mailfilter is as sure as it gets that the message is spam.
204 # The value identifies who set the variable.
205 IS_SPAM
206
207 # SPAM_DISAGREE
208 # if set, then the various spamchecks disagree about spaminess of the mail.
209 # The value can hold additional information.
210 SPAM_DISAGREE
211
212 # SPAM_UNSURE
213 # if set, then the various spamchecks are unsure about spaminess of the mail.
214 # The value can hold additional information.
215 SPAM_UNSURE
216
217 # SPAM_UNKNOWN
218 # if set, the spamchecks were skipped. The value gives the reason for
219 # skipping.
220 SPAM_UNKNOWN
221
222 # RETRAIN
223 # if set, causes spamfilters to be retrained, according to the variable's value
224 RETRAIN
225
226 # JUSTME
227 # if set, contains reason why justme message was passed
228 JUSTME
229
230 # DISABLE_DELAYS
231 # if set, disables delaying messages
232 DISABLE_DELAYS