xref: /freebsd/contrib/sendmail/libmilter/docs/installation.html (revision e2c0e292e8a7ca00ba99bcfccc9e637f45c3e8b1)
1d0cef73dSGregory Neil Shapiro<HTML>
2d0cef73dSGregory Neil Shapiro<HEAD><TITLE>Installation and Configuration</TITLE>
3d0cef73dSGregory Neil Shapiro</HEAD>
4d0cef73dSGregory Neil Shapiro<BODY>
5e92d3f3fSGregory Neil Shapiro<!--
64313cc83SGregory Neil Shapiro$Id: installation.html,v 1.24 2013-11-22 20:51:39 ca Exp $
7e92d3f3fSGregory Neil Shapiro-->
8d0cef73dSGregory Neil Shapiro<H1>Installation</H1>
9d0cef73dSGregory Neil Shapiro<H2>Contents</H2>
10d0cef73dSGregory Neil Shapiro<UL>
11d0cef73dSGregory Neil Shapiro    <LI><A href="#compile">Compiling and Installing Your Filter</A>
12d0cef73dSGregory Neil Shapiro    <LI><A href="#config">Configuring Sendmail</A>
13d0cef73dSGregory Neil Shapiro</UL>
1440266059SGregory Neil Shapiro
15d0cef73dSGregory Neil Shapiro<H2><A name="compile">Compiling and Installing Your Filter</A></H2>
1640266059SGregory Neil Shapiro
1740266059SGregory Neil ShapiroTo compile a filter, modify the Makefile provided with the sample program, or:
18d0cef73dSGregory Neil Shapiro<UL>
19d0cef73dSGregory Neil Shapiro    <LI>Put the include and Sendmail directories in your include path
2040266059SGregory Neil Shapiro    (e.g. -I/path/to/include -I/path/to/sendmail).
2140266059SGregory Neil Shapiro
22d0cef73dSGregory Neil Shapiro    <LI>Make sure libmilter.a is in your library path, and link your
2340266059SGregory Neil Shapiro    application with it (e.g. "-lmilter").
2440266059SGregory Neil Shapiro
25d0cef73dSGregory Neil Shapiro    <LI>Compile with pthreads, either by using -pthread for gcc, or
2640266059SGregory Neil Shapiro    linking with a pthreads support library (-lpthread).
27d0cef73dSGregory Neil Shapiro</UL>
2840266059SGregory Neil ShapiroYour compile command line will look like
29d0cef73dSGregory Neil Shapiro<PRE>
3040266059SGregory Neil Shapirocc -I/path/to/include -I/path/to/sendmail -c myfile.c
31d0cef73dSGregory Neil Shapiro</PRE>
3240266059SGregory Neil Shapiroand your linking command line will look something like
33d0cef73dSGregory Neil Shapiro<PRE>
3440266059SGregory Neil Shapirocc -o myfilter [object-files] -L[library-location] -lmilter -pthread
35d0cef73dSGregory Neil Shapiro</PRE>
3640266059SGregory Neil Shapiro
37d0cef73dSGregory Neil Shapiro<H2><A name="config">Configuring Sendmail</A></H2>
3840266059SGregory Neil Shapiro
39d0cef73dSGregory Neil ShapiroIf you use a sendmail version older than 8.13 please see
40605302a5SGregory Neil Shapirothe instructions for your version.
41d0cef73dSGregory Neil ShapiroThe default compilation options for sendmail enable support
42d0cef73dSGregory Neil Shapirofor milters since 8.13.
4340266059SGregory Neil Shapiro
4440266059SGregory Neil Shapiro<P>
4540266059SGregory Neil ShapiroNext, you must add the desired filters to your sendmail configuration
46605302a5SGregory Neil Shapiro(.mc) file.
47605302a5SGregory Neil ShapiroMail filters have three equates:
48d0cef73dSGregory Neil ShapiroThe required <CODE>S=</CODE> equate specifies the socket where
49d0cef73dSGregory Neil Shapirosendmail should look for the filter; the optional <CODE>F=</CODE> and
50d0cef73dSGregory Neil Shapiro<CODE>T=</CODE> equates specify flags and timeouts, respectively.
51d0cef73dSGregory Neil ShapiroAll equates names, equate field names, and flag values are case sensitive.
5240266059SGregory Neil Shapiro
5340266059SGregory Neil Shapiro<P>
54d0cef73dSGregory Neil ShapiroThe current flags (<CODE>F=</CODE>) are:
55d0cef73dSGregory Neil Shapiro<P>
56d0cef73dSGregory Neil Shapiro<TABLE cellspacing="1" cellpadding=4 border=1>
57d0cef73dSGregory Neil Shapiro<TR bgcolor="#dddddd" align=left valign=top>
58d0cef73dSGregory Neil Shapiro<TH>Flag</TH>   <TH align="center">Meaning</TH>
5940266059SGregory Neil Shapiro</TR>
60d0cef73dSGregory Neil Shapiro<TR align="left" valign=top>
6140266059SGregory Neil Shapiro<TD>R</TD>      <TD>Reject connection if filter unavailable</TD>
6240266059SGregory Neil Shapiro</TR>
63d0cef73dSGregory Neil Shapiro<TR align="left" valign=top>
6440266059SGregory Neil Shapiro<TD>T</TD>      <TD>Temporary fail connection if filter unavailable</TD>
6540266059SGregory Neil Shapiro</TR>
6640266059SGregory Neil Shapiro</TABLE>
6740266059SGregory Neil Shapiro
6840266059SGregory Neil ShapiroIf a filter is unavailable or unresponsive and no flags have been
6940266059SGregory Neil Shapirospecified, the MTA will continue normal handling of the current
7040266059SGregory Neil Shapiroconnection.
71d0cef73dSGregory Neil ShapiroThe MTA will try to contact the filter again on each new connection.
7240266059SGregory Neil Shapiro
7340266059SGregory Neil Shapiro<P>
74*5b0945b5SGregory Neil ShapiroThere are four fields inside of the <CODE>T=</CODE> equate: C, S, R, and E.
75d0cef73dSGregory Neil ShapiroNote the separator between each is a ";" (semicolon), as ","
76d0cef73dSGregory Neil Shapiro(comma) already separates equates.
77d0cef73dSGregory Neil ShapiroThe value of each field is a decimal number followed by a single letter
78d0cef73dSGregory Neil Shapirodesignating the units ("s" for seconds, "m" for minutes).
79d0cef73dSGregory Neil ShapiroThe fields have the following meanings:
80d0cef73dSGregory Neil Shapiro<P>
8140266059SGregory Neil Shapiro<TABLE cellspacing="1" cellpadding=4 border=1>
8240266059SGregory Neil Shapiro<TR bgcolor="#dddddd" align=left valign=top>
8340266059SGregory Neil Shapiro<TH>Flag</TH>   <TH align="center">Meaning</TH>
8440266059SGregory Neil Shapiro</TR>
8540266059SGregory Neil Shapiro<TR align="left" valign=top>
8640266059SGregory Neil Shapiro<TD>C</TD>      <TD>Timeout for connecting to a filter.  If set to 0, the
87d0cef73dSGregory Neil Shapiro		system's <CODE>connect(2)</CODE> timeout will be used.
8840266059SGregory Neil Shapiro		Default: 5m</TD>
8940266059SGregory Neil Shapiro</TR>
9040266059SGregory Neil Shapiro<TR align="left" valign=top>
9140266059SGregory Neil Shapiro<TD>S</TD>      <TD>Timeout for sending information from the MTA to a
9240266059SGregory Neil Shapiro                filter.  Default: 10s</TD>
9340266059SGregory Neil Shapiro</TR>
9440266059SGregory Neil Shapiro<TR align="left" valign=top>
9540266059SGregory Neil Shapiro<TD>R</TD>      <TD>Timeout for reading reply from the filter.  Default: 10s</TD>
9640266059SGregory Neil Shapiro</TR>
9740266059SGregory Neil Shapiro<TR align="left" valign=top>
9840266059SGregory Neil Shapiro<TD>E</TD>      <TD>Overall timeout between sending end-of-message to
9940266059SGregory Neil Shapiro                filter and waiting for the final acknowledgment.  Default: 5m</TD>
10040266059SGregory Neil Shapiro</TR>
10140266059SGregory Neil Shapiro</TABLE>
10240266059SGregory Neil Shapiro
103d0cef73dSGregory Neil Shapiro<P>
104d0cef73dSGregory Neil ShapiroThe following sendmail.mc example specifies three filters.
105d0cef73dSGregory Neil ShapiroThe first two rendezvous on Unix-domain sockets in the /var/run directory;
106d0cef73dSGregory Neil Shapirothe third uses an IP socket on port 999.
107d0cef73dSGregory Neil Shapiro<PRE>
10840266059SGregory Neil Shapiro	INPUT_MAIL_FILTER(`filter1', `S=unix:/var/run/f1.sock, F=R')
10940266059SGregory Neil Shapiro	INPUT_MAIL_FILTER(`filter2', `S=unix:/var/run/f2.sock, F=T, T=S:1s;R:1s;E:5m')
11040266059SGregory Neil Shapiro	INPUT_MAIL_FILTER(`filter3', `S=inet:999@localhost, T=C:2m')
11140266059SGregory Neil Shapiro
11240266059SGregory Neil Shapiro	define(`confINPUT_MAIL_FILTERS', `filter2,filter1,filter3')
113d0cef73dSGregory Neil Shapiro<HR width="30%">
114605302a5SGregory Neil Shapiro	m4 ../m4/cf.m4 myconfig.mc &gt; myconfig.cf
115d0cef73dSGregory Neil Shapiro</PRE>
11640266059SGregory Neil ShapiroBy default, the filters would be run in the order declared,
11740266059SGregory Neil Shapiroi.e. "filter1, filter2, filter3"; however, since
118d0cef73dSGregory Neil Shapiro<CODE>confINPUT_MAIL_FILTERS</CODE> is defined, the filters will be
119d0cef73dSGregory Neil Shapirorun "filter2, filter1, filter3".
120d0cef73dSGregory Neil ShapiroAlso note that a filter can be defined
121d0cef73dSGregory Neil Shapirowithout adding it to the input filter list by using
12240266059SGregory Neil ShapiroMAIL_FILTER() instead of INPUT_MAIL_FILTER().
12340266059SGregory Neil Shapiro
124d0cef73dSGregory Neil Shapiro<P>
12540266059SGregory Neil ShapiroThe above macros will result in the following lines being added to
12640266059SGregory Neil Shapiroyour .cf file:
12740266059SGregory Neil Shapiro<PRE>
12840266059SGregory Neil Shapiro        Xfilter1, S=unix:/var/run/f1.sock, F=R
12940266059SGregory Neil Shapiro        Xfilter2, S=unix:/var/run/f2.sock, F=T, T=S:1s;R:1s;E:5m
13040266059SGregory Neil Shapiro        Xfilter3, S=inet:999@localhost, T=C:2m
13140266059SGregory Neil Shapiro
13240266059SGregory Neil Shapiro        O InputMailFilters=filter2,filter1,filter3
13340266059SGregory Neil Shapiro</PRE>
134d0cef73dSGregory Neil Shapiro<P>
135d0cef73dSGregory Neil ShapiroFinally, the sendmail macros accessible via
136d0cef73dSGregory Neil Shapiro<A HREF="smfi_getsymval.html">smfi_getsymval</A> can be configured by
13740266059SGregory Neil Shapirodefining the following m4 variables (or cf options):
138d0cef73dSGregory Neil Shapiro<TABLE cellspacing="1" cellpadding=4 border=1>
139d0cef73dSGregory Neil Shapiro<TR bgcolor="#dddddd" align=left valign=top>
140d0cef73dSGregory Neil Shapiro<TH align="center">In .mc file</TH>   <TH align="center">In .cf file</TH>
141d0cef73dSGregory Neil Shapiro<TH align="center">Default Value</TH>
142d0cef73dSGregory Neil Shapiro</TR>
143d0cef73dSGregory Neil Shapiro<TR><TD>confMILTER_MACROS_CONNECT</TD><TD>Milter.macros.connect</TD>
144d0cef73dSGregory Neil Shapiro<TD><CODE>j, _, {daemon_name}, {if_name}, {if_addr}</CODE></TD></TR>
145d0cef73dSGregory Neil Shapiro<TR><TD>confMILTER_MACROS_HELO</TD><TD>Milter.macros.helo</TD>
146d0cef73dSGregory Neil Shapiro<TD><CODE>{tls_version}, {cipher}, {cipher_bits}, {cert_subject},
147d0cef73dSGregory Neil Shapiro{cert_issuer}</CODE></TD></TR>
148d0cef73dSGregory Neil Shapiro<TR><TD>confMILTER_MACROS_ENVFROM</TD><TD>Milter.macros.envfrom</TD>
149d0cef73dSGregory Neil Shapiro<TD><CODE>i, {auth_type}, {auth_authen}, {auth_ssf}, {auth_author},
150d0cef73dSGregory Neil Shapiro{mail_mailer}, {mail_host}, {mail_addr}</CODE></TD></TR>
151d0cef73dSGregory Neil Shapiro<TR><TD>confMILTER_MACROS_ENVRCPT</TD><TD>Milter.macros.envrcpt</TD>
152d0cef73dSGregory Neil Shapiro<TD><CODE>{rcpt_mailer}, {rcpt_host}, {rcpt_addr}</CODE></TD></TR>
153d0cef73dSGregory Neil Shapiro</TABLE>
15440266059SGregory Neil ShapiroFor information about available macros and their meanings, please
15540266059SGregory Neil Shapiroconsult the sendmail documentation.
156d0cef73dSGregory Neil Shapiro<HR size="1">
157d0cef73dSGregory Neil Shapiro<FONT size="-1">
1585dd76dd0SGregory Neil ShapiroCopyright (c) 2000-2003, 2006 Proofpoint, Inc. and its suppliers.
15940266059SGregory Neil ShapiroAll rights reserved.
160d0cef73dSGregory Neil Shapiro<BR>
16140266059SGregory Neil ShapiroBy using this file, you agree to the terms and conditions set
1625ef517c0SGregory Neil Shapiroforth in the LICENSE.
163d0cef73dSGregory Neil Shapiro</FONT>
164d0cef73dSGregory Neil Shapiro</BODY>
165d0cef73dSGregory Neil Shapiro</HTML>
166