Exim + Mailscanner on freeBSD

Marco Obaid marco at MUW.EDU
Thu Nov 13 21:05:00 GMT 2003


Hi,

The FreeBSD port that I downloaded from MS website (which I recommend you use
since it is the latest), installs a script "mta.sh" under /usr/local/etc/rc.d/
which has the correct parameters. I don't use Exim but I just got through
installing MS on FreeBSD with sendmail and came across Exim setup.

>From man mailscanner:
*********************

      A similar setup for Exim could look like this:

       1. Create two queues (e.g. /var/spool/exim.in and  /var/spool/exim.out)
       with  appropriate  owner/group/mode  (e.g.  owner=mailnull, group=mail,
       mode=750).

       2. Create two  exim  configurations  (e.g.  /usr/local/etc/exim/config-
       ure.in, /usr/local/etc/exim/configure.out).

       3. Make sure that the incoming exim configuration only queues mails and
       never delivers mail itself. This can be achieved by using the Exim con-
       fig option "queue_only = true" and/or a special router definition (Exim
       4 syntax):

           defer_router:
           driver = manualroute
           self = defer
           transport = remote_smtp
           route_list = *  127.0.0.1  byname
           verify = false

       4. Start two exim instances:

           exim -C /usr/local/etc/exim/configure.in
           exim -C /usr/local/etc/exim/configure.out



Here is a copy of the script:

***************** /usr/local/etc/rc.d/mta.sh.sample ********************

#!/bin/sh

outgoing_queue_time=15m
mta=exim

case "$mta" in
        exim)
                program=/usr/local/sbin/exim

                if [ -f /usr/local/etc/exim/configure.in ]; then
                        incoming_config=/usr/local/etc/exim/configure.in
                else
                        incoming_config=/usr/local/etc/exim/configure
                fi

                outgoing_config=/usr/local/etc/exim/configure.out

                inpidfile=/var/run/exim_in.pid
                outpidfile=/var/run/exim_out.pid
                subpidfile=

                incoming_args="-C ${incoming_config} -oP ${inpidfile} -bd"
                outgoing_args="-C ${outgoing_config} -oP ${outpidfile} -
q${outgoing_queue_time}"
                submitqueue_args=
                ;;

        sendmail)
                program=/usr/sbin/sendmail

                incoming_queue=/var/spool/mqueue.in

                submit_queue_time=${outgoing_queue_time}

                inpidfile=/var/run/sendmail_in.pid
                outpidfile=/var/run/sendmail_out.pid
                subpidfile=/var/spool/clientmqueue/sm-client.pid

                incoming_args="-L sm-mta-in -bd \
                                -OPrivacyOptions=noetrn \
                                -OQueueDirectory=${incoming_queue} \
                                -ODeliveryMode=queueonly \
                                -OPidFile=${inpidfile}"
                outgoing_args="-L sm-mta-out -q${outgoing_queue_time} \
                                -OPidFile=${outpidfile}"
                submitqueue_args="-L sm-msp-queue -Ac -q${submit_queue_time} \
                                -OPidFile=${subpidfile}"
                ;;

        *)
                echo "ERROR: I don't know the MTA '$mta'. Check your
settings." >&2
                exit 2
                ;;
esac

start_mta()
{
        echo -n " `basename ${program}`(incoming)"
        ${program} ${incoming_args}

        echo -n " `basename ${program}`(outgoing)"
        ${program} ${outgoing_args}
}

start_mspq ()
{
        if [ "${submitqueue_args}" ]; then
                echo -n " `basename ${program}`(submitqueue)"
                ${program} ${submitqueue_args}
        fi
}

stop_mta()
{
        echo "Stopping `basename ${program}` (incoming)"
        kill -TERM `head -1 ${inpidfile}` 2>/dev/null

        echo "Stopping `basename ${program}` (outgoing)"
        kill -TERM `head -1 ${outpidfile}` 2>/dev/null
}

stop_mspq ()
{
        if [ "${submitqueue_args}" ]; then
                echo "Stopping `basename ${program}` (submitqueue)"
                kill -TERM `head -1 ${subpidfile}` 2>/dev/null
        fi
}


_action=${1:-start}

case ${_action} in
start)
        start_mta
        start_mspq
        ;;

stop)
        stop_mta
        stop_mspq
        ;;

restart)
        stop_mta
        stop_mspq
        sleep 5
        start_mta
        start_mspq
        ;;

*)
        echo "Usage: `basename $0` {start|stop|restart}" >&2
        exit 64
        ;;
esac
exit 0

**************************************



More information about the MailScanner mailing list