1MIMEDEFANG(8)               System Manager's Manual              MIMEDEFANG(8)
2
3
4

NAME

6       mimedefang - Sendmail MIME mail filter
7

SYNOPSIS

9       mimedefang prcap
10
11       mimedefang -p connection -m mx_socket_name -U user [options]
12
13

DESCRIPTION

15       mimedefang is a filter built around Sendmail 8.11's milter API for mail
16       filters.  It collects each incoming message and runs a  filter  on  the
17       message.   This is useful for deleting attachments which may be a secu‐
18       rity risk on poorly-designed systems like Microsoft Windows.
19
20       mimedefang does not actually run the Perl filter; instead, it  communi‐
21       cates  with  mimedefang-multiplexor(8), which manages a pool of persis‐
22       tent Perl processes.  See the mimedefang-multiplexor man page for addi‐
23       tional information.
24
25

OPTIONS

27       If  you  invoke  mimedefang  with  the single argument prcap, it prints
28       information about the version of Milter it is linked against and exits.
29       Otherwise,  you should invoke mimedefang as shown in the second line of
30       the SYNOPSIS.
31
32
33       -U user
34              Runs mimedefang as user rather than  root.   The  user  argument
35              must match the argument to mimedefang-multiplexor's -U option as
36              well.
37
38
39       -z spooldir
40              Set the spool directory to spooldir.  If this option is omitted,
41              the spool directory defaults to /var/spool/MIMEDefang.
42
43
44       -p connection
45              The  -p  switch  is required and specifies the milter connection
46              type.  Typically, you should run mimedefang on the same computer
47              as sendmail.  Therefore, you should use a UNIX-domain socket for
48              the connection type.  The suggested value for the -p  switch  is
49              mimedefang.sock under the spool directory.
50
51
52       -m mx_socket_name
53              Specifies  the  socket  for communicating with mimedefang-multi‐
54              plexor(8).  The mx_socket_name specifies the path of  the  UNIX-
55              domain socket.  See mimedefang-multiplexor(8) for details.
56
57
58       -b backlog
59              Sets  the  "backlog"  argument  to  the listen(2) system call to
60              backlog.  If this option is omitted, then  the  operating-system
61              default backlog is used.
62
63
64       -d     The  -d  switch  causes  mimedefang  not to delete the temporary
65              spool files it creates  for  incoming  messages.   This  is  for
66              debugging purposes only and should never be used on a production
67              mail server.
68
69
70       -r     Causes mimedefang to perform a relay check before processing any
71              messages.   It  calls  into a user-supplied Perl function called
72              filter_relay with the IP address and host name  of  the  sending
73              relay.  (See mimedefang-filter(5) for details.)
74
75
76       -H     Causes  mimedefang to perform a HELO check before processing any
77              messages.  It calls into a user-supplied  Perl  function  called
78              filter_helo  with  the  IP  address and host name of the sending
79              relay, and the HELO  argument.   (See  mimedefang-filter(5)  for
80              details.)
81
82
83
84       -s     Causes  mimedefang  to  perform a sender check before processing
85              the message body.  It calls into a user-supplied  Perl  function
86              called  filter_sender  with  the envelope address of the sender.
87              (See mimedefang-filter(5) for details.)
88
89
90       -t     Causes mimedefang to perform recipient checks before  processing
91              the  message  body.  It calls into a user-supplied Perl function
92              called filter_recipient with the envelope address of each recip‐
93              ient.  (See mimedefang-filter(5) for details.)
94
95
96       -q     Permits  the multiplexor to queue new connections.  See the sec‐
97              tion QUEUEING REQUESTS in the mimedefang-multiplexor  man  page.
98              Note  that this option and the -R option are mutually-exclusive.
99              If you supply -q, then -R is ignored.
100
101
102       -k     Causes mimedefang not to delete working directories if a  filter
103              fails.  This lets you obtain the message which caused the filter
104              to fail and determine what  went  wrong.   mimedefang  logs  the
105              directory containing the failed message using syslog.
106
107
108       -P fileName
109              Causes mimedefang to write its process-ID (after becoming a dae‐
110              mon) to the specified file.
111
112
113       -R num Normally, mimedefang tempfails a new SMTP  connection  if  there
114              are  no  free slaves.  Supplying the -R num option makes mimede‐
115              fang tempfail new connections if there are fewer than  num  free
116              slaves,  unless  the  connection  is  from the local host.  This
117              allows you to favour connections from localhost so your  client‐
118              mqueue  doesn't  build  up.   Note that supplying -R 0 is subtly
119              different from omitting the option;  in  this  case,  mimedefang
120              permits new connections from localhost to queue, but not connec‐
121              tions from other hosts (unless you also supply the -q option.)
122
123              The purpose of the -R option is to reserve resources for client‐
124              mqueue  runs.   Otherwise,  on  a very busy mail server, client‐
125              mqueue runs can starve for a long time, leading  to  delays  for
126              locally-generated  or streamed mail.  We recommend using a small
127              number for num; probably no more than 3 or 10% of the total num‐
128              ber of slaves (whichever is smaller.)
129
130              Note  that this option and the -q option are mutually-exclusive.
131              If you supply -q, then -R is ignored.
132
133
134       -C     Conserve file descriptors by opening and closing disk files more
135              often.   (Disk  files  are  never  held open across Milter call‐
136              backs.)  While this shortens the length of time a file  descrip‐
137              tor  is  open, it also leaves more opportunities for the open to
138              fail.  We do not recommend the use of this flag except  on  very
139              busy  systems  that  exhibit  failures due to a shortage of file
140              descriptors.
141
142
143       -T     Causes mimedefang to log the run-time of the Perl  filter  using
144              syslog.
145
146
147       -x string
148              Add  string  as the content of the X-Scanned-By: header.  If you
149              set string to the empty string (i.e. -x ""), then no  X-Scanned-
150              By: header will be added.
151
152
153       -X     Do not add an X-Scanned-By: header.  Specifying -X is equivalent
154              to specifying -x "".
155
156
157       -D     Do not fork into the background and become a  daemon.   Instead,
158              stay  in  the foreground.  Useful mainly for debugging or if you
159              have a supervisory process managing mimedefang.
160
161
162       -M     This option is obsolete; it is accepted for backward-compatibil‐
163              ity, but is ignored.
164
165
166       -N     Normally,  mimedefang  sees  all  envelope recipients, even ones
167              that Sendmail knows to be invalid.  If you don't  want  Sendmail
168              to  perform  a  milter  callback  for  recipients it knows to be
169              invalid, invoke mimedefang with the -N flag.  Please  note  that
170              this  flag only works with Sendmail and Milter 8.14.0 and newer.
171              It has no effect if you're running an older version of  Sendmail
172              or Milter.
173
174
175       -S facility
176              Specifies  the syslog facility for log messages.  The default is
177              mail.  See openlog(3) for a list of valid facilities.   You  can
178              use either the short name ("mail") or long name ("LOG_MAIL") for
179              the facility name.
180
181
182       -a macro
183              Pass the value of the specified Sendmail macro  through  to  the
184              Perl  filter.  You can repeat the -a option to write more macros
185              than the built-in defaults.  Note that  in  addition  to  asking
186              mimedefang  to pass the macro value to the filter, you must con‐
187              figure Sendmail to pass the macro through  to  mimedefang  using
188              the  confMILTER_MACROS_ENVFROM  definition in Sendmail's m4 con‐
189              figuration file.
190
191
192       -c     Strip "bare" carriage-returns (CR) characters from  the  message
193              body.   A  bare  CR  should  never  appear in an e-mail message.
194              Older versions of mimedefang used to strip  them  out  automati‐
195              cally,  but  now  they  are  left  in by default.  The -c option
196              enables the older behavior.
197
198       -h     Print usage information and exit.
199
200

OPERATION

202       When mimedefang starts, it connects to sendmail using the  milter  API.
203       (See  the  Sendmail  8.11  documentation.)   For each incoming message,
204       mimedefang creates a temporary directory and saves information  in  the
205       directory.   At various phases during the SMTP conversation, mimedefang
206       communicates with mimedefang-multiplexor to perform various operations.
207       mimedefang-multiplexor manages a pool of persistent Perl processes that
208       actually perform the mail scanning operations.
209
210
211       When a Perl process scans an e-mail, the temporary spool directory con‐
212       tains  certain  files;  details  of  the communication protocol between
213       mimedefang and the Perl script are in mimedefang-protocol(7).
214
215

WARNINGS

217       mimedefang does violence to the flow of e-mail.   The  Perl  filter  is
218       quite  picky  and  assumes  that  MIME e-mail messages are well-formed.
219       While I have tried to make the script safe, I  take  no  responsibility
220       for  lost  or mangled e-mail messages or any security holes this script
221       may introduce.
222
223

AUTHOR

225       mimedefang was written by David F. Skoll <dfs@roaringpenguin.com>.  The
226       mimedefang home page is http://www.mimedefang.org/.
227
228

SEE ALSO

230       mimedefang.pl(8),    mimedefang-filter(5),   mimedefang-multiplexor(8),
231       mimedefang-protocol(7)
232
233
234
235
236
2374th Berkeley Distribution       8 February 2005                  MIMEDEFANG(8)
Impressum