Setting ESETS for MTA Qmail

Inbound email message scanning

The objective of this installation is to insert esets_mda before Qmail’s local delivery agent. Assuming Qmail is installed in the /var/qmail directory, in the [mda] section of the ESETS configuration file, set the following parameter:

mda_path = "/var/qmail/bin/qmail-esets_mda"

Restart the ESETS daemon. Create the file /var/qmail/bin/qmail-esets_mda with the following content and run ‘chmod a+x’ on it:

#!/bin/sh
exec qmail-local -- "$USER" "$HOME" "$LOCAL" "" "$EXT" "$HOST" "$SENDER" "$1"

This will cause esets_mda to call Qmail’s local delivery agent. Next, create the file /var/qmail/bin/qmail-start.esets with the following content and also run 'chmod a+x' on it:

#!/bin/sh
A="$1"; shift
exec qmail-start.orig "|@BINDIR@/esets_mda '$A'"' -- --sender="$SENDER" --recipient="$RECIPIENT"' "$@"

This will start Qmail using esets_mda for local deliveries. However, the original delivery specification is passed to qmail-local through esets_mda. Note that in this configuration esets_mda will use Qmail’s recognized exit codes (see the qmail-command(8) man page). Lastly, replace qmail-start using commands:

mv /var/qmail/bin/qmail-start /var/qmail/bin/qmail-start.orig
ln -s qmail-start.esets /var/qmail/bin/qmail-start

Restart Qmail.

Bi-directional email messages scanning

The objective of this installation is to insert esets_mda before qmail-queue, which queues all mails before delivery. Assuming Qmail is installed in the /var/qmail directory, in the [mda] section of the ESETS configuration file, set the following parameter:

mda_path = "/var/qmail/bin/qmail-queue.esets"

Restart the ESETS daemon. Lastly, replace qmail-queue using these commands:

mv /var/qmail/bin/qmail-queue /var/qmail/bin/qmail-queue.esets
ln -s @BINDIR@/esets_mda /var/qmail/bin/qmail-queue

Restarting Qmail is unnecessary. All messages enqueued from now will be scanned by ESETS. Note that in this configuration esets_mda will use qmail-queue’s exit codes (see the qmail-queue(8) man page).