]> 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:

do not except debconf this year
[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 GREP="$NICE /bin/grep"
27 EGREP="$NICE /bin/egrep"
28 FGREP="$NICE /bin/fgrep"
29 SED="$NICE /bin/sed"
30 BIN_DATE="/bin/date"
31 DELIVER="$NICE /usr/lib/dovecot/deliver"
32
33 CRM114="$NICE /usr/share/crm114/mailreaver.crm -u $MAILFILT/crm114/"
34 SA_PREFS="$MAILFILT/spamassassin/user_prefs"
35 SPAMASSASSIN="$NICE /usr/bin/spamassassin --prefs-file=$SA_PREFS"
36 SPAMC="$NICE /usr/bin/spamc --log-to-stderr --no-safe-fallback"
37 #SPAMC="$SPAMASSASSIN"
38 TRAINER="$NICE $MAILFILT/bin/train"
39
40 SQLITE="$NICE /usr/bin/sqlite3"
41
42 BASE=$HOME/.maildir
43
44 #DEFAULT="|$DELIVER"
45 DEFAULT=$BASE/
46 ORGMAIL=$HOME/BOUNCED-MAIL
47
48 # maximum message size for spam checking
49 SPAMCHECK_MAX_MESSAGE_SIZE=512000
50
51 # if crm114 is unsure and SA returns a score less-than-or-equal to this,
52 # autotrain crm114 with ham
53 CRM_UNSURE_SA_AUTOTRAIN_LIMIT_HAM=0.0
54 # if crm114 classifies a message as spam but SA returns a score
55 # less-than-or-equal to this, retrain crm114
56 CRM_MISCLASSIFY_SA_AUTOTRAIN_LIMIT_HAM=-1.0
57 # if crm114 is unsure and SA returns a score greater than this, autotrain
58 # crm114 with spam
59 CRM_UNSURE_SA_AUTOTRAIN_LIMIT_SPAM=8.0
60 # if crm114 classifies a message as ham but SA returns a score
61 # greate than this, retrain crm114
62 CRM_MISCLASSIFY_SA_AUTOTRAIN_LIMIT_SPAM=11
63
64 ### constants used in rules
65 NL="
66 "
67 RE_MYDOMAIN="(.+\.)*madduck\.net"
68 RE_MAILRELAYS="(seamus|clegg)\.madduck\.net"
69 RE_SPACE="[     ]"
70 RE_NOT_SPACE="[^        ]"
71 RE_SPACE_NEWLINE="(^|$RE_SPACE)"
72 RE_FIRSTNAME="martin($RE_SPACE_NEWLINE+f(\.?|elix))?"
73 RE_LASTNAME="kraff?t"
74 RE_EXTRACT_HEADER_VALUE="$RE_SPACE*\/$RE_NOT_SPACE.*"
75 RE_EMAILADDRESS="${RE_NOT_SPACE}+@${RE_NOT_SPACE}+\.[^  >]+"
76
77 DEJAVU_HEADER=X-Deja-Vu
78
79 NULL=/dev/null
80 DELAYED_QUEUE=$BASE/.delayed/
81 TICKLER_QUEUE=$BASE/.store/
82 DISCARD=$BASE/.discard/
83 SPAM=$BASE/.spam/
84 #DISCARD="'|$DELIVER -m BASE.discard'"
85
86 DELAY_NEXT_WEEKEND='next sunday 28 hours ago' # fri night, 20:00
87 DELAY_TONIGHT='tomorrow 00:00 4 hours ago' # tonight at 20:00
88 DELAY_AFTERNOON='tomorrow 00:00 8 hours ago' # today at 16:00
89
90 OURDATE="`$BIN_DATE +'%s %Y%m%d.%H%M.%N %a, %d %b %Y %T %z'`"
91 :0
92 *$ OURDATE ?? ^\/${RE_NOT_SPACE}+
93 { OURDATE_TS="$MATCH" }
94 :0
95 *$ OURDATE ?? ^[0-9]+${RE_SPACE}+\/${RE_NOT_SPACE}+
96 { OURDATE_SHORT="$MATCH" }
97 :0
98 *$ OURDATE ?? ^[0-9]+${RE_SPACE}+[0-9.]+${RE_SPACE}+\/.+
99 { OURDATE="$MATCH" }
100
101 ### variables from the message
102
103 ### local recipient data
104 # user+foobar@my.domain.org
105 # <  >                       $USER
106 #      <    >                $EXTENSION
107 # <         >                $LOCAL
108 #             <           >  $DOMAIN
109 # <                       >  $RECIPIENT
110 USER="${USER:-$LOGNAME}"
111 EXTENSION="${EXTENSION:-}"
112 LOCAL="${LOCAL:-$USER${EXTENSION:++$EXTENSION}}"
113 HOSTNAME="`hostname --fqdn`"
114 DOMAIN="${DOMAIN:-$HOSTNAME}"
115 RECIPIENT="${RECIPIENT:-$LOCAL@$DOMAIN}"
116 ID="$LOGNAME@$HOSTNAME"
117
118 # message-id
119 INCLUDERC=$PMDIR/get-msgid
120
121 :0
122 *$ ^From:$RE_EXTRACT_HEADER_VALUE
123 { FROM="$MATCH" }
124
125 :0
126 * FROM ?? ^.+<\/.+@[^>]+
127 { FROMEMAIL="$MATCH" }
128
129 :0 E
130 * FROM ?? ^.+\(\/.+@[^\)]+
131 { FROMEMAIL="$MATCH" }
132
133 :0 E
134 *$ FROM ?? ^\/$RE_EMAILADDRESS
135 { FROMEMAIL="$MATCH" }
136
137 :0
138 * FROMEMAIL ?? ^".+"$
139 * FROMEMAIL ?? ^"\/[^"]+
140 { FROMEMAIL="$MATCH" }
141
142 # if $SENDER is undefined or not an email address, get it from the message
143 :0
144 * !SENDER ?? @
145 {
146   :0
147   *$ ^Sender:$RE_EXTRACT_HEADER_VALUE
148   { SENDER="$MATCH" }
149
150   :0 E
151   { SENDER="$FROMEMAIL" }
152 }
153
154 :0
155 *$ ^Date:$RE_EXTRACT_HEADER_VALUE
156 { DATE="$MATCH" }
157
158 :0
159 *$ ^Subject:$RE_EXTRACT_HEADER_VALUE
160 {
161   SUBJECT="$MATCH"
162
163   :0
164   * SUBJECT ?? =\?.+\?[QBqb]\?.+\?=
165   {
166     SUBJECT="`PERL_UNICODE=S perl -MEncode=decode -e \"print decode(\\\"MIME-Header\\\", \\\"$SUBJECT\\\") . \\\"\n\\\";\"`"
167     SUBJECT_ENCODED="$MATCH"
168   }
169 }
170
171 :0
172 *$ ^X-Original-To:$RE_EXTRACT_HEADER_VALUE
173 { ORIGINAL_TO="$MATCH" }
174 :0 E
175 * ^Received:
176 { LOGLATER="NO ORIGINAL_TO: $MSGID" }
177
178 :0
179 *$ ^X-Trained-As:$RE_EXTRACT_HEADER_VALUE
180 { TRAINED_AS="$MATCH" }
181
182 :0
183 *$ ^X-Postponed:$RE_EXTRACT_HEADER_VALUE
184 { POSTPONED="$MATCH" }
185
186 # fix variable values for special cases
187 INCLUDERC=$PMDIR/normalise
188
189 :0
190 * ORIGINAL_TO ?? ^\/[^@]+
191 { ORIG_LOCAL="$MATCH" }
192
193 :0
194 * ORIGINAL_TO ?? .+@\/.+
195 { ORIG_DOMAIN="$MATCH" }
196
197 ### run-time variables
198
199 # MSG_DEJAVU
200 # a procmail-style flag, which is true if unset and false if set (to !).
201 # unset by dejavu if the message has already been seen by the filter (according
202 # to the X-Been-There header).
203 MSG_DEJAVU=!
204
205 # DEST
206 # set this to a folder if the message should be delivered elsewhere than the
207 # default
208 DEST
209
210 # SKIP_SPAMCHECKS
211 # if set, cuases spamchecks to be skipped, value lists reason
212 SKIP_SPAMCHECKS
213
214 # SPAMTRAPPED
215 # set by spamtrapped and eqdomains and used to bypass spamchecks and handle as
216 # spam immediately. The value identifies who unset the variable.
217 SPAMTRAPPED
218
219 # IS_SPAM
220 # if set, then the mailfilter is as sure as it gets that the message is spam.
221 # The value identifies who set the variable.
222 IS_SPAM
223
224 # SPAM_DISAGREE
225 # if set, then the various spamchecks disagree about spaminess of the mail.
226 # The value can hold additional information.
227 SPAM_DISAGREE
228
229 # SPAM_UNSURE
230 # if set, then the various spamchecks are unsure about spaminess of the mail.
231 # The value can hold additional information.
232 SPAM_UNSURE
233
234 # SPAM_UNKNOWN
235 # if set, the spamchecks were skipped. The value gives the reason for
236 # skipping.
237 SPAM_UNKNOWN
238
239 # RETRAIN
240 # if set, causes spamfilters to be retrained, according to the variable's value
241 RETRAIN
242
243 # JUSTME
244 # if set, contains reason why justme message was passed
245 JUSTME
246
247 # DISABLE_DELAYS
248 # if set, disables delaying messages
249 DISABLE_DELAYS
250
251 :0
252 * ? test -e $HOME/procmail.nodelays
253 { DISABLE_DELAYS=true }
254
255 # TZ
256 # used to alter the timezone for delay calculations
257 #TZ=Pacific/Auckland
258
259 # DELAY
260 # argument to /bin/date -d to indicate a message delay. This is overridden by
261 # RELEASE
262 DELAY
263
264 # RELEASE
265 # /bin/date time expression indicating the time at which a message is to be
266 # released. Overrides DELAY.
267 RELEASE
268
269 # MARK_READ
270 # when set, causes mails to be marked as read when delivered. Can be
271 # initialised with DELIVER_READ
272 MARK_READ=$DELIVER_READ
273
274 # vim:ft=procmail