man mimedefang (Administration système) - Sendmail MIME mail filter

NAME

mimedefang - Sendmail MIME mail filter

SYNOPSIS

mimedefang -p connection -m mx_socket_name -U user [options]

DESCRIPTION

mimedefang is a filter built around Sendmail 8.11's milter API for mail filters. It collects each incoming message and runs a filter on the message. This is useful for deleting attachments which may be a security risk on poorly-designed systems like Microsoft Windows.

mimedefang does not actually run the Perl filter; instead, it communicates with mimedefang-multiplexor(8), which manages a pool of persistent Perl processes. See the mimedefang-multiplexor man page for additional information.

OPTIONS

-U user
Runs mimedefang as user rather than root. The user argument must match the argument to mimedefang-multiplexor's -U option as well.
-p connection
The -p switch is required and specifies the milter connection type. Typically, you should run mimedefang on the same computer as sendmail. Therefore, you should use a UNIX-domain socket for the connection type. The suggested value for the -p switch is /var/spool/MIMEDefang/mimedefang.sock.
-m mx_socket_name
Specifies the socket for communicating with mimedefang-multiplexor(8). The mx_socket_name specifies the path of the UNIX-domain socket. See mimedefang-multiplexor(8) for details.
-b backlog
Sets the "backlog" argument to the listen(2) system call to backlog. If this option is omitted, then the operating-system default backlog is used.
-d
The -d switch causes mimedefang not to delete the temporary spool files it creates for incoming messages. This is for debugging purposes only and should never be used on a production mail server.
-r
Causes mimedefang to perform a relay check before processing the message body. It calls into a user-supplied Perl function called filter_relay with the IP address and host name of the sending relay. (See mimedefang-filter(5) for details.) This flag only takes effect if the -m flag is used also.
-s
Causes mimedefang to perform a sender check before processing the message body. It calls into a user-supplied Perl function called filter_sender with the envelope address of the sender. (See mimedefang-filter(5) for details.) This flag only takes effect if the -m flag is used also.
-t
Causes mimedefang to perform recipient checks before processing the message body. It calls into a user-supplied Perl function called filter_recipient with the envelope address of each recipient. (See mimedefang-filter(5) for details.) This flag only takes effect if the -m flag is used also.
-q
Permits the multiplexor to queue new connections. See the section QUEUEING REQUESTS in the mimedefang-multiplexor man page.
-k
Causes mimedefang not to delete working directories if a filter fails. This lets you obtain the message which caused the filter to fail and determine what went wrong. mimedefang logs the directory containing the failed message using syslog.
-P fileName
Causes mimedefang to write its process-ID (after becoming a daemon) to the specified file.
-C
Conserve file descriptors by opening and closing disk files more often. (Disk files are never held open across Milter callbacks.) While this shortens the length of time a file descriptor is open, it also leaves more opportunities for the open to fail. We do not recommend the use of this flag except on very busy systems that exhibit failures due to a shortage of file descriptors.
-T
Causes mimedefang to log the run-time of the Perl filter using syslog.
-x string
Add string as the content of the X-Scanned-By: header. If you set string to the empty string (i.e. -x ""), then no X-Scanned-By: header will be added.
-X
Do not add an X-Scanned-By: header. Specifying -X is equivalent to specifying -x "".
-D
Do not fork into the background and become a daemon. Instead, stay in the foreground. Useful mainly for debugging or if you have a supervisory process managing mimedefang.
-M
When mimedefang processes a message, it creates a temporary working directory. On some architectures, you might have to protect this action with a "mutex" to stop different threads from interfering with each other. This should not normally be necessary, but if you see many logs that mimedefang is unable to create the working directory, use the -M flag.
-S facility
Specifies the syslog facility for log messages. The default is mail. See openlog(3) for a list of valid facilities. You can use either the short name ("mail") or long name ("LOG_MAIL") for the facility name.
-a macro
Pass the value of the specified Sendmail macro through to the Perl filter. You can repeat the -a option to write more macros than the built-in defaults. Note that in addition to asking mimedefang to pass the macro value to the filter, you must configure Sendmail to pass the macro through to mimedefang using the confMILTER_MACROS_ENVFROM definition in Sendmail's m4 configuration file.
-h
Print usage information and exit.

OPERATION

When mimedefang starts, it connects to sendmail using the milter API. (See the Sendmail 8.11 documentation.) For each incoming message, mimedefang creates a temporary directory and saves information in the directory. When the end of message is received, mimedefang executes the following command:

/usr/bin/perl /usr/local/bin/mimedefang.pl dir

(Substitute the appropriate paths on your system for perl and mimedefang.pl.) The single argument dir is the temporary directory in which the message information has been saved.

(If you are using mimedefang-multiplexor, the multiplexor manages a pool of persistent Perl processes, and mimedefang itself does not start a Perl interpreter.)

When the Perl script is started, the temporary directory contains certain files; details of the communication protocol between mimedefang and the Perl script are in mimedefang-protocol(7).

WARNINGS

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

Spawning a Perl process for each incoming piece of SMTP mail is expensive. mimedefang may overload a busy mail server unless you use the multiplexor.

AUTHOR

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

SEE ALSO