Update zoneinfo database.
[dragonfly/netmp.git] / contrib / sendmail / libmilter / docs / design.html
blob91804861e0a0bb3bd9f2f0b7c7260ae8fa5c6041
1 <html>
2 <head>
3 <title>Architecture</title>
4 </head>
5 <body>
7 <h1>Architecture</h1>
9 <h2>Contents</h2>
11 <ul>
12 <li>Design Goals
13 <li>Implementing Filtering Policies
14 <li>MTA - Filter Communication
15 </ul>
17 <h2>Goals</h2>
19 The Sendmail Content Management API (Milter) provides an interface for
20 third-party software to validate and modify messages as they pass
21 through the mail transport system. Filters can process messages'
22 connection (IP) information, envelope protocol elements, message
23 headers, and/or message body contents, and modify a message's
24 recipients, headers, and body. The MTA configuration file specifies
25 which filters are to be applied, and in what order, allowing an
26 administrator to combine multiple independently-developed filters.
28 <p>
29 We expect to see both vendor-supplied, configurable mail filtering
30 applications and a multiplicity of script-like filters designed by and
31 for MTA administrators. A certain degree of coding sophistication and
32 domain knowledge on the part of the filter provider is assumed. This
33 allows filters to exercise fine-grained control at the SMTP level.
34 However, as will be seen in the example, many filtering applications
35 can be written with relatively little protocol knowledge.
37 <p>
38 Given these expectations, the API is designed to achieve the following
39 goals:
41 <OL>
42 <LI>Safety/security.
43 Filter processes should not need to run as root
44 (of course, they can if required, but that is a local issue);
45 this will simplify coding
46 and limit the impact of security flaws in the filter program.
47 <p>
48 <LI>Reliability.
49 Coding failures in a Milter process that cause that process
50 to hang or core-dump
51 should not stop mail delivery.
52 Faced with such a failure,
53 sendmail should use a default mechanism,
54 either behaving as if the filter were not present
55 or as if a required resource were unavailable.
56 The latter failure mode will generally have sendmail return
57 a 4xx SMTP code (although in later phases of the SMTP protocol
58 it may cause the mail to be queued for later processing).
59 <p>
60 <LI>Simplicity.
61 The API should make implementation of a new filter
62 no more difficult than absolutely necessary.
63 Subgoals include:
64 <UL>
65 <LI>Encourage good thread practice
66 by defining thread-clean interfaces including local data hooks.
67 <LI>Provide all interfaces required
68 while avoiding unnecessary pedanticism.
69 </UL>
70 <p>
71 <LI>Performance.
72 Simple filters should not seriously impact overall MTA performance.
73 </OL>
75 <h2>Implementing Filtering Policies</h2>
77 Milter is designed to allow a server administrator to combine
78 third-party filters to implement a desired mail filtering policy. For
79 example, if a site wished to scan incoming mail for viruses on several
80 platforms, eliminate unsolicited commercial email, and append a mandated
81 footer to selected incoming messages, the administrator could configure
82 the MTA to filter messages first through a server based anti-virus
83 engine, then via a large-scale spam-catching service, and finally
84 append the desired footer if the message still met requisite criteria.
85 Any of these filters could be added or changed independently.
87 <p>
88 Thus the site administrator, not the filter writer, controls the
89 overall mail filtering environment. In particular, he/she must decide
90 which filters are run, in what order they are run, and how they
91 communicate with the MTA. These parameters, as well as the
92 actions to be taken if a filter becomes unavailable, are selectable
93 during MTA configuration. <a href="installation.html">Further
94 details</a> are available later in this document.
96 <h2>MTA - Filter communication</h2>
98 Filters run as separate processes, outside of the sendmail address
99 space. The benefits of this are threefold:
101 <OL>
102 <LI>The filter need not run with "root" permissions, thereby
103 avoiding a large family of potential security problems.</LI>
105 <LI>Failures in a particular filter will not affect the MTA or
106 other filters.</LI>
108 <LI>The filter can potentially have higher performance because of
109 the parallelism inherent in multiple processes.</LI>
110 </OL>
113 Each filter may communicate with multiple MTAs at the same time over
114 local or remote connections, using multiple threads of execution. <a
115 href="#figure-1">Figure 1</a> illustrates a possible network of
116 communication channels between a site's filters, its MTAs, and other
117 MTAs on the network:
118 </p>
119 <div align="center">
120 <a name="figure-1"><img src="figure1.jpg" ALT=""></A><br>
121 <b>Figure 1: A set of MTA's interacting with a set of filters.</b>
122 </div>
124 The Milter library (libmilter) implements the communication protocol.
125 It accepts connections from various MTAs, passes the relevant data to
126 the filter through callbacks, then makes appropriate responses based
127 on return codes. A filter may also send data to the MTA as a result
128 of library calls. <a href="#figure-2">Figure 2</a> shows a single
129 filter process processing messages from two MTAs:
130 </p>
131 <div align="center">
132 <img src="figure2.jpg" ALT=""><br>
133 <b>Figure 2: A filter handling simultaneous requests from two MTA's.</b>
134 </div>
135 <hr size="1">
136 <font size="-1">
137 Copyright (c) 2000, 2003 Sendmail, Inc. and its suppliers.
138 All rights reserved.
139 <br>
140 By using this file, you agree to the terms and conditions set
141 forth in the LICENSE.
142 </font>
143 </body>
144 </html>