]> git.phdru.name Git - dotfiles.git/blob - .procmailrc
Exclude some automatic messages from vacation
[dotfiles.git] / .procmailrc
1 #
2 # User configuration file for procmail
3 #
4
5 #
6 # SET VARIABLES
7
8 # Internal Variables
9
10 SHELL=/bin/sh               #Shell used to run procmail.  Be sure this points to
11                             #your system's copy of sh.  DO NOT substitute a
12                             #different shell unless you really know Unix
13
14 LINEBUF=4096                #Needed to keep Procmail from choking on long
15                             #"recipes", or instructions on what to do with
16                             #particular kinds of email.
17
18 PATH=$HOME/bin:$HOME/mail/bin:/bin:/usr/bin:/usr/local/bin
19                             #Path for your programs -- this is probably best
20                             #left alone.
21
22 VERBOSE=off                 #Change this to "on" when you try a new recipe
23                             #so that Procmail will log literally every step
24                             #it takes.  DO NOT LEAVE IT ON, though, because
25                             #it creates huge logfiles.
26
27 # Default Program & file locations
28
29 MAILDIR=${HOME}/Mail        #you'd better make sure this directory exists
30
31 #ORGMAIL=/var/spool/mail/phd
32 #DEFAULT=${ORGMAIL}
33
34 LOGFILE=${MAILDIR}/procmail.log      #Logs message disposition.  Recommended -- otherwise
35                                      #errors are emailed to you. :/
36
37 SENDMAIL=/usr/sbin/sendmail    #useful for autoreply recipes.
38 FORMAIL=/usr/bin/formail       #useful for autoreply recipes.
39
40
41 MYEMAIL=${HOME}/mail/misc/.myemail   #Tells Procmail where your MYEMAIL
42                                      #file is located, a text file containing all the
43                                      #email addresses you use.
44
45 ADMINFOLDER=${MAILDIR}/admin         #for bounced mail, mail from root,
46                                      #postmaster, abuse, etc.
47
48 BLOCKFOLDER=${MAILDIR}/block         #for suspicious mail, but possibly not spam
49
50 BULKFOLDER=${MAILDIR}/bulk           #for bulk mail which appears legitimate, such
51                                      #as mail from mailing lists or mail sent using
52                                      #Bcc:
53
54 SPAMFOLDER=${MAILDIR}/spam           #change this to SPAMFOLDER=/dev/null
55                                      #to delete spam entirely.
56
57 VIRUSFOLDER=/dev/null                #Set this variable to /dev/null to delete
58                                      #all viruses. You don't want to take chances with a virus,
59                                      #and the false positive rate on the virus filters is near zero.
60
61 # BEGIN RECIPES
62
63
64 # Create a backup cache of 2000 most recent messages in case of mistakes
65 :0 c
66 backup
67
68   :0 ic
69   | cd backup && rm -f dummy `ls -t msg.* | sed -e 1,2000d`
70
71 # Regenerate "From" lines to make sure they are valid
72 :0 fhw
73 | ${FORMAIL} -I "From " -a "From "
74
75
76 # *CLOSED (only subscribers can write)* MAILING LISTS
77 # No need to filter them for spam
78
79 :0
80 * ^List-Id: Moscow Linux User Group <mlug\.UnixCenter\.RU>
81 lists/mlug
82
83 :0
84 * ^(From|To|Cc|Reply-To): .*((mlug@unixcenter\.ru)|@altlinux\.ru)
85 lists/mlug
86
87 :0
88 * ^(To|Cc|Reply-To|Resent-To|X-BeenThere): .*(-list@(python\.org|cwi\.nl))
89 lists/python
90
91 :0
92 * ^Sender: python-list-admin@python\.org
93 lists/python
94
95 :0
96 * ^Newsgroups: .*comp\.lang\.python
97 lists/python
98
99 :0
100 * ^List-Id: Python core developers <python-dev\.python\.org>
101 lists/python
102
103 :0
104 * ^List-Id: "Python 3000 process, design, development" <python-3000\.python\.org>
105 lists/python
106
107 :0
108 * ^List-Id: Discussions of speculative Python language ideas.*<python-ideas\.python\.org>
109 lists/python
110
111 :0
112 * ^Sender: "Email-SIG" <email-sig-bounces\+phd=phdru\.name@python\.org>
113 lists/python
114
115 :0
116 * ^Sender: mimelib-devel-admin@lists\.sourceforge\.net
117 lists/python
118
119 :0
120 * ^List-Id: Discussion of the Quixote Web development framework.*<quixote-users\.mems-exchange\.org>
121 lists/python
122
123 :0
124 * ^List-Id: Discussion of the Durus object database.*<durus-users\.mems-exchange\.org>
125 lists/python
126
127 :0
128 * ^From: sitelist-bounces@lists\.sourceforge\.net
129 * ^To: sqlobject-discuss-owner@lists\.sourceforge\.net
130 * ^Subject: Uncaught bounce notification
131 ${SPAMFOLDER}
132
133 :0
134 * ^From: sqlobject-cvs-bounces@lists\.sourceforge\.net
135 * ^To: sqlobject-cvs-owner@lists\.sourceforge\.net
136 * ^Subject: Auto-discard notification
137 ${SPAMFOLDER}
138
139 :0
140 * ^List-Id: .+<sqlobject-(discuss|cvs)\.lists\.sourceforge\.net>
141 lists/python
142
143 :0
144 * ^To: "(\[sqlobject:bugs\] )|(Ticket [0-9]+)" <[0-9]+@bugs\.sqlobject\.p\.re\.sf\.net>
145 * ^Reply-To: "?(\\?\[sqlobject:bugs\\?\] )|(Ticket [0-9]+)"? <[0-9]+@bugs\.sqlobject\.p\.re\.sf\.net>
146 * ^Subject: (\[SQL-CVS\] )?\[sqlobject:bugs\] (Re: )?\#[0-9]+
147 lists/python
148
149 :0
150 * ^Sender: ppa-qps-devel-admin@lists\.sourceforge\.net
151 lists/python
152
153 :0
154 * ^Sender: pysqlite-bounces@lists\.initd\.org
155 lists/python
156
157 :0
158 * ^List-Id: <parsedatetime-dev\.googlegroups\.com>
159 lists/python
160
161 :0
162 * ^(To|Cc|Reply-To|Resent-To|Sender): .*(zope.*@zope\.(org|net|com))|(zip@eevolute\.com)
163 lists/zope
164
165
166 # Now filters
167
168 # Klez
169 :0 B
170 * ^Content-Transfer-Encoding: base64
171 * name( ?)=.*\.(com|exe|bat|scr|pif)
172 | ${FORMAIL} -A"X-Note: Klez" -A"X-Folder: Virus" >${VIRUSFOLDER}
173
174 # Sobig.E
175 :0 HB
176 * ^Subject: Re: (Movie|Application)$
177 * ^Content-Transfer-Encoding: base64
178 * ^Content-Disposition: attachment;
179 * filename=.your_details\.zip
180 | ${FORMAIL} -A"X-Note: Sobig.E" -A"X-Folder: Virus" >${VIRUSFOLDER}
181
182 # Sobig.F
183 :0 H
184 * ^Subject: .*(Thank you!|Your application|That movie|Approved|Details|My details|Your details|Wicked screensaver)$
185 * ^X-MailScanner: Found to be clean$
186 | ${FORMAIL} -A"X-Note: Sobig.F" -A"X-Folder: Virus" >${VIRUSFOLDER}
187
188 # MyDoom/Novarg
189 :0 HB
190 * <50000
191 * ^Subject: (test|hi|hello|Mail Delivery System|Mail Transaction Failed|Server Report|Status|Error|)$
192 * ^Content-type: application/octet-stream;
193 * (file)?name="(document|readme|doc|text|file|data|test|message|body)\.(pif|scr|exe|cmd|bat|zip)
194 | ${FORMAIL} -A"X-Note: MyDoom" -A"X-Folder: Virus" >${VIRUSFOLDER}
195
196 # Netsky
197 :0
198 * > 20000
199 * < 60000
200 * ^Subject:[ ]*(hi|hello|read it immediately|\
201 something for you|warning|information|stolen|fake|unknown)
202 * B ?? ^(anything ok\?|what does it mean?|ok|\
203 i'm waiting|read the details\.|here is the document\.|\
204 read it immediately\!|my hero|\
205 here|is that true?|is that your name?|is that your account?|\
206 i wait for a reply\!|is that from you?|you are a bad writer|\
207 I have your password\!|something about you\!|\
208 kill the writer of this document\!|i hope it is not true\!|\
209 your name is wrong|i found this document about you|\
210 yes, really\?|that is bad|here it is|see you|\
211 greetings|stuff about you\?|something is going wrong!|\
212 information about you|about me|from the chatter|\
213 here, the serials|here, the introduction|here, the cheats|\
214 that's funny|do you\?|reply|take it easy|why\?|\
215 thats wrong|misc|you earn money|you feel the same|\
216 you try to steal|you are bad|something is going wrong|\
217 something is fool)$
218 * B ?? ^(Content-Disposition:[  ]*attachment;)?[        ]*(file)?name="?(document|msg|doc|talk|message|creditcard|\
219 details|attachment|me|stuff|posting|textfile|concert|\
220 information|note|bill|swimmingpool|product|\
221 topseller|ps|shower|aboutyou|nomoney| found|\
222 story|mails|website|friend|jokes|location|\
223 final|release|dinner|ranking|object|mail2|part2|\
224 disco|party|misc)\..*(zip|exe|scr|com|pif)"?$
225 | ${FORMAIL} -A"X-Note: Netsky" -A"X-Folder: Virus" >${VIRUSFOLDER}
226
227 # Bagle.J
228 :0
229 * ^Subject:(.*E-mail account disabling warning)|\
230    (.*E-mail account security warning)|\
231    (.*Email account utilization warning)|\
232    (.*Important notify about your e-mail account)|\
233    (.*Notify about using the e-mail account)|\
234    (.*Notify about your e-mail account utilization)|\
235    (.*Warning about your e-mail account)
236 * B ?? ^Content-Type: application/octet-stream;
237 * B ?? ^Content-Transfer-Encoding: base64
238 * B ?? ^Content-Disposition: attachment;
239 | ${FORMAIL} -A"X-Note: Bagle.J" -A"X-Folder: Virus" >${VIRUSFOLDER}
240
241
242 # From http://www.internetguru.com.au/igblog-102.html
243
244 # Redirect common virus attachments inc. zipped versions
245 :0 B
246 * name=.*(document|readme|doc|text|file|data|test|message|body)\.(vbs\"|wsf\"|vbe\"|wsh\"|hta\"|scr\"|pif\"|exe\"|shs\"|bat\"|bas\"|cmd\"|zip\")
247 {
248    :0
249    | ${FORMAIL} -A"X-Note: executable attachment virus" -A"X-Folder: Virus" >>${VIRUSFOLDER}
250 }
251
252 # Some more common virus attachments inc. zipped versions
253 :0 B
254 * name=.*(Attach|Information|Readme|Document|Info|TextDocument|Textfile|MoreInfo|Message)\.(pif\"|zip\")
255 {
256    :0
257    | ${FORMAIL} -A"X-Note: executable attachment virus" -A"X-Folder: Virus" >>${VIRUSFOLDER}
258 }
259
260 # Redirect windows executables (note - haven't included exe and com
261 :0 B
262 * name=.*\.(vbs\"|wsf\"|vbe\"|wsh\"|hta\"|scr\"|pif\"|shs\"|bat\"|bas\"|scr\"|dll\")
263 {
264    :0
265    | ${FORMAIL} -A"X-Note: executable attachment virus" -A"X-Folder: Virus" >>${VIRUSFOLDER}
266 }
267
268 # This one finds them annoying Custom Logo spams that seem to get past most filters
269 :0 B
270 * .*out\.php\?email\=(sales|info)\@
271 {
272    :0
273    | ${FORMAIL} -A"X-Note: Custom Logo spam" -A"X-Folder: Spam" >>${SPAMFOLDER}
274 }
275
276 # This catches about 99% of deliberate viagra mispellings ie v1@GRa, v1agr@ etc
277 :0 H
278 * ^Subject.*[Vv][1jl\|][aA\@][Gg][Rr][Aa\@]
279 {
280    :0
281    | ${FORMAIL} -A"X-Note: viagra spam" -A"X-Folder: Spam" >/dev/null
282 }
283
284
285 # Chineese/japaneese/korean spam
286
287 :0
288 * ^Content-Type: text/(plain|html); *charset=("?)(big5|gb2312|iso-2022-jp|ks_c_5601-1987|shift_jis)("?)
289 | ${FORMAIL} -A"X-Note: chineese/japaneese/korean charset" -A"X-Folder: Spam" >/dev/null
290
291 :0
292 * ^X-RBL-Warning: .*(china|korea) does not seem to care about spam
293 | ${FORMAIL} -A"X-Note: chineese/korean source" -A"X-Folder: Spam" >>${SPAMFOLDER}
294
295
296 # SpamAssassin (spamassassin.org)
297 :0fw
298 * < 10240000
299 | spamc -U /tmp/spamassassin.sock -s 10240000
300
301 # Mail with a score of 14 or higher is certainly spam
302 :0:
303 * ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*
304 | ${FORMAIL} -A"X-Note: certainly spam" -A"X-Folder: Spam" >/dev/null
305
306 :0:
307 * ^X-Spam-Status: Yes
308 * > 20000
309 | ${FORMAIL} -A"X-Note: oversized spam" -A"X-Folder: Spam" >/dev/null
310
311 :0 HB:
312 * ^X-Spam-Status: Yes
313 * http://www\.gstinc\.com/
314 | ${FORMAIL} -A"X-Note: gstinc spam" -A"X-Folder: Spam" >/dev/null
315
316 :0 HB:
317 * ^X-Spam-Status: Yes
318 * (www\.)?sonidom\.ru
319 | ${FORMAIL} -A"X-Note: sonidom spam" -A"X-Folder: Spam" >/dev/null
320
321 :0 HB:
322 * ^X-Spam-Status: Yes
323 * (www\.)?pos-tel\.ru
324 | ${FORMAIL} -A"X-Note: pos-tel spam" -A"X-Folder: Spam" >/dev/null
325
326 :0 HB:
327 * ^X-Spam-Status: Yes
328 * @besttraining\.ru
329 | ${FORMAIL} -A"X-Note: besttraining spam" -A"X-Folder: Spam" >/dev/null
330
331 # HTML-only mail is almost certainly spam
332 #:0
333 #* ^Content-Type: text/html
334 #| ${FORMAIL} -A"X-Note: HTML-only mail" -A"X-Folder: Spam" >/dev/null
335
336 :0:
337 * ^X-Spam-Status: Yes
338 ${SPAMFOLDER}
339
340
341 # MAILING LISTS
342
343 # Filter out mail from all mailing lists you are on. Just duplicate the recipe
344 # for each mailing list you are on, and put the correct address for the list in
345 # the condition statement. (The "* ^TO" part.) If you read mail on shell, you
346 # may find it easier to deliver this mail to separate folders, especially for
347 # busy lists. I do. :)
348
349
350 # Block all messages that are too big
351 :0
352 * > 1000000
353 | ${FORMAIL} -A"X-Note: the message is too big" -A"X-Folder: Block" >>${BLOCKFOLDER}
354
355
356 # unfiltered mail marked by exim (using RBL/ORBS/etc)
357
358 :0
359 * ^X-RBL-Warning:
360 * ^(To|Cc):.*phd
361 ${BLOCKFOLDER}
362
363 :0
364 * ^X-RBL-Warning:
365 ${SPAMFOLDER}
366
367
368 # Sort out mail that really is to you from mail Bcc'd to you, or mail
369 # which doesn't have any of your email addresses on the To: or Cc: line.
370 # For this to work properly, you must create a text file named .myemail
371 # in your home directory and enter all email addresses that belong to
372 # you in it, one per line, just as you do with your .nobounce file.
373 #
374 # This does =wonders= in keeping spam from appearing in your personal
375 # mail. :)
376 #
377 # Substitute your shell account email address, custom domain, and any other email
378 # address you may have for the entries below.
379 :0:
380 * ? test -f ${MYEMAIL} && \
381     (${FORMAIL} -zxTo: -zxCc: |\
382     fgrep -i -f ${MYEMAIL})
383 | ${FORMAIL} -A"X-Folder: Default" >>${DEFAULT}
384
385 # Deliver email which passed spam filtering, but which wasn't sent to
386 # a recognizable personal email address of yours, to your "bulk mail"
387 # folder, for reading on a less-urgent basis.
388 :0:
389 | ${FORMAIL} -A"X-Folder: Bulk" >>${BULKFOLDER}
390
391
392 # Vacation - modified version of procmail example from "man procmailex"
393
394 # Drop duplicates
395 #:0 Wh: msgid.lock
396 #| ${FORMAIL} -D 65536 msgid.cache
397 #
398 #:0 Whc: vacation.lock
399 #* !^From: .*phd
400 #* !^FROM_MAILER
401 #* !^FROM_DAEMON
402 #* !^X-Loop: phd@phdru.name
403 #* !^X-Loop: phd@iskra.aviel.ru
404 #* !^From: "AviTicket" <support@aviel\.ru>
405 #* !^From: .* <lj_notify@livejournal\.com>
406 #* !^From: .*report_card@sbrf.ru
407 #| ${FORMAIL} -rD 65536 vacation.cache
408 #
409 #:0 ehc  # if the name was not in the cache - reply
410 #| (egrep -v '^From phd|^Return-Path: phd' | \
411 #   ${FORMAIL} -r -A"Precedence: junk" \
412 #      -A"X-Loop: phd@phdru.name" -A"X-Loop: phd@iskra.aviel.ru" \
413 #      -A"Content-Type: text/plain; charset=koi8-r"; \
414 #   echo "Hello!"; echo "";\
415 #   echo "   I am on vacation. This is an auto-generated reply. Your message has been"; \
416 #   echo "delivered to my mailbox. Thanks a lot. I will read it after 0th of ."; \
417 #   echo ""; \
418 #   echo "Здравствуйте."; echo ""; \
419 #   echo "   Я уехал в отпуск. Это автоматический ответ. Ваше сообщение было доставлено."; \
420 #   echo "в мой почтовый ящик. Большое спасибо. Я прочту его, когда вернусь 0 ."; \
421 #   echo ""; cat $HOME/.signature) | $SENDMAIL -oi -t