#
# Configuration file for amavisd with postfix
#
# Location: /etc
#
# Author: Lars Hecking <lhecking@users.sourceforge.net>
#
# This file is part of the AMaViS package.  For more information see:
#
# http://amavis.org/
#
# Copyright (C) 2001 - 2002 the people mentioned above
#
#
# This software is licensed under the GNU General Public License (GPL)
# See:  http://www.gnu.org/copyleft/gpl.html
#

#
# Part I - Av scanners init section
# 
#
# amavisd (new-20020517) was configured for use with:
# ALL
# NOTE: don't forget to re-run ./configure if you want to use
# another virus scanner!

# NAI AntiVirus (uvscan)
$uvscan = "";

# H+BEDV AntiVir
$antivir = "antivir";

# Sophos Anti Virus (sweep)
$sophos = "";
$sophos_ide_path = "";

# KasperskyLab AntiViral Toolkit Pro (AVP)
$avp = "";
$AVPDIR = dirname($avp);

# KasperskyLab AVPDaemon / AvpDaemonClient
#
# use AvpDaemon and AvpDaemonClient
# Note: AvpDaemon must be started before amavisd!
# AvpDaemon should be started at boot time as AvpDaemon -* /var/amavis
$avpdc = "";

# F-Secure Antivirus
$fsav = "";

# Trend Micro FileScanner
$vscan = "";

# CyberSoft VFind
$vfind = "";

# CAI InoculateIT
$inocucmd = "";

# GeCAD RAV Antivirus 8
$rav = "";

# ESET Software NOD32
$nod32 = "";

# ESET Software NOD32 (Client/Server Version)
$nod32cli = "";

# Command AntiVirus for Linux
$csav = "";

# VirusBuster (Daemon + Client)
$vbengcl = "";

# Symantec CarrierScan via Symantec Command Line Scannner
$cscmdline = "";
$scs_host = "";  # host/IP CarrierScan runs on
$scs_port = "";  # port CarrierScan listens on

# Sophie (Sophos SAVI)
$sophie_sockname = "";

# Trophie (Trend API)
$trophie_sockname = "";

# FRISK F-Prot
$fprot = "";

# FRISK F-Prot Daemon
$fprotd = "";

# Panda Antivirus for Linux
$panda = "";

# CentralCommand Vexira
$vexira = "";

# OpenAntiVirus ScannerDaemon
$oav = "";

# DrWeb Antivirus for Linux/FreeBSD/Solaris
$drweb = "";

# MkS_Vir for Linux (beta)
$mks = "";

# Norman Virus Control 
$norman = "";


#
# Part II - Logging
#

# Create debugging output - yes: log to stderr; no: log to syslog/file
# $DEBUG = "yes";  # uncomment to override the default in amavisd

# yes - syslog, no - file logging
$DO_SYSLOG = "no";

# Directory to put log entries (if not using syslog)
$LOGDIR = "/var/log";
$LOGFILE = "amavis.log";

# 0: startup/exit/failure messages, viruses detected
# 1: args passed from client, some more interesting messages
# 2: virus scanner output, timing
# 3: server client
# 4: decompose parts
$log_level = 0;

# customizeable template for the most interesting (e.g. with $log_level=0)
# log file entry - overrides default.
#   (take care to properly quote Perl special characters like '\')
$log_templ = 'infected ([%V|,]), from=[?%o|(?)|<%o>], to=[<%R>|,][? %q ||, quarantine %i]';


# Net::Server pre-forking settings
# You may want $max_servers to match the width of your MTA pipe
# feeding amavisd, e.g. with Postfix the 'Max procs' field in the
# master.cf file, like the '2' in the:  smtp-amavis unix - - n - 2 smtp
#
$max_servers  =  2;   # number of pre-forked children
$max_requests = 10;   # retire a child after that many accepts

$child_timeout=3*60;  # abort child if it does not complete each task in n sec

#
# Part III - Virus stuff
#

# Notify admin/sender/recipient?
$warnadmin  = "yes";
$warnsender = "yes";
$warnrecip  = "no";

# Notify off-site recipients?
$warn_offsite = "no";

# List of local domains (see README.lookup for syntax)
# (used in warn_recips, and in deciding if address extension can be appended)
# e.g. @local_domains = qw( some.org !outsourced.me.org .me.org );
@local_domains = qw();   # it is safe to leave empty

# who notification reports are sent from
$mailfrom = 'postmaster@rahn-schulen.de';

# who quarantined viruses appear to be sent from (envelope sender)
#$mailfrom_quarantine = $mailfrom;  # same as for notifications
$mailfrom_quarantine = undef;       # use original sender

# whom to send admin virus notifications
# - useful if admin address depends on sender address, e.g. its domain
# (specify lower-cased keys, see README.lookups)
#%mailto = (
# 'baduser@sub1.domain' => 'HisBoss@sub1.domain',
# '.sub1.domain'   => 'virusalert@sub1.domain',
# '.sub2.domain'   => 'postmaster@host.domain',
# 'a.sub3.domain'  => 'abuse@sub3.domain',
# '.sub3.domain'   => 'virusalert@sub3.domain',
# '.domain'        => 'noc@domain',            # catchall for our virus senders
#  '.'             => 'virusalert@hq.domain',  # catchall for the rest
#);

# whom to send admin virus notifications
# - catchall if %mailto lookup hash does not find a match (e.g. it is empty)
#   and for backwards compatibility
$mailto = 'postmaster';

# Location to put infected mail into
# - empty for not quarantining, may be a file (mailbox),
#   or a directory (no trailing slash)
$QUARANTINEDIR = "/var/lib/amavis/virusmails";

# A finer control of quarantining is available through
# variable $virus_quarantine_to as follows:
#
# VARIANT 1:
#   set $virus_quarantine_to empty or undef to disable virus quarantine;
#
# VARIANT 2:
#   set $virus_quarantine_to a string NOT containg an '@';
# amavisd will behave as a local delivery agent (LDA) and will quarantine
# viruses to local files according to hash %local_delivery_aliases (pseudo
# aliases map) - see subroutine mail_to_local_mailbox() for details.
# One of the predefined aliases is 'virus-quarantine'.
# Setting $virus_quarantine_to to this string will:
#
# * if $QUARANTINEDIR is a directory, each quarantined virus will go
#   to a separate file in the $QUARANTINEDIR directory (traditional
#   amavis style, also qmail-compatible mailbox format);
#
# * otherwise $QUARANTINEDIR is treated as a file name of a Unix-style
#   mailbox. All quarantined messages will be appended to this file.
#   Amavisd child process must obtain an exclusive lock on the file during
#   delivery, so this may be less efficient than using individual files
#   or forwarding to MTA, and it may not work across NFS or other non-local
#   file systems (but may be handy for pickup of quarantined files via IMAP
#   for example);
#
# VARIANT 3:
#   set to any email address (must contain '@').
# The e-mail messages to be quarantined will be handed to MTA
# for delivery to the specified address. If a recipient address local to MTA
# is desired, you may leave the domain part empty, e.g. "infected@", but the
# '@' character must nevertheless be included to distinguish it from variant 2.
#
# This method enables more refined delivery control made available by MTA
# (e.g. its aliases file, other local delivery agents, dealing with
# privileges and file locking when delivering to user's mailbox, nonlocal
# delivery and forwarding, fan-out lists). Make sure the mail-to-be-quarantined
# will not be handed back to amavisd for checking, as this will cause a loop
# (hopefully broken by MTA at some stage)! If this can be assured,
# notifications will benefit too from not being unecessarily virus-scanned.
#
# By default this is safe to do with Postfix, but probably not safe
# with sendmail milter interface without precaution.

$virus_quarantine_to  = 'virus-quarantine';    # traditional quarantine style
#$virus_quarantine_to = 'infected@';           # forward to MTA for delivery
#$virus_quarantine_to = 'gallery@some.domain'; # likewise

# similar for spam (if some anti-spam checker is added)
#$spam_quarantine_to  = 'spam-quarantine';

# Add X-Virus-Scanned line to mail?
$X_HEADER_TAG = "X-Virus-Scanned";
# Leave empty to add no header
$X_HEADER_LINE = "by AMaViS new-20020517";

$remove_existing_x_scanned_headers = 0; # leave existing X-Virus-Scanned alone
#$remove_existing_x_scanned_headers= 1; # remove existing headers

# set $bypass_decode_parts to true (e.g. 1) if you have a good virus scanner
# that can deal with compression and recursively unpacking archives by itself,
# and save amavisd the trouble. It is a double-edged sword, make sure you know
# what you are doing!

$bypass_decode_parts = 0;


#
# Part IV - External programs
# (perl modules do not exist for these yet)
#

$arc = "/usr/share/amavis/arc";
$bunzip = "/usr/bin/bunzip2";
$file = "/usr/bin/file";
$lha = "/usr/share/amavis/lha";
$unarj = "/usr/share/amavis/unarj";
$uncompress = "/bin/uncompress";
$unrar = "/usr/bin/unrar";
$zoo = "/usr/bin/zoo";

#
# Part V - MTA specific stuff
#

# Qmail-specific
$QMAILDIR = "/bin";


# SMTP-OUTPUT SETTINGS (only used if &mail_via_smtp method is used,
#   either for notifications, and/or for mail forwarding - see
#   file ./mta/<mta>_init for default settings for your MTA.
#
# Where to deliver notifications via SMTP (and where to forward mail).
# This need not be a local host. Think of it as 'smart host' (sendmail)
# or 'relayhost' (Postfix).
#
$relayhost = "127.0.0.1";     # delivery to this IP unless $relayhost_is_client
$relayhost_port = "10025";    # (same port for all MTAs)

# Setting $relayhost_is_client to true makes SMTP-out method
# connect back to the same IP address as the SMTP-in mail came from;
# otherwise a static IP address $relayhost is used. If the mail did not
# arrive via SMTP-in, the settings has no effect and $relayhost is used.
# This is useful when one or more MTAs from different hosts use the
# same amavisd server. Use @inet_acl to restrict access to authorized MTAs.

$relayhost_is_client = undef;  # always connect to $relayhost (traditional)
# $relayhost_is_client = 1;    # connect back to the SMTP-client IP address


# PIPE-OUTPUT SETTINGS
#
# What sendmail wrapper to use (only used if &mail_via_pipe method is used).
# Where to deliver notifications (and/or where to forward mail).
# The use of -t option in $sendmail_wrapper_args is not recommended.
#
$sendmail_wrapper = "/usr/lib/sendmail";
$sendmail_wrapper_args = "-i";


# AMAVIS-CLIENT PROTOCOL INPUT SETTINGS
#   (used with amavis clients like amavis-milter.c and amavis.c)
$unix_socketname = "/var/run/amavis/amavisd.sock";  # enable traditional amavis client protocol
#$unix_socketname = undef;        # disable listening on a unix socket


# SMTP-INPUT SETTINGS
#   (used when MTA is configured to pass mail to amavisd directly via SMTP)
$inet_socket_port = "10024";      # accept SMTP on this local TCP port
#$inet_socket_port = undef;       # disable listening on TCP port

# SMTP-INPUT access control
# - do not allow free access to the amavisd SMTP port !!!
#
# when MTA is at the same host, use the following (one or the other or both):
$inet_socket_bind = "127.0.0.1";  # limit bind to loopback interface only
@inet_acl = qw( 127.0.0.1 );      # allow SMTP access only from localhost

# when MTA (one or more) is on a different host, use the following
# $inet_socket_bind = undef;      # bind to all IP interfaces
#   (and make sure you set $relayhost_is_client accordingly - see above)
#
# Example1:
# @inet_acl = qw( 127/8 10/8 172.16/12 192.168/16 );
# permit only SMTP access from loopback and rfc1918 private address space
#
# Example2:
# @inet_acl = qw( !192.168.1.12 172.16.3.3 !172.16.3/255.255.255.0
#		  127.0.0.1 10/8 172.16/12 192.168/16 );
# matches loopback and rfc1918 private address space except host 192.168.1.12
# and net 172.16.3/24 (but host 172.16.3.3 within 172.16.3/24 still matches)
#
# Example3:
# @inet_acl = qw( 127/8
#		  !172.16.3.0   !172.16.3.127 172.16.3.0/25
#		  !172.16.3.128 !172.16.3.255 172.16.3.128/25 );
# matches loopback and both halves of the 172.16.3/24 C-class,
# split into two subnets, except all four broadcast addresses
# for these subnets
#
# See README.lookup for details on specifying access control lists.

#
# Part VI - Misc
#

# The next three are resource limitations - cause TEMPFAIL if exceeded
# Maximum recursion level for extraction/decoding
$MAXLEVELS = 20;

# Maximum nesting level for compressing archive formats
$MAX_ARCHIVE_NESTING = 3;

# Maximum number of extracted files
$MAXFILES = 500;

#
# Part VII - ISP features
#

# Here is an overall picture of how pieces fit together:
#
#   bypass_checks? ==> PASS
#   no viruses?    ==> PASS
#   log virus     if $log_templ is nonempty
#   quarantine    if $virus_quarantine_to is nonempty
#   notify admin  if $warnadmin
#   notify sender if $warnsender
#   notify recips if $warnrecip
#   final_destiny==pass?  ==> PASS
#   virus_lovers?         ==> PASS
#   DISCARD or REJECT (depending on final_*_destiny)

$final_virus_destiny =  0;  # -1=reject, 0=discard, 1=pass
$final_spam_destiny  = -1;  # -1=reject, 0=discard, 1=pass

# Exclude certain recipients from virus filtering by adding their lower-cased
# e-mail address (or domain only) to the hash %virus_lovers, or to the
# access list @virus_lovers_acl - see README.lookup and examples at subroutines
# lookup_hash() and lookup_acl(). Make sure the appropriate form (e.g.
# external/internal) of address is used in case of virtual domains, or when
# mapping external to internal addresses, etc. - this is MTA dependent.
#
# Notifications would still be generated however, and infected mail
# (if passed) gets additional header:
#   X-AMaViS-Alert: INFECTED, message contains virus: ...
# (header not inserted with milter interface!)
#
# NOTE (milter interface only): in case of multiple recipients,
# it is only possible to drop or accept the message in its entirety - for all
# recipients. If all of them are virus lovers, we'll accept mail, but if
# at least one recipient is not a virus lover, we'll discard the message.
#
# Similar in concept to %virus_lovers, a hash %bypass_checks, and access list
# @bypass_checks_acl are used to skip entirely the decoding, unpacking
# and virus checking, but only if ALL mail recipients are members of the
# hash %bypass_checks or match the list @bypass_checks_acl.
# This is mainly a time-saving option.
#
# %bypass_checks/@bypass_checks_acl does NOT GUARANTEE the message
# will NOT be checked for viruses - this may still happen when there is
# more than one recipient for a message, and not all of them match
# %bypass_checks/@bypass_checks_acl. To guarantee virus delivery
# (but see milter limitations above), a recipient must also match
# %virus_lovers/@virus_lovers_acl.

# NOTE: it would not be clever to base this check on SENDER address,
# since there are no guarantees that it is genuine. Many viruses
# and spam messages fake sender address. To achieve selective filtering
# based on the source of the mail (e.g. IP address, MTA port number, ...),
# use mechanisms provided by MTA if available.

# See README.lookups for further detail.

# Hashes for many entries are faster but more limited, acl is more general
# but can be slower if list is long.
#
# Hash lookups (e.g. for user+foo@domain) are performed in the
# following sequence:
#  - hash lookup for user+foo@do.ma.in
#  - hash lookup for user@do.ma.in  (only if $recipient_delimiter is nonempty)
#  - hash lookup for do.ma.in
#  - hash lookup for .do.ma.in
#  - hash lookup for .ma.in
#  - hash lookup for .in
#  - hash lookup for .
#  - hash lookup user+foo@
#  - hash lookup user@  (only if $recipient_delimiter is nonempty)

# @virus_lovers_acl = qw( me@lab.xxx.com !lab.xxx.com .xxx.com yyy.org );
# $virus_lovers{lc('abuse@domain')} = 1;
# $virus_lovers{lc('postmaster@domain')} = 1;
# $virus_lovers{lc('some.user@')} = 1;  # this user, regardless of domain
# $virus_lovers{lc('boss@domain')} = 0; # never, even if domain matches
# $virus_lovers{lc('domain')} = 1;      # this domain (but not its subdomains)
#
# $bypass_checks{lc('some.user2@butnot.some.sub.dom')} = 1;
# @bypass_checks_acl = qw( some.ddd !butnot.some.sub.dom .some.sub.dom );

# If you decide to pass viruses (or spam) to certain users using
# %virus_lovers/@virus_lovers_acl, (%spam_lovers/@spam_lovers_acl),
# %bypass_checks/@bypass_checks_acl, or $final_virus_destiny=1,
# you can set the variable $addr_extension_virus ($addr_extension_spam)
# to some string, and the recipient address will have this string appended
# as an address extension to the local-part of the address. This extension
# can be used by final local delivery agent to place such mail in different
# folders. Leave these two variables undefined or empty strings to prevent
# appending address extensions. Setting has no effect on users which will
# not be receiving viruses. Recipients who do not match access list
# @local_domains are not affected.
#
# LDAs usually default to stripping away address extension if no special
# handling for it is specified, so having this option enabled normally
# does no harm, provided the $recipients_delimiter matches the setting
# on the final MTA's LDA.

# $addr_extension_virus = undef;
# $addr_extension_spam  = undef;
#
$addr_extension_virus = 'virus';
$addr_extension_spam  = 'spam';


# Delimiter between local part of the recipient address and address extension
# (which can optionally be added, see variables $addr_extension_virus and
# $addr_extension_spam). E.g. recipient address <user@domain> gets changed
# to <user+virus@domain>.
#
# Delimiter should match equivalent (final) MTA delimiter setting.
# (e.g. for Postfix add 'recipient_delimiter = +' to main.cf)

$recipient_delimiter = '+';


# SMTP sender whitelist ACL to bypass spam checking: %whitelist_sender, @whitelist_sender

map { $whitelist_sender{lc($_)}=1 } (qw(
  cert-advisory-owner@cert.org
  owner-alert@iss.net
  slashdot@slashdot.org
  bugtraq@securityfocus.com
  NTBUGTRAQ@LISTSERV.NTBUGTRAQ.COM
  security-alerts@linuxsecurity.com
  amavis-user-admin@lists.sourceforge.net
  razor-users-admin@lists.sourceforge.net
  notification-return@lists.sophos.com
  mailman-announce-admin@python.org
  zope-announce-admin@zope.org
  owner-postfix-users@postfix.org
  owner-postfix-announce@postfix.org
  owner-sendmail-announce@Lists.Sendmail.ORG
  owner-technews@postel.ACM.ORG
  lvs-users-admin@LinuxVirtualServer.org
  ietf-123-owner@loki.ietf.org
  cvs-commits-list-admin@gnome.org
));
