sendmail - was: clamdscan
Mark Sapiro
mark at msapiro.net
Tue Jan 21 04:13:35 UTC 2020
Please don't hijack threads. I.e., start a new topic by creating a new
message rather than a reply to an unrelated message.
On 1/19/20 1:25 PM, Paul Scott wrote:
> I am trying to bring up MailScanner on a CentOS 6 machine with Sendmail, and the instructions on the mailscanner website are confusing, as this is what is written:
>
> <START>
> Change Commands That Start Sendmail
>
> Currently, your copy of sendmail will be started by a script such as /etc/init.d/mail or /etc/rc.d/init.d/sendmail. Somewhere in this script will be the command to start sendmail itself. This should look like this:
>
> sendmail -bd -q15m
>
> You should change this to the following two lines:
>
> sendmail -bd -OPrivacyOptions=noetrn -ODeliveryMode=queueonly -OQueueDirectory=/var/spool/mqueue.in
> sendmail -q15m
>
> This first starts the copy of sendmail that provides SMTP service, building the work queue for MailScanner. It then starts the copy of sendmail that delivers the output from MailScanner.
>
> You also might need to change the commands used to shut down sendmail as it now needs to find 2 copies and kill them both. However, this is not critical and the system will work without it.
> <END>
>
> However, the contents of the /etc/init.d/sendmail file are MUCH more complex, as follows:
It's basically a shell script. Somewhere in this file and/or in an
included file there are things like
DAEMON="yes"
QUEUE="15m"
and maybe
SENDMAIL_OPTARG="additional args"
> start() {
> # Start daemons.
> ret=0
> updateconf
> echo -n $"Starting $prog: "
> daemon /usr/sbin/sendmail $([ "x$DAEMON" = xyes ] && echo -bd) \
> $([ -n "$QUEUE" ] && echo -q$QUEUE) $SENDMAIL_OPTARG
Settings like those above make this become
daemon /usr/sbin/sendmail -bd -q15m additional args
> RETVAL=$?
> echo
> [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sendmail
> let ret+=$RETVAL
Then the above says if the return from `daemon /usr/sbin/sendmail -bd
-q15m` is 0, create the lock file /var/lock/subsys/sendmail, otherwise
increment 'ret' for testing later.
> if [ ! -f /var/run/sm-client.pid ]; then
> echo -n $"Starting sm-client: "
> touch /var/run/sm-client.pid
> chown smmsp:smmsp /var/run/sm-client.pid
> if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
> /sbin/restorecon /var/run/sm-client.pid
> fi
> daemon --check sm-client /usr/sbin/sendmail -L sm-msp-queue -Ac \
> -q$SMQUEUE $SENDMAIL_OPTARG
> RETVAL=$?
> echo
> [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sm-client
> let ret+=$RETVAL
> fi
The stuff immediately above starts sm-client which is a separate process
that MailScanner is not concerned with.
> [ $ret -eq 0 ] && return 0 || return 1
> }
And finally the above decides whether to return success or failure
> So my question is, how do I modify this startup script so that the mqueue.in is used, along with the other required parameters as described on the website?
I do not use sendmail and am not familiar with all the nuances here, but
I would say replace these lines:
daemon /usr/sbin/sendmail $([ "x$DAEMON" = xyes ] && echo -bd) \
$([ -n "$QUEUE" ] && echo -q$QUEUE) $SENDMAIL_OPTARG
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/sendmail
let ret+=$RETVAL
with
daemon /usr/sbin/sendmail -bd -OPrivacyOptions=noetrn \
-ODeliveryMode=queueonly -OQueueDirectory=/var/spool/mqueue.in
RETVAL=$?
echo
let ret+=$RETVAL
daemon /usr/sbin/sendmail -q15m
RETVAL=$?
let ret+=$RETVAL
[ $ret -eq 0 ] && touch /var/lock/subsys/sendmail
This will start both daemons and create the lock if they both succeed.
--
Mark Sapiro <mark at msapiro.net> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
More information about the MailScanner
mailing list