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