Ecole des Mines de Paris

SourceForge.net Logo

Joe's j-chkmail - Installation


Table of Contents

j-chkmail installation overview

  1. Verify if libmilter is installed - if not, then install it.
  2. Verify if installed sendmail was compiled with milter option. If not, then compile it again and enable milter option.
  3. Install j-chkmail
  4. Configure j-chkmail
  5. Configure sendmail with j-chkmail
  6. Launch j-chkmail and be happy !


Hardware requirements

Very little resources are required to run j-chkmail : 5 Mo free memory and 2 Mo free disk space are enough. As j-chkmail logs its activity, it needs some free disk space to store log files. If you configure j-chkmail with the same sendmail usual log level (9), j-chkmail will need almost the half of the space used by sendmail log files.


Software requirements


Installing libmilter

j-chkmail configure script checks the presence of libmilter files. Nevertheless, you can easily do it by hand in the following way :
    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  
    # exit
Take 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.


Installing sendmail

First of all, check sendmail version and if it was compiled with MILTER option :
    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.


Installing j-chkmail

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 : So, after running configure with chosen options, you shall run make and make install.

The following files will be installed :

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.


Configuring sendmail

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

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.


Other interesting tools and files

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.



Jose Marcio Martins da Cruz
j-chkmail - © Ecole des Mines de Paris - Centre de Calcul
Last modified: Fri Oct 04 11:07:32 MEST 2002