"Fossies" - the Fresh Open Source Software Archive 
As a special service "Fossies" has tried to format the requested text file into HTML format (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
1 Implementing procmail on a sendmail 8.8.8 and later gateway:
2 (Note: This is still undergoing testing and refinement)
3 $Id: procmail-on-gateway.txt,v 1.11 2006-01-20 07:40:49-08 jhardin Exp jhardin $
4 <jhardin@impsec.org>
5 With help from Joshua Marshall <marshallj@switch.aust.com>
6 Master copy at http://www.impsec.org/email-tools/procmail-on-gateway.txt
7
8
9 1. Add the following delivery agent:
10
11 Mprocmail, P=/usr/bin/procmail, F=DFMmShun, S=11/31, R=21/31, T=DNS/RFC822/X-Unix,
12 A=procmail -m $h $g $u
13
14 [TAB]---^
15
16
17
18 2. Add "procmail" to class P with this somewhere near the top
19 of your sendmail.cf (near where the other classes are being set up):
20
21 CPprocmail
22
23
24
25 3. Add the following to ruleset 0, between the "handle virtual
26 users" and "short-circuit local delivery" stanzas:
27
28 # pipe through procmail for processing
29 R$*<@example.com>$* $#procmail $@/etc/procmail/filter.rc $:$1<@example.com.procmail.>$2
30 R$*<@example.com.>$* $#procmail $@/etc/procmail/filter.rc $:$1<@example.com.procmail.>$2
31 R$*<@$*.procmail.>$* $1<@$2.>$3
32
33 [TAB]-------------^
34
35 Vary the domain name and script name (/etc/procmail/filter.rc) for your needs.
36
37 If you are relaying mail for multiple domains, use the following instead:
38
39 R$*<@$=w>$* $#procmail $@/etc/procmail/filter.rc $:$1<@$2.procmail.>$3
40 R$*<@$=w.>$* $#procmail $@/etc/procmail/filter.rc $:$1<@$2.procmail.>$3
41 R$*<@$*.procmail.>$* $1<@$2.>$3
42
43 [TAB]-------------^
44
45
46
47 If you prefer to use sendmail .mc files, add this to your config.mc file:
48
49 LOCAL_CONFIG
50 CPprocmail
51
52 LOCAL_RULE_0
53 R$*<@$=w>$* $#procmail $@/etc/procmail/filter.rc $:$1<@$2.procmail.>$3
54 R$*<@$=w.>$* $#procmail $@/etc/procmail/filter.rc $:$1<@$2.procmail.>$3
55 R$*<@$*.procmail.>$* $1<@$2.>$3
56
57 MAILER_DEFINITIONS
58 Mprocmail, P=/usr/bin/procmail, F=DFMmShun, S=11/31, R=21/31, T=DNS/RFC822/X-Unix,
59 A=procmail -m $h $g $u
60
61
62
63 4. Here is a sample filter.rc file - add your local configuration
64 settings before using it:
65
66 ################################################################
67 #
68 # procmail rules to filter mail on a gateway
69 #
70
71 LOGFILE=/var/log/procmail.log
72 NL="
73 "
74 LOGABSTRACT=no
75
76 # Configuration settings go here...
77 # See the discussion of what to put in /etc/procmailrc at
78 # http://www.impsec.org/email-tools/sanitizer-configuration.html
79 # /etc/procmailrc is the "master procmail script" for local
80 # delivery, this file is the "master procmail script" for relay.
81 # The settings in one DO NOT affect the other.
82
83 POISONED_EXECUTABLES=/etc/procmail/poisoned
84
85 # etc... - you NEED to put configuration settings here.
86
87 # DO NOT enable RECIPIENT notification on a relay unless:
88 # 1) your mail relay inserts "for <recip@your.dom.ain>" into
89 # the Received: header it adds to the message, and
90 # 2) you are using version 1.150 or later of the Sanitizer
91 # otherwise the recipient email address cannot be determined.
92
93 # run the sanitizer
94 INCLUDERC=/etc/procmail/local-rules.procmail
95 INCLUDERC=/etc/procmail/html-trap.procmail
96
97 # send the mail on to the next relay
98 :0
99 ! -oi -f "$@"
100
101 #
102 ################################################################
103
104
105
106 5. If the next hop is a Microsoft Exchange Server, make sure that you
107 configure it so that it will accept mail addressed to its
108 fully-qualified domain name in addition to the simple domain name.
109 For example, if your domain is "example.com" and your Exchange Server is
110 running on the computer named "exchange", configure it to accept mail
111 addressed to "@exchange.example.com" as well as just "@example.com"
112
113