[Avcheck] RFC: specifying sendmail command for avcheck

Michael Tokarev mjt@tls.msk.ru
Fri, 28 Sep 2001 20:44:21 +0400


I noticied that sometimes it is necessary to specify command-line
arguments for sendmail command that will be invoked by avcheck or
from `infected' script.  For example, when there was no SMTP
support in avcheck itself, but there was external command-line
smtp client (I used msendmail for that), it was necessary to
specify tcp port to use, something like `msendmail -p 1025'.
Now I looked on how to use avcheck with Sendmail -- we need
to specify additional argument here, namely, name of
transport/protocol (e.g. -pAVCHECK) -- for Sendmail, this is
the only method to determine if injected mail should not be
checked for viruses again (ruleset based on "incoming" transport
name is used).

In principle, avcheck can accept multiword argument for -S
option, like
 avcheck .. -S "/usr/sbin/sendmail -p AVCHECK" -f from ...
and when split this arg into pieces (like shell does), forming
sendmail's commandline.  But with postfix, this scheme will
work improperly if at all -- postfix will either call shell
to parse avcheck's commandline, or will split that commandline
itself, giving 3 args on above example (`"/usr/sbin/sendmail',
`-p', and `AVCHECK"') instead of one.

Another variant is to specify a one-line shell script instead
of real sendmail command, and call real sendmail from within
that script with appropriate options.  But this will slow
reinjection significantly, just like when postfix will call
shell to run avcheck (see above).

Another variant is to use "option terminator", something like

 avcheck -S /usr/sbin/sendmail -p AVCHECK -- -f from ...

(note the extra `--').  But this is ugly at least, confusing
and will break existing installations too.  Also, options
parsing will be somewhat messy.

And there is yet another variant exists -- having a config
file.  From my point of view, this is an extra complication
(and slowdown too) -- too much an effort for this very issue.

Yet another choice, 4th one, is to have an option that "adds"
it's arg into sendmail's commandline, like e.g. -Wl of gcc
adds another option for linker.  This might be the same
option as for sendmail itself, i.e. to make -S "cumulative",
like this:

  avcheck -S /usr/sbin/sendmail -S -p -S AVCHECK -f from ...

This is also looks ugly, but will not break existing installations
at least.

Yet another, 5th variant, is to allow specifying several
"known" sendmail options (like -p), so that if given a
value, avcheck will pass it to sendmail with appropriate
prefix.  This way, commandline will look most simple, but
without a good flexibility (and we'll end up repeating
many sendmail's options, making it harder to use non-Sendmail
implementations).  I.e., for now, implementing -p option
as it is in Sendmail:

  avcheck -S /usr/sbin/sendmail -f from -p AVCHECK ...

(I changed options order by purpose, to show that -p is
avcheck's option, not Sendmail's one).

What others have to say here?

Thank you.

Regards,
 Michael.