/*
 * -----------------------------------------------------------
 *
 *   Integration Dr.Web(R) daemon and Postfix Mailer
 *
 * -----------------------------------------------------------
 */

1. Requirements
2. The way it works
3. Enabling antivirus check
4. Settings
5. Contacts


        1. Requirements

- Started Dr.Web Daemon (drwebd) version 4.33 or higher
- postfix (v.20000530 or higher)


        2. The way it works

This layout shows the way the messages are filtered using
the first method suggested by the Postfix mail server.

      ..................................
      :            Postfix             :
   ----->smtpd \                /local---->
      :         -cleanup->queue-       :
   ---->pickup /                \smtp----->
   ^  :                        |       :
   |  :                         \pipe-----+
   |  ..................................  |
   |                                      |
   +----- sendmail <------ drweb <--------+

The filter receives an incoming message and saves it in the temporary
file, then informs the daemon where the check object is located; the
letter itself is not transmitted through the transport connection
between the client and the daemon, and thus performance increases. After
the check the filter performs the following:

- if everything goes well, the letter gets queued until it is sent
  by sendmail;

- if viruses are detected, the letter is moved to the archive and
  notifications are sent to the sender and administrator.


        3. Enabling antivirus check

To link up the Dr.Web antivirus daemon you will need to do the
following.

1 - Create a drweb user's budget, not allowing registration in the
    system. The filter will use the budget for safety purposes. It is
    convenient to run the daemon under the name of the same user.

2 - Create a directory (for example /var/spool/drweb) accessible only
    for drweb user and having the read access  only for the user under
    whose name drwebd is executed.

3 - Add the following lines into Postfix master file (master.cf). Its
    location is specified when Postfix is being set up (in place of
    {drweb-directory} insert the path to the drweb-postfix binary):

    if the configuration file is on the path by default:
    
    filter    unix  -   n   n   -   -   pipe
        flags=R user=drweb argv={drweb-directory}/drweb-postfix -f ${sender} -- ${recipient}
    
    or

    filter    unix  -   n   n   -   -   pipe
        flags=R user=drweb argv={drweb-directory}/drweb-postfix --conf={/path/to/your/conf/file} -f ${sender} -- ${recipient}

    Attention: {path/to/conf/file} should contain filename too.

    You should specify -s option for drweb-postfix if you will use
    alternative spool directory (for small files, see also conf_file.txt
    for RamSpool and RamThreshold parameters descriptions). So you
    should define the filter as:

    filter    unix  -   n   n   -   -   pipe
        flags=R user=drweb argv={drweb-directory}/drweb-postfix -s ${size} -f ${sender} -- ${recipient}


4 - Edit the configuration file (see paragraph 4).

5 - Instruct Postfix to check all the letters incoming through
    SMTP. For this you should find the following record in Postfix master
    file (parameters n - n - - may vary):

    smtp          inet  n       -       n       -       -       smtpd 

    and replace it with:

    smtp          inet  n       -       n       -       NN      smtpd -o content_filter=filter:dummy

    (Recommendation: it would be better if NN (the maximum number of
    processes executed by the postfix server) coincides with MaxChildren
    option from drweb32.ini, you may also use - (minus), if you do not
    want to be restricted in such a way.)

6 - Restart Postfix.

NOTE: For more details about filter setup in Postfix please read the
Postfix documentation, i.e. http://www.postfix.org/FILTER_README.html


        4. Settings

The filter parameters are set up in the configuration file. If started
with no parameters the filter is trying to find the configuration file
in standard (for the filter) directories which you can easily find out
by simply starting the filter from the console:

$ drweb-postfix --help

For the description of the filter configuration file, notification
templates and the trusted users list see conf_file.txt, notify.txt and
users_list.txt correspondingly.

To get filter version you can run filter:

$ drweb-postfix --version

To test the correctness of the filter configuration file you can run
filter:

$ drweb-postfix --check_only

or

$ drweb-postfix --check_only --check_user={USER}

The filter will start (drop privilegies to {USER} if --check_user=
specified), read configuration file and test options. Filter will report
on actions made into a standard output stream (stdout).


        5. Contacts

Dr.Web program gets constantly developed, for fresh updating
information and news please visit our site:
  http://www.drweb.com

Marketing dept.: 
  http://buy.drweb.com
  E-Mail: sales@drweb.com

Support:
  http://support.drweb.com
  E-Mail: support@drweb.com

Please include following information in your problem report:

- full name and version of your unix distribution
- Dr.Web version that is logged during program start
- versions of applications and filters which use Dr.Web Daemon.
- configuration files: daemon's (drweb32.ini), drweb_postfix.conf
- logs: daemon and mail (usually maillog)
