AMaViS FAQ $Revision: 1.3 $ $Date: 2000/10/31 10:55:11 $

(the hints found in here are mainly contributions to AMaViS. They have
 neither been checked nor merged by the authors. They are meant to
 play with until AMaViS is able to handle it by itself...We can give
 no support if you modify the original distribution files and your
 system does not operate properly..  
 Again: ONLY USE THEM IF YOU KNOW WHAT YOU'RE DOING !)


Q: AMaViS works fine while scanning mails for local recipients. But I use
   my sendmail to relay mails for another host. How can AMaViS scan relayed
   mails, too ..?

[editors note: please read README.sendmail, too. ]


A: For now, there are two possible ways/workarounds to manage that:

   -----------------------------------------------------------------------
   (from: Christian Bricart <shiva@aachalon.de>)

   * create a local account for every user you want to handle mail for.
     This account _may_ be a full account on your Linux box, but eventually
     does not need a password at all (no login possible). Just set the password
     to "x" in /etc/shadow .. but be sure NOT to have a NULL PASSWORD !
   * hence set up your sendmail host as it was the final receipient host.
     You eventually have to do aliasing in /etc/aliases (or appropriate), too.
   * create a ~/.procmailrc for every user who want to "forward" his/her 
     mail:

     # ~/.procmailrc
     :0
     *
     ! username_there@mailhost.domain.com

   * mailhost.domain.com is the mail server "behind" your sendmail host
     it either has to have no MX entry or MX point to itself, and it
     has to be configured to receive mail for username@mailhost.domain.com

   
   Of course, this is a bit tricky when you have around 200 users or more...
   But this will help you learn writing small shell scripts .. ;-))

   
   -----------------------------------------------------------------------
   
   (from: Stefan Dreyer <S.Dreyer@celleweb.de>)
   
    * enable the use of "mailertable" in your sendmail.mc (or appropriate)
      file: 

       FEATURE(mailertable, hash /etc/mail/mailertable.db)dnl

    * for every domain you relay for, add a line to /etc/mail/mailertable:
       
       domain.com	procmail:/etc/procmailrcs/virusscan

    * then do a: "makemap hash /etc/mail/mailertable < /etc/mail/mailertable"
      and restart sendmail (using e.g. "killall -HUP sendmail")
    * /etc/procmailrcs/virusscan is a regular procmailrc-file:
      
       :0      # forward mail for domain.com
       | /usr/sbin/scanmails $1 $2 mailserver.domain.com

    * Your sendmail server running AMaViS should be best MX for domain.
    * mailserver.domain.com should _not_ have an MX entry or it should
      point to itself (otherwise mail would loop)
    * find the line "echo No virus found - good >> ${tmpdir}/logfile" in
      /usr/sbin/scanmails and add the following after the line:

      # cut off old domainname from name and add other mailserver+domain
      # user@domain.com --> user@mailserver.domain.com

      OUT=`echo $2 | cut -d "@" -f 1`
      NAME=`echo $OUT@[$3]`

      # the program 'downcase' just translates everything to lower case
      # letters 
      # (Memo: (C. Bricart):  may be just: "tr '[:upper:]' '[:lower:]'")

      USER=`/usr/bin/downcase $OUT`

      # If it is a local receipient, then deliver mail directly
      # This part should be changed to gdb-routines
      # as the administrator then has not to change source code to add
      # new users...
      # Note: The distinction for local users depends to my local
      #       configuration and should not be necessary for ordinary
      #       use ...

      if [ "x${deliver}" != "x" ] && [ -x ${deliver} ] ; then
        if [ $USER = "user.local.1" ] ; then
	  ${deliver}  -Y -a $1 -d localuser1 <${tmpdir}/receivedmail
	elif [ $USER = "user.local.2" ] ; then
	  ${deliver}  -Y -a $1 -d localuser2 <${tmpdir}/receivedmail
	else
	  # not local user -> send to other mailserver...
	  /usr/sbin/sendmail -f $1 -F$1  $NAME  <${tmpdir}/receivedmail
	fi
      else
        # now proceed with the original script ...
        echo "WARNING! No local delivery program available." | log_error
        [..nothing to be changed from here..]
	[..]
      
   * Extra note from C. Bricart: Perhaps it is better to make a copy
     of "/usr/sbin/scanmails" to "/usr/sbin/scanmails.relay" and use
     this script in your /etc/procmailrcs/virusscan, as I am not sure
     if it may cause any trouble with local delivery as meant by
     the original script...
     
----------------------------------------------------------------------------
   
Q: I use the Cyrus mailer. How can I get AMaViS work with IMAP?

A: Vince Hickey <vhickey@blackhawk.nrl.navy.mil> wrote:

   * Change the deliver line in /usr/sbin/scanmails

         deliver=/usr/bin/procmail

     to

         deliver=/usr/cyrus/bin/deliver

   * Modify the sendmail.cf file as follows:

   #Mcyrus,         P=/usr/cyrus/bin/deliver, F=lsDFMnPqA5S@/:|, S=10, R=20/40,
   #                T=X-Unix,
   #                U=imapadm:mail,
   #                A=deliver -e -m $h -- $u
   #
   #Mcyrusbb,       P=/usr/cyrus/bin/deliver, F=lsDFMnPS, S=10, R=20/40,
   #                T=X-Unix,
   #                U=imapadm:mail,
   #                A=deliver -e -m $u

   Mcyrus,                P=/usr/sbin/scanmails, F=lsDFMnPqA5S@/:|, S=10,
                          R=20/40, T=X-Unix,
                          U=imapadm:mail,
                          A=scanmails -e -m $h -- $u

   Mcyrusbb,      P=/usr/sbin/scanmails, F=lsDFMnPS, S=10, R=20/40, T=X-Unix,
                  U=imapadm:mail,
                  A=scanmails -e -m $u

   I left the Mlocal stuff alone.  It seems to work fine like this...