![]() |
Joe's j-chkmail - Installation |
martins@calloway:~> ls /usr/include/libmilter/ mfapi.h mfdef.h martins@calloway:~> ls /usr/lib/libmilter.a /usr/lib/libmilter.a martins@calloway:~>libmilter headers files from sendmail releases older than 8.12.3 were installed under /usr/include instead of /usr/include/libmilter. If this is your case, you should create /usr/include/libmilter directory and move the header files (mfapi.h and mfdef.h) into it.
If libmilter isn't installed, it's very easy to install it. You need to get the last sendmail source distribution and :
joe@calloway> gunzip -c sendmail-8.12.3.tar.gz | tar xvf - joe@calloway> cd sendmail.8.12.3 joe@calloway> cat > devtools/Site/site.config.m4 APPENDDEF(`conf_sendmail_ENVDEF',`-DMILTER') ^D joe@calloway> cd libmilter joe@calloway> ./Build -c joe@calloway> su # ./Build install # exitTake a look at smconf directory. You'll find a file named site.config.m4, which you can copy into devtools/Site, instead of creating it.
If your box is running Linux, there is binaries distributions of libmilter. You should look for an rpm package named sendmail-devel.rpm.
user@calloway > /usr/lib/sendmail -d0,0 < /dev/null Version 8.12.3 Compiled with: DNSMAP LOG MAP_REGEX MATCHGECOS MILTER MIME7TO8 MIME8TO7 NAMED_BIND NDBM NETINET NETINET6 NETUNIX NEWDB NIS NISPLUS PIPELINING SCANF USERDB XDEBUG ============ SYSTEM IDENTITY (after readcf) ============ (short domain name) $w = calloway (canonical domain name) $j = calloway.ensmp.fr (subdomain name) $m = ensmp.fr (node name) $k = calloway ======================================================== Recipient names must be specified user@calloway >You should see the MILTER option. If it's not the case or if the version of sendmail is too old, you should compile it again and install it, with MILTER option enabled.
General details of sendmail installation is out of the scope of this document. So we limit ourself only to the milter option.
If you already compiled and installed libmilter as shown in the last paragraph, you've done most of the work. There is only three more "little" commands to send and finish the job :
joe@calloway> gunzip -c sendmail-8.12.3.tar.gz | tar xvf - joe@calloway> cd sendmail.8.12.3 joe@calloway> cat > devtools/Site/site.config.m4 APPENDDEF(`conf_sendmail_ENVDEF',`-DMILTER') ^D joe@calloway> cd libmilter joe@calloway> ./Build -c joe@calloway> su # ./Build install # exit joe@calloway> cd .. joe@calloway> ./Build -c joe@calloway> su # ./Build install # exit
As you see, the only thing to do to compile with milter option is the declaration at the file devtools/Site/site.config.m4.
I supposed you've got j-chkmail sources. If you want to do a quick install, you may :
joe@calloway> gunzip -c jchkmail-1.x.tar.gz | tar xvf - joe@calloway> cd jchkmail-1.x joe@calloway> ./configure joe@calloway> make joe@calloway> make install
N.B. - You should be using a GNU compatible make.
If you don't want default configuration values, you should try other configure options :
joe@calloway> ./configure --help | more Usage: configure [options] [host] Options: [defaults in brackets after descriptions] Configuration: --cache-file=FILE cache test results in FILE --help print this message --no-create do not create output files --quiet, --silent do not print `checking...' messages --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX [/usr] ... --enable and --with options recognized: --with-sendmail=PATH sendmail source path --with-user=LOGIN set j-chkmail user name (default smmsp) --with-group=LOGIN set j-chkmail group name (default smmsp) --with-work-dir=PATH set j-chkmail work dir (default /var/jchkmail) --with-spool-dir=PATH set j-chkmail spool dir (default /var/spool/jchkmail) --with-conf-dir=PATH set j-chkmail config dir (default /etc/mail) --with-rc-dir=PATH set system start-up dir (default /etc/init.d or /etc/rc.d)Interesting options are :
--prefix
- this option lets you install j-chkmail
elsewhere than default location
--with-sendmail
- if you haven't installed libmilter, or
if you want j-chkmail compiled against another libmilter, you may setup
configure to look at libmilter elsewhere. You should replace PATH with
the full path to the root of compiled sendmail source tree.
--with-user
- this option sets the default user which
j-chkmail will run as. This option may be override at the configuration
file.
--with-group
- this option sets the default group which
j-chkmail will run as. This option may be override at the configuration
file.
--with-work-dir=PATH
- this option sets the default
directory used by j-chkmail to store his temporary and state files.
--with-spool-dir=PATH
- this option sets the default
directory used by j-chkmail to create temporary message files and saved
rejected messages.
--with-conf-dir=PATH
- if you want j-chkmail look for
configuration files elsewhere than the /etc/mail default directory.
--with-rc-dir=PATH
- if you want j-chkmail start-up script
to be installed elsewhere than /etc/init.d or /etc/rc.d.
configure
with chosen options, you shall run
make
and make install
.
The following files will be installed :
/usr/sbin/j-chkmail
- j-chkmail daemon
/usr/bin/j-scanfile
- command line scanner
/usr/bin/j-printstats
- command to dump daemon statistical
counters
/etc/init.d/j-chkmail.init
- j-chkmail start-up script
/etc/mail/j-chkmail.cf.org
- global configuration file
template
/etc/mail/j-nets.org
- IP networks declaration template
file
/etc/mail/j-local-users.org
- Intranet users template file
/etc/mail/j-error-msg.org
- warning messages template file
j-chkmail.8 s-scanfile.1 j-printstats.1 j-chkmail.cf.5
-
man pages
The next step is to create needed links to be able to launch j-chkmail at start-up. You may take a look at this script and modify it if needed.
# cp bin/j-chkmail.init /etc/init.d/j-chkmail # /sbin/chkconfig --add j-chkmail # /sbin/chkconfig --level 2345 j-chkmail on
# cp bin/j-chkmail.init /etc/init.d/j-chkmail # cd /etc/rc0.d # ln -s ../init.d/j-chkmail K36j-chkmail # cd /etc/rc1.d # ln -s ../init.d/j-chkmail K36j-chkmail # cd /etc/rc2.d # ln -s ../init.d/j-chkmail S88j-chkmail # cd /etc/rcS.d # ln -s ../init.d/j-chkmail K36j-chkmail
General information about sendmail configuration is out of the scope of this document. So, we'll restrict ourself to information needed to let sendmail talk to j-chkmail.
There are two ways to configure sendmail. The easy way is to define what you want at a file named sendmail.mc (take a look at the cf dir inside sendmail source directory).
First of all, you should decide if you want to use INET sockets or UNIX sockets.
You'll find two files inside smconfig directory : milter.mc and milter.cf. milter.mc contains macro which shall be inserted in your sendmail.mc file. milter.cf contains lines which shall be inserted at your sendmail.cf file. You may choose one or the other, or you may insert needed lines as follows.
If you decide to use INET sockets, you should add the following lines to your sendmail.mc file :
INPUT_MAIL_FILTER(`j-chkmail', `S=inet:2000@localhost, T=C:2m') define(`confINPUT_MAIL_FILTERS', `j-chkmail')Otherwise, if you prefer UNIX socks, you should add the following lines.
INPUT_MAIL_FILTER(`j-chkmail', `S=local:/var/jchkmail/j-chkmail.sock, T=C:2m') define(`confINPUT_MAIL_FILTERS', `j-chkmail')
The next step is to generate sendmail.cf configuration file. Take a look at the cf/README file at the sendmail source tree directory to get more information.
I prefer INET sockets, but others folks may prefer UNIX sockets. I wrote some lines at the FAQ to explain why I prefer INET socks.
The hard way to configure sendmail is to add what you need within the real sendmail.cf file. You may need configure sendmail this way if you're using configuration toolkits other than that distributed with sendmail.
If you fall in this case, you should add the following lines just after the end of the OPTIONS section :
O InputMailFilters=j-chkmail # Milter options #O Milter.LogLevel O Milter.macros.connect=j,_,{daemon_name},{if_name},{if_addr} O Milter.macros.helo={tls_version},{cipher},{cipher_bits},{cert_subject},{cert_issuer} O Milter.macros.envfrom=i,{auth_type},{auth_authen},{auth_ssf},{auth_author},{mail_mailer},{mail_host},{mail_addr} O Milter.macros.envrcpt={rcpt_mailer},{rcpt_host},{rcpt_addr} # Xj-chkmail, S=inet:2000@localhost, T=C:2m
Again, you may change the last line if you prefer using UNIX sockets instead of INET sockets.
You're free to use the kind of socket you prefer, the port number you prefer, and the unix socket name you prefer, provided you have the same definitions both at sendmail and j-chkmail configuration files.
Sendmail macros defined above are not all needed. But as they are default values, it's not necessary to change them. There is no noticeable performance loss if you let them all.
Configuring j-chkmail is a subject of another document : "Running j-chkmail", where you can get all information you need to run, control and monitor j-chkmail runtime behavior.
You may want to take a look at the contrib directory. There may be some interesting tools to control j-chkmail running behavior.
Nowadays, the only contrib is a set of scripts based on rrdtool, used to monitor j-chkmail graphically at a beautiful web page.
Don't forget to take a look at j-printstats and j-scanfile tools.