1*d0cef73dSGregory Neil Shapiro<HTML> 2*d0cef73dSGregory Neil Shapiro<HEAD><TITLE>Installation and Configuration</TITLE> 3*d0cef73dSGregory Neil Shapiro</HEAD> 4*d0cef73dSGregory Neil Shapiro<BODY> 5e92d3f3fSGregory Neil Shapiro<!-- 6*d0cef73dSGregory Neil Shapiro$Id: installation.html,v 1.24 2013-11-22 20:51:39 ca Exp $ 7e92d3f3fSGregory Neil Shapiro--> 8*d0cef73dSGregory Neil Shapiro<H1>Installation</H1> 9*d0cef73dSGregory Neil Shapiro<H2>Contents</H2> 10*d0cef73dSGregory Neil Shapiro<UL> 11*d0cef73dSGregory Neil Shapiro <LI><A href="#compile">Compiling and Installing Your Filter</A> 12*d0cef73dSGregory Neil Shapiro <LI><A href="#config">Configuring Sendmail</A> 13*d0cef73dSGregory Neil Shapiro</UL> 1440266059SGregory Neil Shapiro 15*d0cef73dSGregory 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: 18*d0cef73dSGregory Neil Shapiro<UL> 19*d0cef73dSGregory 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 22*d0cef73dSGregory 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 25*d0cef73dSGregory Neil Shapiro <LI>Compile with pthreads, either by using -pthread for gcc, or 2640266059SGregory Neil Shapiro linking with a pthreads support library (-lpthread). 27*d0cef73dSGregory Neil Shapiro</UL> 2840266059SGregory Neil ShapiroYour compile command line will look like 29*d0cef73dSGregory Neil Shapiro<PRE> 3040266059SGregory Neil Shapirocc -I/path/to/include -I/path/to/sendmail -c myfile.c 31*d0cef73dSGregory Neil Shapiro</PRE> 3240266059SGregory Neil Shapiroand your linking command line will look something like 33*d0cef73dSGregory Neil Shapiro<PRE> 3440266059SGregory Neil Shapirocc -o myfilter [object-files] -L[library-location] -lmilter -pthread 35*d0cef73dSGregory Neil Shapiro</PRE> 3640266059SGregory Neil Shapiro 37*d0cef73dSGregory Neil Shapiro<H2><A name="config">Configuring Sendmail</A></H2> 3840266059SGregory Neil Shapiro 39*d0cef73dSGregory Neil ShapiroIf you use a sendmail version older than 8.13 please see 40605302a5SGregory Neil Shapirothe instructions for your version. 41*d0cef73dSGregory Neil ShapiroThe default compilation options for sendmail enable support 42*d0cef73dSGregory 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: 48*d0cef73dSGregory Neil ShapiroThe required <CODE>S=</CODE> equate specifies the socket where 49*d0cef73dSGregory Neil Shapirosendmail should look for the filter; the optional <CODE>F=</CODE> and 50*d0cef73dSGregory Neil Shapiro<CODE>T=</CODE> equates specify flags and timeouts, respectively. 51*d0cef73dSGregory Neil ShapiroAll equates names, equate field names, and flag values are case sensitive. 5240266059SGregory Neil Shapiro 5340266059SGregory Neil Shapiro<P> 54*d0cef73dSGregory Neil ShapiroThe current flags (<CODE>F=</CODE>) are: 55*d0cef73dSGregory Neil Shapiro<P> 56*d0cef73dSGregory Neil Shapiro<TABLE cellspacing="1" cellpadding=4 border=1> 57*d0cef73dSGregory Neil Shapiro<TR bgcolor="#dddddd" align=left valign=top> 58*d0cef73dSGregory Neil Shapiro<TH>Flag</TH> <TH align="center">Meaning</TH> 5940266059SGregory Neil Shapiro</TR> 60*d0cef73dSGregory Neil Shapiro<TR align="left" valign=top> 6140266059SGregory Neil Shapiro<TD>R</TD> <TD>Reject connection if filter unavailable</TD> 6240266059SGregory Neil Shapiro</TR> 63*d0cef73dSGregory 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. 71*d0cef73dSGregory Neil ShapiroThe MTA will try to contact the filter again on each new connection. 7240266059SGregory Neil Shapiro 7340266059SGregory Neil Shapiro<P> 74*d0cef73dSGregory Neil ShapiroThere are four fields inside of the <CODE>T=</CODE> equate: C, S, R, and E. 75*d0cef73dSGregory Neil ShapiroNote the separator between each is a ";" (semicolon), as "," 76*d0cef73dSGregory Neil Shapiro(comma) already separates equates. 77*d0cef73dSGregory Neil ShapiroThe value of each field is a decimal number followed by a single letter 78*d0cef73dSGregory Neil Shapirodesignating the units ("s" for seconds, "m" for minutes). 79*d0cef73dSGregory Neil ShapiroThe fields have the following meanings: 80*d0cef73dSGregory 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 87*d0cef73dSGregory 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 103*d0cef73dSGregory Neil Shapiro<P> 104*d0cef73dSGregory Neil ShapiroThe following sendmail.mc example specifies three filters. 105*d0cef73dSGregory Neil ShapiroThe first two rendezvous on Unix-domain sockets in the /var/run directory; 106*d0cef73dSGregory Neil Shapirothe third uses an IP socket on port 999. 107*d0cef73dSGregory 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') 113*d0cef73dSGregory Neil Shapiro<HR width="30%"> 114605302a5SGregory Neil Shapiro m4 ../m4/cf.m4 myconfig.mc > myconfig.cf 115*d0cef73dSGregory 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 118*d0cef73dSGregory Neil Shapiro<CODE>confINPUT_MAIL_FILTERS</CODE> is defined, the filters will be 119*d0cef73dSGregory Neil Shapirorun "filter2, filter1, filter3". 120*d0cef73dSGregory Neil ShapiroAlso note that a filter can be defined 121*d0cef73dSGregory Neil Shapirowithout adding it to the input filter list by using 12240266059SGregory Neil ShapiroMAIL_FILTER() instead of INPUT_MAIL_FILTER(). 12340266059SGregory Neil Shapiro 124*d0cef73dSGregory 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> 134*d0cef73dSGregory Neil Shapiro<P> 135*d0cef73dSGregory Neil ShapiroFinally, the sendmail macros accessible via 136*d0cef73dSGregory Neil Shapiro<A HREF="smfi_getsymval.html">smfi_getsymval</A> can be configured by 13740266059SGregory Neil Shapirodefining the following m4 variables (or cf options): 138*d0cef73dSGregory Neil Shapiro<TABLE cellspacing="1" cellpadding=4 border=1> 139*d0cef73dSGregory Neil Shapiro<TR bgcolor="#dddddd" align=left valign=top> 140*d0cef73dSGregory Neil Shapiro<TH align="center">In .mc file</TH> <TH align="center">In .cf file</TH> 141*d0cef73dSGregory Neil Shapiro<TH align="center">Default Value</TH> 142*d0cef73dSGregory Neil Shapiro</TR> 143*d0cef73dSGregory Neil Shapiro<TR><TD>confMILTER_MACROS_CONNECT</TD><TD>Milter.macros.connect</TD> 144*d0cef73dSGregory Neil Shapiro<TD><CODE>j, _, {daemon_name}, {if_name}, {if_addr}</CODE></TD></TR> 145*d0cef73dSGregory Neil Shapiro<TR><TD>confMILTER_MACROS_HELO</TD><TD>Milter.macros.helo</TD> 146*d0cef73dSGregory Neil Shapiro<TD><CODE>{tls_version}, {cipher}, {cipher_bits}, {cert_subject}, 147*d0cef73dSGregory Neil Shapiro{cert_issuer}</CODE></TD></TR> 148*d0cef73dSGregory Neil Shapiro<TR><TD>confMILTER_MACROS_ENVFROM</TD><TD>Milter.macros.envfrom</TD> 149*d0cef73dSGregory Neil Shapiro<TD><CODE>i, {auth_type}, {auth_authen}, {auth_ssf}, {auth_author}, 150*d0cef73dSGregory Neil Shapiro{mail_mailer}, {mail_host}, {mail_addr}</CODE></TD></TR> 151*d0cef73dSGregory Neil Shapiro<TR><TD>confMILTER_MACROS_ENVRCPT</TD><TD>Milter.macros.envrcpt</TD> 152*d0cef73dSGregory Neil Shapiro<TD><CODE>{rcpt_mailer}, {rcpt_host}, {rcpt_addr}</CODE></TD></TR> 153*d0cef73dSGregory Neil Shapiro</TABLE> 15440266059SGregory Neil ShapiroFor information about available macros and their meanings, please 15540266059SGregory Neil Shapiroconsult the sendmail documentation. 156*d0cef73dSGregory Neil Shapiro<HR size="1"> 157*d0cef73dSGregory Neil Shapiro<FONT size="-1"> 158*d0cef73dSGregory Neil ShapiroCopyright (c) 2000-2003, 2006 Proofpoint, Inc. and its suppliers. 15940266059SGregory Neil ShapiroAll rights reserved. 160*d0cef73dSGregory Neil Shapiro<BR> 16140266059SGregory Neil ShapiroBy using this file, you agree to the terms and conditions set 1625ef517c0SGregory Neil Shapiroforth in the LICENSE. 163*d0cef73dSGregory Neil Shapiro</FONT> 164*d0cef73dSGregory Neil Shapiro</BODY> 165*d0cef73dSGregory Neil Shapiro</HTML> 166