
               Installing ENMA

* Supported OSes
  - Linux
  - FreeBSD, NetBSD
  - MacOS X 10.5.x 
  - Solaris 10 or later

* Necessary softwares
  - GNU C Compiler
  - GNU Make
  - OpenSSL (0.9.8 or later)
  - resolver library
    - ldns (1.6.0 or later)
    or
    - libbind (bind 9, libbind 6.0 or later)
  - libmilter (sendmail 8.13 or later)

* Steps of building and execution

  1. Extracting

    $ tar xzf enma-x.y.z.tar.gz
    $ cd enma-x.y.z

  2. Installing dependent libraries

    To install OpenSSL, ldns and libmilter, please read "Building
    dependent libraries" below.

  3. Executing configure

    If the headers and libraries of OpenSSL, ldns and libmilter are
    installed in the "/usr/local" directory, execute "configure"
    without options.

    $ ./configure

    If they are installed in another directory, please specify the
    base directories with the --with-ssl, --with-ldns and
    --with-libmilter option.

    The following example is that the base directory of OpenSSL is
    "/foo", that of ldns is "/bar" and that of libmilter is "/baz".

    $ ./configure --with-ssl=/foo --with-ldns=/bar --with-libmilter=/baz

  4. Building

    $ make

  5. Installing

    $ sudo make install

  6. Preparing the configuration file

    $ sudo cp enma/etc/enma.conf.sample /etc/enma.conf

  7. Creating the directory for the PID file

    In the sample configuration file, "/var/run/enma/enma.pid" is
    specified to "milter.pidfile". So, you need to change permission
    of the directory so that "milter.user" can write.

    $ sudo mkdir -p /var/run/enma
    $ sudo chown daemon:daemon /var/run/enma
    $ sudo chmod 700 /var/run/enma

  8. Executing

    $ sudo /usr/local/libexec/enma -c /etc/enma.conf
  
* Configuring MTA

  Configure MTA so as to use ENMA when it receives messages.

  - sendmail

    Specify ENMA's milter socket with the MAIL_FILTER or
    INPUT_MAIL_FILTER macro in the .mc file, then generate
    sendmail.cf.

    Example of using ENMA's default socket:

        INPUT_MAIL_FILTER(`enma', `S=inet:10025@127.0.0.1')dnl

    For more information on INPUT_MAIL_FILTER, please refer to
    cf/README etc in the sendmail package.

    If you use sendmail 8.13 or earlier as MTA, set 
    "milter.sendmail813" to "ture" in ENMA's configuration file.

  - postfix (2.4 or later)

    Set "milter.postfix" to "true" in ENMA's configuration file.
    Specify smtpd_milters to ENMA's milter socket in the main.cf file.

    Example of using ENMA's default socket:

        smtpd_milters = inet:127.0.0.1:10025

    For more information on milter support of postfix, please refer to
    README_FILES/MILTER_README in the postfix package.

* Building dependent libraries

  This is an example to install the libraries under
  the /usr/local directory.

  - OpenSSL

    $ tar zxf openssl-x.y.z.tar.gz
    $ cd openssl-x.y.z
    $ ./config threads shared --prefix=/usr/local
    $ make
    $ sudo make install

  - ldns

    $ tar zxf ldns-x.y.z.tar.gz
    $ cd ldns-x.y.z
    $ ./configure --prefix=/usr/local --with-ssl=/usr/local
    $ make
    $ sudo make install

  - libbind

    $ tar zxf bind-x.y.z
    $ cd bind-x.y.z/lib/bind
    $ ./configure --prefix=/usr/local --enable-threads --with-libtool --enable-ipv6
    $ make
    $ sudo make install

  - libmilter

    $ tar zxf sendmail.x.y.z.tar.gz
    $ cd sendmail-x.y.z

    - Put the followings to devtools/Site/site.config.m4

    define(`confINCLUDEDIR', `/usr/local/include')
    define(`confLIBDIR', `/usr/local/lib')
    APPENDDEF(`confENVDEF', `-DSM_CONF_POLL=1 -DNETINET6=1')
    APPENDDEF(`confOPTIMIZE', `-g')
    # Pease add other setting appropriate to your OS.

    $ cd libmilter
    $ ./Build
    $ sudo ./Build install

  For more information about installation of OpenSSL, ldns and
  libmiter, please refer to manuals in each packages.

* Notes on building ENMA for the many user environments

  - Specifying SM_CONF_POLL for libmilter

    If select() is used for the communication with sendmail, 
    file descriptors over FD_SETSIZE cannot be handled. So, poll()
    should be used instead. Please define SM_CONF_POLL when building
    libmilter.

    Please refer to "build/site.config.m4.poll-generic".

      # Setting to add to site.config.m4
      APPENDDEF(`confENVDEF', `-DSM_CONF_POLL=1')

    If you install ENMA with "build/build_all.sh", SM_CONF_POLL is
    automatically specified.

  - Specifying the "-m64" option of gcc on SPARC Solaris

    32bit version fopen() of Solaris, used in libbind, cannot handle
    file descriptors over 255. So, please specify the "-64bit" option
    when building the libraries and ENMA.

    - libbind

      $ ./configure CFLAGS=-m64 LDFLAGS=-m64

    - libmilter

      Please refer to "build/site.config.m4.poll-m64"

      # Setting to add to site.config.m4
      APPENDDEF(`confENVDEF', `-DSM_CONF_POLL=1')
      APPENDDEF(`confCCOPTS', `-m64')

    - ENMA

      $ ./configure CFLAGS=-m64 LDFLAGS=-m64

$Id: INSTALL 1454 2011-12-05 02:05:19Z takahiko $
