]> git.deb.at Git - pkg/t-prot.git/blob - t-prot.1
Merge branch 'upstream'
[pkg/t-prot.git] / t-prot.1
1 .\" $Id: t-prot.1,v 1.99 2005/04/15 14:03:39 jochen Exp $
2 .\"
3 .TH T-PROT "1" "Apr 2005" "T-PROT"
4 .SH NAME
5 t-prot \- TOFU Protection - Display Filter for RFC 822 messages
6 .SH SYNOPSIS
7 .BI "t-prot [" OPTIONS "]..."
8 .SH DESCRIPTION
9 .PP
10 This program is a filter which shall improve the readability
11 for messages (emails and posts) by *hiding* some annoying parts,
12 e.g. mailing list footers, signatures, and TOFU (see definition below),
13 as well as squeezing sequences of blank lines or punctuation.
14 .br
15 The filter is written in Perl and relies on input to be a single
16 message conforming to RFC 822 or it's successor, RFC 2822. Messages
17 conforming to RFCs 2045, 2046 and 2049 should be treated reasonably
18 correct.
19 .PP
20 Already reformatted messages are handled well: the script was
21 initially designed to cope with the output of the MUA mutt (which
22 is the reason for not using standard CPAN modules for handling
23 messages).
24 .PP
25 For easy usage, you can download a file to be included in your ~/.muttrc:
26 .I http://www.escape.de/users/tolot/mutt/t-prot/muttrc.t-prot
27 .br
28 And here is an example S-Lang macro to use t-prot from within slrn:
29 .I http://www.escape.de/users/tolot/mutt/t-prot/t-prot.sl
30 .SH OPTIONS
31 .TP
32 .BR "\-A" =DIRECTORY
33 "ad footer directory":
34 Defines the directory which contains the advertisement list footers (one
35 footer per file) which are to be tested when removing them with options
36 .B -a
37 or
38 .BR --ftr-ad .
39 .br
40 This option is also needed if you do not want signature lengths to be
41 counted wrong or fullquotes get undetected when an ad footer is
42 appended at the bottom of the message (especially when using 
43 .B "\-S"
44 or
45 .BR "\-t" ).
46 .TP
47 .B "\-a"
48 "commercial signature":
49 Hides "footers" (signatures) from commercial email providers.
50 .br
51 This option compares the last lines of the message body with any
52 footer file found in the directory specified with
53 .BR "\-A" =DIRECTORY
54 (which is mandatory for this option). The comparison is done by perl's
55 .B index()
56 function (please try
57 .I perldoc -f index
58 for details).
59 .sp
60 .IR NOTE :
61 This option is not needed if
62 .B --ftr-ad
63 is specified.
64 .TP
65 .BR "\-\-bigq" [=n[,x]]
66 "shrink big quotes":
67 Blocks of quotes with more than n lines will be shrinked to x lines.
68 Defaults are 30 for n and 10 for x.
69 .TP
70 .B "\-\-body"
71 Input consists just of the message's body. There are no RFC 822 header
72 lines.
73 .br
74 .IR NOTE :
75 This does not work with --pgp-short, and multipart messages will not
76 be detected due to missing headers.
77 .TP
78 .B "\-c"
79 "compress":
80 Squeezes a sequence of blank lines to two blank lines at maximum.
81 .TP
82 .BR "\-\-check" [=FLAGS]
83 Run checks. If successful, print an error message and quit with
84 an appropriate exit code. Useful e.g. for rejecting messages from
85 within INN2.
86 .IP
87 Flags are separated by commas (no whitespaces), and can be the
88 following (right now just one flag):
89 .IP
90 .IR ratio [=n]
91 .br
92 If the quoting ratio is n or more, the message is rejected. Must be
93 between 0 and 1, or else it is entirely disabled.
94 .TP
95 .B "\-d, \-\-debug"
96 "debug":
97 Print envelope info to syslog when bouncing TOFU contaminated email.
98 Default syslog facility is mail.debug. Requires
99 .BR \-p .
100 .TP
101 .B "\-\-diff"
102 "tolerate diff":
103 Tolerate unified diff (see 
104 .BR diff (1)
105 and
106 .BR patch (1))
107 appended *after* the signature (which usually makes the signature too long
108 to be valid). Not entirely consequent but sometimes useful, e.g. at the
109 Linux kernel mailing list.
110 .TP
111 .B "\-e"
112 "ellipsis":
113 Squeezes a sequence of four or more dots, exclamation marks, or question marks
114 to only three dots or marks, respectively.
115 .TP
116 .B "\-\-ftr\-ad"
117 "enable aggressive ad footer matching":
118 With this option enabled t-prot makes footer detection really greedy: We
119 assume that commercial email providers aren't even frightened to append
120 changing texts *under* their ads which are appended to the message body.
121 Because these texts even have changing *lengths* we simply detect the
122 lines of the footer *anywhere* in the body of the message and assume that
123 everything below belongs to the footer. (Man, if life where always that
124 easy! ;)
125 .br
126 With this option even GMX ads should be easy to hide -- you buy this with
127 a slight performance hit (which is the reason this option is disabled by
128 default), and with the possibility that sometimes the algorithm is just a
129 little *too* greedy.
130 .sp
131 .IR NOTE :
132 This requires a directory with footer files to be given with option
133 .BR "\-A" =DIRECTORY.
134 .TP
135 .B "\-\-ftr\-ml"
136 "enable aggressive mailing list footer matching":
137 With this option enabled t-prot makes footer detection really greedy: Should
138 be helpful with broken list servers, or even if your email provider munges
139 the bodies of your messages.
140 .br
141 Works similar to --ftr-ad, just that it is intended for mailing list footers.
142 .sp
143 .IR NOTE :
144 This requires a directory with footer files to be given with option
145 .BR "\-L" =DIRECTORY.
146 .TP
147 .B "\-h, \-\-help"
148 "help":
149 Displays a short help text with a summary on all options, and exits.
150 .TP
151 .BR "\-i" =FILE
152 "input file":
153 Defines a file for input; the default input is from '-' i.e. STDIN.
154 .TP
155 .B "\-k"
156 "anti Kammquote":
157 Tries to fix those broken zig-zag-shaped lines wrapped around by some MUAs
158 which are known as "Kammquoting" in German.
159 .sp
160 Note: This option is considered stable by now. However, sometimes Kammquotes
161 should have been removed but weren't. Please send a bug report if this happens
162 to you (after carefully reading the BUGS file, that is).
163 .TP
164 .BR "\-\-kminl" =n
165 Minimum line length for wrapped line detection on Kammquotes. Umm, don't
166 know how to explain this well without describing the complete algorithm
167 used. Please see the code.
168 .br
169 Anyway, lower values make the algorithm more aggressive, higher values
170 make Kammquotes harder to detect. Default is 65.
171 .sp
172 Requires
173 .BR "\-k" .
174 .TP
175 .BR "\-\-kmaxl" =n
176 Maximum line length for wrapped line detection on Kammquotes. Umm, don't
177 know how to explain this well without describing the complete algorithm
178 used. Please see the code.
179 .br
180 Anyway, higher values make the algorithm more aggressive, lower values
181 make Kammquotes harder to detect. Default is 80.
182 .sp
183 Requires
184 .BR "\-k" .
185 .TP
186 .BR "\-\-kdiff" =n
187 Minimum length difference between two lines for wrapped line detection on
188 Kammquotes. Umm, don't know how to explain this well without describing
189 the complete algorithm used. Please see the code.
190 .br
191 Anyway, lower values make the algorithm more aggressive, higher values
192 make Kammquotes harder to detect. Default is 20.
193 .sp
194 Requires
195 .BR "\-k" .
196 .TP
197 .BR "\-L" =DIRECTORY
198 "list footer directory":
199 Defines the directory which contains the mailing list footers (one footer
200 per file) which are to be tested when removing them with the options
201 .B \-l
202 or
203 .BR \-\-ftr\-ml .
204 .br
205 This option is also needed if you do not want signature lengths to be
206 counted wrong or fullquotes get undetected when a mailing list footer is
207 appended at the bottom of the message (especially when using 
208 .B "\-S"
209 or
210 .BR "\-t" ).
211 .TP
212 .B "\-l"
213 "list signature":
214 Hides "footers" (signatures) from mailing lists. Footer detection works like the 
215 .B "\-a"
216 option.
217 .sp
218 .IR NOTE :
219 This requires a directory with footer files to be given with option
220 .BR "\-L" =DIRECTORY.
221 .B \-l
222 is not needed if
223 .B \-\-ftr\-ml
224 is specified.
225 .TP
226 .B "\-\-lax\-security"
227 Allow insecure writing method. DO NOT USE UNLESS YOU REALLY KNOW WHAT
228 YOU ARE DOING. (This ugly workaround is needed for some early mutt versions
229 and should NEVER be used as a default, otherwise it will probably turn into
230 a security issue.)
231 .TP
232 .BR "\-\-locale" =LOCALE
233 "locale to use":
234 Here you can specify which locale to use. Right now this option is only
235 used when
236 .I "\-Mmutt"
237 is specified, but this may change in future. You need the Perl module
238 .I "Locale::gettext"
239 for this feature.
240 .sp
241 .IR Note :
242 If you use
243 .B mutt
244 or
245 .B gnupg
246 with locales, t-prot will only work correctly if you specify the corresponding
247 locale string.
248 .sp
249 .IR "Note also" :
250 You also have to make sure you are running t-prot
251 with matching
252 .B gnupg
253 and 
254 .B mutt
255 versions. T-prot detects
256 .B gnupg
257 and
258 .B mutt
259 locales of the recent stable versions of those programs, earlier versions
260 might not work well with a recent version of t-prot. There are patches available
261 to make t-prot fit into environments with old
262 .B mutt
263 and
264 .B gnupg
265 versions.
266 .TP
267 .B "\-m"
268 "Microsoft TOFU":
269 Hides TOFU as given by some Microsoft mailers. (You all surely know these
270 fullquotes beginning with
271 .br
272 "----- Original Message -----"
273 .br
274 and some header lines...)
275 .TP
276 .B "\-\-ms\-smart"
277 Burn CPU cycles trying to be smart with MS style TOFU.
278 .sp
279 Please note that this is probably just a waste of time because most
280 MS Outlook users who do produce this kind of TOFU won't care about
281 making their messages the least bit readable or even predictable. So
282 this option will probably just be interesting for mutt message hooks
283 (to activate it on demand when you
284 .BR know " the sender tries to write legible messages)."
285 .sp
286 Requires
287 .BR "\-Mmutt" " and"
288 .BR "\-m" .
289 .TP
290 .BR "\-M, \-\-mua" =MUA
291 "mail user agent":
292 Turn on special treatment for some mail user agents. (Right now only 
293 .BR mutt (1)
294 is supported, but more might be added in future.)
295 .IR Caveat :
296 If your MUA is supported by this feature you must ensure t-prot makes
297 use of it when called from within your MUA to work as desired.
298 .TP
299 .BR "\-o" =FILE
300 "output file":
301 Define the file to be written *to*; the default output is to STDOUT.
302 .sp
303 If "NONE" is specified as file name, there will be no output at all (useful
304 if all you need is t-prot's exit code). Use something like "./NONE" if you
305 really want to write to a file of this name.
306 .TP
307 .BR "\-p" [=ADDRESS]
308 "picky delivery":
309 If we really find some TOFU, abort with exit code 
310 .IR EX_UNAVAILABLE .
311 Otherwise redirect the message to ADDRESS if given.
312 .sp
313 Intended for use from within mail delivery agents (MDAs) or mail transport 
314 agents (MTAs), or even from with INN, so the message bounces if TOFU is
315 detected, and does not get on *your* nerves. :) 
316 .sp
317 As an example for usage with
318 .BR sendmail ,
319 put this line into your alias file and invoke
320 .BR newaliases :
321 .sp
322 notofu: |"/usr/local/bin/t-prot -mt -p=user@mydomain"
323 .sp
324 This will bounce messages for <notofu@domainname> if any TOFU is detected
325 inside the message, and deliver it to <user@mydomain> otherwise.
326 .I Note
327 that TOFU is only detected if you specify
328 .B "\-t"
329 respectively
330 .BR "\-m" .
331 .sp
332 .B PLEASE be careful not to bounce messages to mailing lists!
333 .TP
334 .BR "\-P" =MESSAGE
335 "user defined bounce message for picky delivery": 
336 You may specify your own bounce message to be returned when we try to deliver
337 an email and bounce it because there is TOFU inside.
338 .TP
339 .B \-\-pgp\-move
340 Move pgp verification output to bottom; requires
341 .BR "\-Mmutt" .
342 .TP
343 .B \-\-pgp\-move\-vrf
344 Move pgp verification outout to bottom only if verification shows a good signature
345 and the signature could be verified as authentic (using a trust path). If there is
346 any problem with the signature, the pgp output should not be moved so the user is
347 more likely to notice. Requires
348 .BR "\-Mmutt" .
349 .sp
350 .IR Note :
351 If gpg is terminated before finished (e.g. hitting Ctrl-C, or using
352 .IR kill (1)),
353 we cannot always detect if the check was interrupted. Though t-prot tries
354 to be smart, there will be false positives.
355 .TP
356 .B \-\-pgp\-short
357 Hide non-relevant pgp key uids; requires
358 .BR "\-Mmutt" .
359 .TP
360 .B "\-r"
361 "rip header off":
362 Hides all mail header lines.
363 .TP
364 .BR "\-S" [=n]
365 "supression of overlong signatures":
366 Signatures are to be n lines (not including the one containing dash-dash-space)
367 or less. If there are more, it is probably not that spirited after all. So
368 with this option you trade it for a
369 .B truely
370 nice line.
371 .br
372 If no n is given, default is 4. (\fINote\fR: We do not recommend using a 
373 value other than 4. Consider this old-fashioned, but we actually do *like*
374 RFC conformance.)
375 .sp
376 .IR Note :
377 The line containing "-- " ist not counted when testing for an overlong 
378 signature, but it is included when displaying how many lines were deleted.
379 .TP
380 .B "\-s"
381 "signature deletion":
382 Hides signatures, i.e. all lines after a "signature dashes" line,
383 i.e. a line with three characters: dash-dash-space (no more, no less).
384 .TP
385 .BR "\-\-sigsmax" [=n]
386 "maximum number of tolerated signatures":
387 Here you can define how many signatures you accept to be treated as such.
388 (Most significant behaviour is when microsoft style quotes are removed.
389 Experts please see the code for the more subtle implications of this
390 option.)
391 .br
392 Leave empty or specify zero to have an unlimited number of sigs. 
393 Default is 1.
394 .TP
395 .B "\-\-spass"
396 "SpamAssassin workaround":
397 SpamAssassin (available at
398 .IR http://spamassassin.org/ ") often is configured that it adds some"
399 lines to the message body containing information about the spam criteria
400 which were found matching for the message. This option enables an extra
401 test to avoid false positives for Microsoft style TOFU on such messages.
402 .TP
403 .B "\-t"
404 "TOFU deletion":
405 Hides "traditional style" TOFU, where each line begins with an
406 indent string like "> ".
407 .br
408 (You may edit the indent pattern in the script itself to suit your needs,
409 but it is surely
410 .I not
411 recommended at all.)
412 .TP
413 .B "\-w"
414 "whitespace deletion":
415 Hides trailing whitespace (sequences of space and tab).
416 CAVEAT: This may lead to interesting effects with crossposts
417 between mailing lists or with undetected signature attempts.
418 .TP
419 .B "\-v, \-\-version"
420 "version info":
421 Prints the current version number and release date, and exit.
422 .SH TOFU?
423 TOFU is an abbreviation which mixes German and English words;
424 it expands to "text oben, full-quote unten" which means
425 "text above - full quote below" and describes the style of so
426 many users who let their mailer or newsreader quote everything
427 of the previous message and just add some text at the top;
428 obviously they think that quoted text must not be changed at all.
429 This is quite annoying as it needlessly sends a lot of data
430 even when it is not required. Some editing of messages is desired.
431 Please point these people to the page 
432 .I http://www.river.com/users/share/etiquette/edit.html
433 - thank you!
434 .SH TROUBLESHOOTING
435 .TP
436 .IR Q :
437 I want to make my mailing list footer files match more different mailing
438 list footers. Can I use regular expressions, or how can I accomplish that?
439 .TP
440 .IR A :
441 Nope, regexp's do not work here. The comparison is made by the perl builtin
442 .IR index ()
443 function (see 
444 .B perldoc
445 for more detailed info), so you must exactly match the beginning of the
446 line. The longer the line you specify, the more precise the match; if
447 your line is empty you match unconditionally.
448 .PP
449 .TP
450 .IR Q :
451 I use the options -l and -L to supress mailing list footers when 
452 displaying messages in
453 .BR mutt (1).
454 This does work sometimes, but sometimes it does not: the footer is not
455 detected, and therefore full quotes are not deleted and signatures are
456 detected as too long (which they aren't).
457 .TP
458 .IR A :
459 This might occur if the message is badly encoded, so mutt cannot resolve
460 all encoded characters, e.g. if you have an encoded message on a mailing
461 list, and majordomo appends a mailing list footer in a different encoding
462 (or even plain us-ascii). "-- " simply does not match "--=20". 
463 .br
464 Another problem are non-us-ascii characters. Just avoid them, and 
465 everything should work fine.
466 .br
467 See the preceding Q+A for a solution.
468 .PP
469 .TP
470 .IR Q :
471 I want to write a message which contains parts that should *not* be 
472 deleted even when filtered with t-prot. Is this possible?
473 .TP
474 .IR A :
475 Yes, but please do not spread word of it. Make unobstrusive use of the
476 .I
477 verbatim
478 instruction:
479 .sp
480 #v+
481 .br
482 This line is protected from being filtered by t-prot !!!!!!!
483 .br
484 #v-
485 .br
486 Text coming now is not.
487 .SH AUTHOR AND COPYRIGHT
488 Written by Jochen Striepe <t-prot@tolot.escape.de>.
489 .br
490 Copyright \(co 2001-2005 Jochen Striepe.
491 .PP
492 This is free software; you may use the source to whatever you like.
493 Just keep in mind to mention the original source of the script and the manpage
494 when you give it away. There is NO warranty; not even for MERCHANTABILITY or 
495 FITNESS FOR A PARTICULAR PURPOSE.
496 .SH IDEAS AND INSPIRATION
497 Many good ideas, bug reports and support from (in alphabetical order) Bjoern
498 Buerger, Bjoern Laessig, Christian Borss, Gerfried Fuchs, Martin Neitzel, Martin
499 Dietze, Ralf Doeblitz, Sven Guckes and many more (see the ChangeLog for active
500 contributors). Many thanks to all of them!
501 .sp
502 Many thanks to Gerhard H. Wrodnigg who uses a TOFU protection script
503 in order to keep the responses to his cancel bot reasonably short.  The
504 entire inspiration for this hack came from the "TOFU protection" line of
505 his script on many usenet postings.
506 .SH AVAILIBILITY
507 You can get the latest version from
508 .IR http://www.escape.de/users/tolot/mutt/ .
509 .SH BUGS
510 Please note that t-prot development happens on
511 .BR "current stable perl versions only" . 
512 If you do run t-prot on earlier (or unstable) perl versions, you might
513 encounter perl compiler bugs (or funny t-prot behaviour). One solution
514 is to upgrade your perl, another is simply to write a bug report. If
515 you do not run a current perl version, please include this information
516 in your bug report. Thank you.
517 .PP
518 There is a problem when mutt gives a PGP verified or even a multipart
519 message to t-prot: The information where the PGP encrypted/signed data
520 or even attachments begin and end is plainly embedded in the text, not
521 really cleanly recognizeable for t-prot. The problem should be worked
522 around by now, please send a bug report if it does not work for you.
523 .PP
524 There probably are many more bugs in this piece of software. Feel free to
525 fix them - it's
526 .BR perl ,
527 so you have the sources. Ah, and while you're at it, please drop a note to
528 the author - thanks in advance! 
529 .SH "REPORTING BUGS"
530 Please send your bug report to <t-prot-bugs@tolot.escape.de>.
531 .SH TODO
532 Fix bugs (see the 
533 .I BUGS
534 section). Beside that, all main features should be implemented by now.
535 .SH "SEE ALSO"
536 .BR mutt (1),
537 .BR muttrc (5)
538 and the part about "display_filter", 
539 .BR perl (1),
540 .BR aliases (5),
541 RFCs 822, 2045, 2046, 2049, and 2822,
542 .I http://got.to/quote/
543 (German language), 
544 .I http://www.river.com/users/share/etiquette/edit.html
545 (the Learn To Edit Messages HowTo has found a new home).
546