Marius Burkard
2016-07-10 58b8f2bf6dbed7a63150f35e6e3b9fe835ce98ac
commit | author | age
7d89f5 1 use strict;
T 2
3 # a minimalistic configuration file for amavisd-new with all necessary settings
4 #
5 #   see amavisd.conf-default for a list of all variables with their defaults;
6 #   see amavisd.conf-sample for a traditional-style commented file;
7 #   for more details see documentation in INSTALL, README_FILES/*
8 #   and at http://www.ijs.si/software/amavisd/amavisd-new-docs.html
9
10
11 # COMMONLY ADJUSTED SETTINGS:
12
13 # @bypass_virus_checks_maps = (1);  # controls running of anti-virus code
14 # @bypass_spam_checks_maps  = (1);  # controls running of anti-spam code
15 # $bypass_decode_parts = 1;         # controls running of decoders&dearchivers
16
17 $max_servers = 2;            # num of pre-forked children (2..15 is common), -m
18 $daemon_user  = 'vscan';     # (no default;  customary: vscan or amavis), -u
19 $daemon_group = 'vscan';     # (no default;  customary: vscan or amavis), -g
20
21 $mydomain = 'site';   # a convenient default for other settings
22
23 $MYHOME = '/var/spool/amavis';   # a convenient default for other settings, -H
24 $TEMPBASE = "$MYHOME/tmp";   # working directory, needs to exist, -T
25 $ENV{TMPDIR} = $TEMPBASE;    # environment variable TMPDIR, used by SA, etc.
26 $QUARANTINEDIR = '/var/spool/amavis/virusmails';  # -Q
27 # $quarantine_subdir_levels = 1;  # add level of subdirs to disperse quarantine
28
29 # $daemon_chroot_dir = $MYHOME;   # chroot directory or undef, -R
30
31 # $db_home   = "$MYHOME/db";      # dir for bdb nanny/cache/snmp databases, -D
32 # $helpers_home = "$MYHOME/var";  # working directory for SpamAssassin, -S
33 # $lock_file = "$MYHOME/var/amavisd.lock";  # -L
34 # $pid_file  = "$MYHOME/var/amavisd.pid";   # -P
35 #NOTE: create directories $MYHOME/tmp, $MYHOME/var, $MYHOME/db manually
36
37 $log_level = 0;              # verbosity 0..5, -d
38 $log_recip_templ = undef;    # disable by-recipient level-0 log entries
39 $DO_SYSLOG = 1;              # log via syslogd (preferred)
40 $syslog_facility = 'mail';   # Syslog facility as a string
41            # e.g.: mail, daemon, user, local0, ... local7
42 $syslog_priority = 'debug';  # Syslog base (minimal) priority as a string,
43            # choose from: emerg, alert, crit, err, warning, notice, info, debug
44
45 $enable_db = 1;              # enable use of BerkeleyDB/libdb (SNMP and nanny)
46 $enable_global_cache = 1;    # enable use of libdb-based cache if $enable_db=1
47 $nanny_details_level = 2;    # nanny verbosity: 1: traditional, 2: detailed
48
49 @local_domains_maps = ( [".$mydomain"] );  # list of all local domains
50
b1ae8f 51 @mynetworks = qw( 0.0.0.0/8 127.0.0.0/8 [::1] [FE80::]/10 [FEC0::]/10
7d89f5 52                   10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 );
T 53
54 $unix_socketname = "$MYHOME/amavisd.sock";  # amavisd-release or amavis-milter
55                # option(s) -p overrides $inet_socket_port and $unix_socketname
56
b1ae8f 57 #$inet_socket_port = 10024;   # listen on this local TCP port(s)
FS 58 $inet_socket_port = [10024,10026];  # listen on multiple TCP ports
7d89f5 59
T 60 $policy_bank{'MYNETS'} = {   # mail originating from @mynetworks
61   originating => 1,  # is true in MYNETS by default, but let's make it explicit
62   os_fingerprint_method => undef,  # don't query p0f for internal clients
63 };
64
65 # it is up to MTA to re-route mail from authenticated roaming users or
66 # from internal hosts to a dedicated TCP port (such as 10026) for filtering
67 $interface_policy{'10026'} = 'ORIGINATING';
68
69 $policy_bank{'ORIGINATING'} = {  # mail supposedly originating from our users
70   originating => 1,  # declare that mail was submitted by our smtp client
71   allow_disclaimers => 1,  # enables disclaimer insertion if available
72   # notify administrator of locally originating malware
73   virus_admin_maps => ["virusalert\@$mydomain"],
74   spam_admin_maps  => ["virusalert\@$mydomain"],
75   warnbadhsender   => 1,
76   # forward to a smtpd service providing DKIM signing service
77   forward_method => 'smtp:[127.0.0.1]:10027',
78   # force MTA conversion to 7-bit (e.g. before DKIM signing)
79   smtpd_discard_ehlo_keywords => ['8BITMIME'],
80   bypass_banned_checks_maps => [1],  # allow sending any file names and types
81   terminate_dsn_on_notify_success => 0,  # don't remove NOTIFY=SUCCESS option 
82 };
83
84 $interface_policy{'SOCK'} = 'AM.PDP-SOCK'; # only applies with $unix_socketname
85
86 # Use with amavis-release over a socket or with Petr Rehor's amavis-milter.c
87 # (with amavis-milter.c from this package or old amavis.c client use 'AM.CL'):
88 $policy_bank{'AM.PDP-SOCK'} = {
89   protocol => 'AM.PDP',
90   auth_required_release => 0,  # do not require secret_id for amavisd-release
91 };
92
93 $sa_tag_level_deflt  = 2.0;  # add spam info headers if at, or above that level
94 $sa_tag2_level_deflt = 6.31; # add 'spam detected' headers at that level
95 $sa_kill_level_deflt = 6.31; # triggers spam evasive actions
96 $sa_dsn_cutoff_level = 10;   # spam level beyond which a DSN is not sent
97 # $sa_quarantine_cutoff_level = 20; # spam level beyond which quarantine is off
98 # $penpals_bonus_score = 5;  # (no effect without a @storage_sql_dsn database)
99 # $penpals_threshold_high = $sa_kill_level_deflt; # don't waste time on hi spam
100
101 $sa_mail_body_size_limit = 400*1024; # don't waste time on SA if mail is larger
102 $sa_local_tests_only = 0;    # only tests which do not require internet access?
103
104 # @lookup_sql_dsn =
105 #   ( ['DBI:mysql:database=mail;host=127.0.0.1;port=3306', 'user1', 'passwd1'],
106 #     ['DBI:mysql:database=mail;host=host2', 'username2', 'password2'],
107 #     ["DBI:SQLite:dbname=$MYHOME/sql/mail_prefs.sqlite", '', ''] );
108 # @storage_sql_dsn = @lookup_sql_dsn;  # none, same, or separate database
109
110 # $timestamp_fmt_mysql = 1; # if using MySQL *and* msgs.time_iso is TIMESTAMP;
111 #   defaults to 0, which is good for non-MySQL or if msgs.time_iso is CHAR(16)
112
113 $virus_admin               = "virusalert\@$mydomain";  # notifications recip.
114
115 $mailfrom_notify_admin     = "virusalert\@$mydomain";  # notifications sender
116 $mailfrom_notify_recip     = "virusalert\@$mydomain";  # notifications sender
117 $mailfrom_notify_spamadmin = "spam.police\@$mydomain"; # notifications sender
118 $mailfrom_to_quarantine = ''; # null return path; uses original sender if undef
119
120 @addr_extension_virus_maps      = ('virus');
121 @addr_extension_banned_maps     = ('banned');
122 @addr_extension_spam_maps       = ('spam');
123 @addr_extension_bad_header_maps = ('badh');
124 # $recipient_delimiter = '+';  # undef disables address extensions altogether
125 # when enabling addr extensions do also Postfix/main.cf: recipient_delimiter=+
126
127 $path = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/usr/bin:/bin';
128 # $dspam = 'dspam';
129
130 $MAXLEVELS = 14;
131 $MAXFILES = 1500;
132 $MIN_EXPANSION_QUOTA =      100*1024;  # bytes  (default undef, not enforced)
133 $MAX_EXPANSION_QUOTA = 300*1024*1024;  # bytes  (default undef, not enforced)
134
135 $sa_spam_subject_tag = '***SPAM*** ';
136 $defang_virus  = 1;  # MIME-wrap passed infected mail
137 $defang_banned = 1;  # MIME-wrap passed mail containing banned name
138 # for defanging bad headers only turn on certain minor contents categories:
139 $defang_by_ccat{+CC_BADH.",3"} = 1;  # NUL or CR character in header
140 $defang_by_ccat{+CC_BADH.",5"} = 1;  # header line longer than 998 characters
141 $defang_by_ccat{+CC_BADH.",6"} = 1;  # header field syntax error
142
143
144 # OTHER MORE COMMON SETTINGS (defaults may suffice):
145
146 $myhostname = 'linux-jfp8.site';
147
58b8f2 148 $notify_method  = 'smtp:127.0.0.1:*';
MB 149 $forward_method = 'smtp:127.0.0.1:*';  # set to undef with milter!
7d89f5 150
T 151 # $final_virus_destiny      = D_DISCARD;
152 # $final_banned_destiny     = D_BOUNCE;
153 # $final_spam_destiny       = D_BOUNCE;
154 # $final_bad_header_destiny = D_PASS;
155
156 # $os_fingerprint_method = 'p0f:127.0.0.1:2345';  # to query p0f-analyzer.pl
157
158 ## hierarchy by which a final setting is chosen:
159 ##   policy bank (based on port or IP address) -> *_by_ccat
160 ##   *_by_ccat (based on mail contents) -> *_maps
161 ##   *_maps (based on recipient address) -> final configuration value
162
163
164 # SOME OTHER VARIABLES WORTH CONSIDERING (see amavisd.conf-default for all)
165
166 # $warnbadhsender,
167 # $warnvirusrecip, $warnbannedrecip, $warnbadhrecip, (or @warn*recip_maps)
168 #
169 # @bypass_virus_checks_maps, @bypass_spam_checks_maps,
170 # @bypass_banned_checks_maps, @bypass_header_checks_maps,
171 #
172 # @virus_lovers_maps, @spam_lovers_maps,
173 # @banned_files_lovers_maps, @bad_header_lovers_maps,
174 #
175 # @blacklist_sender_maps, @score_sender_maps,
176 #
177 # $clean_quarantine_method, $virus_quarantine_to, $banned_quarantine_to,
178 # $bad_header_quarantine_to, $spam_quarantine_to,
179 #
180 # $defang_bad_header, $defang_undecipherable, $defang_spam
181
182
183 # REMAINING IMPORTANT VARIABLES ARE LISTED HERE BECAUSE OF LONGER ASSIGNMENTS
184
185 @keep_decoded_original_maps = (new_RE(
186 # qr'^MAIL$',   # retain full original message for virus checking (can be slow)
187   qr'^MAIL-UNDECIPHERABLE$', # recheck full mail if it contains undecipherables
188   qr'^(ASCII(?! cpio)|text|uuencoded|xxencoded|binhex)'i,
189 # qr'^Zip archive data',     # don't trust Archive::Zip
190 ));
191
192
193 # for $banned_namepath_re (a new-style of banned table) see amavisd.conf-sample
194
195 $banned_filename_re = new_RE(
196
197 ### BLOCKED ANYWHERE
198 # qr'^UNDECIPHERABLE$',  # is or contains any undecipherable components
199   qr'^\.(exe-ms|dll)$',                   # banned file(1) types, rudimentary
200 # qr'^\.(exe|lha|tnef|cab|dll)$',         # banned file(1) types
201
202 ### BLOCK THE FOLLOWING, EXCEPT WITHIN UNIX ARHIVES:
203 # [ qr'^\.(gz|bz2)$'             => 0 ],  # allow any in gzip or bzip2
204   [ qr'^\.(rpm|cpio|tar)$'       => 0 ],  # allow any in Unix-type archives
205
206   qr'.\.(pif|scr)$'i,                     # banned extensions - rudimentary
207 # qr'^\.zip$',                            # block zip type
208
209 ### BLOCK THE FOLLOWING, EXCEPT WITHIN ARHIVES:
210 # [ qr'^\.(zip|rar|arc|arj|zoo)$'=> 0 ],  # allow any within these archives
211
212   qr'^application/x-msdownload$'i,        # block these MIME types
213   qr'^application/x-msdos-program$'i,
214   qr'^application/hta$'i,
215
216 # qr'^message/partial$'i,         # rfc2046 MIME type
217 # qr'^message/external-body$'i,   # rfc2046 MIME type
218
219 # qr'^(application/x-msmetafile|image/x-wmf)$'i,  # Windows Metafile MIME type
220 # qr'^\.wmf$',                            # Windows Metafile file(1) type
221
222   # block certain double extensions in filenames
223   qr'\.[^./]*[A-Za-z][^./]*\.\s*(exe|vbs|pif|scr|bat|cmd|com|cpl|dll)[.\s]*$'i,
224
225 # qr'\{[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}\}?'i, # Class ID CLSID, strict
226 # qr'\{[0-9a-z]{4,}(-[0-9a-z]{4,}){0,7}\}?'i, # Class ID extension CLSID, loose
227
228   qr'.\.(exe|vbs|pif|scr|cpl)$'i,             # banned extension - basic
229 # qr'.\.(exe|vbs|pif|scr|cpl|bat|cmd|com)$'i, # banned extension - basic+cmd
230 # qr'.\.(ade|adp|app|bas|bat|chm|cmd|com|cpl|crt|emf|exe|fxp|grp|hlp|hta|
231 #        inf|ins|isp|js|jse|lnk|mda|mdb|mde|mdw|mdt|mdz|msc|msi|msp|mst|
232 #        ops|pcd|pif|prg|reg|scr|sct|shb|shs|vb|vbe|vbs|
233 #        wmf|wsc|wsf|wsh)$'ix,  # banned ext - long
234 # qr'.\.(ani|cur|ico)$'i,                 # banned cursors and icons filename
235 # qr'^\.ani$',                            # banned animated cursor file(1) type
236
237 # qr'.\.(mim|b64|bhx|hqx|xxe|uu|uue)$'i,  # banned extension - WinZip vulnerab.
238 );
239 # See http://support.microsoft.com/default.aspx?scid=kb;EN-US;q262631
240 # and http://www.cknow.com/vtutor/vtextensions.htm
241
242
243 # ENVELOPE SENDER SOFT-WHITELISTING / SOFT-BLACKLISTING
244
245 @score_sender_maps = ({ # a by-recipient hash lookup table,
246                         # results from all matching recipient tables are summed
247
248 # ## per-recipient personal tables  (NOTE: positive: black, negative: white)
249 # 'user1@example.com'  => [{'bla-mobile.press@example.com' => 10.0}],
250 # 'user3@example.com'  => [{'.ebay.com'                 => -3.0}],
251 # 'user4@example.com'  => [{'cleargreen@cleargreen.com' => -7.0,
252 #                           '.cleargreen.com'           => -5.0}],
253
254   ## site-wide opinions about senders (the '.' matches any recipient)
255   '.' => [  # the _first_ matching sender determines the score boost
256
257    new_RE(  # regexp-type lookup table, just happens to be all soft-blacklist
258     [qr'^(bulkmail|offers|cheapbenefits|earnmoney|foryou)@'i         => 5.0],
259     [qr'^(greatcasino|investments|lose_weight_today|market\.alert)@'i=> 5.0],
260     [qr'^(money2you|MyGreenCard|new\.tld\.registry|opt-out|opt-in)@'i=> 5.0],
261     [qr'^(optin|saveonlsmoking2002k|specialoffer|specialoffers)@'i   => 5.0],
262     [qr'^(stockalert|stopsnoring|wantsome|workathome|yesitsfree)@'i  => 5.0],
263     [qr'^(your_friend|greatoffers)@'i                                => 5.0],
264     [qr'^(inkjetplanet|marketopt|MakeMoney)\d*@'i                    => 5.0],
265    ),
266
267 #  read_hash("/var/amavis/sender_scores_sitewide"),
268
269    { # a hash-type lookup table (associative array)
270      'nobody@cert.org'                        => -3.0,
271      'cert-advisory@us-cert.gov'              => -3.0,
272      'owner-alert@iss.net'                    => -3.0,
273      'slashdot@slashdot.org'                  => -3.0,
274      'securityfocus.com'                      => -3.0,
275      'ntbugtraq@listserv.ntbugtraq.com'       => -3.0,
276      'security-alerts@linuxsecurity.com'      => -3.0,
277      'mailman-announce-admin@python.org'      => -3.0,
278      'amavis-user-admin@lists.sourceforge.net'=> -3.0,
279      'amavis-user-bounces@lists.sourceforge.net' => -3.0,
280      'spamassassin.apache.org'                => -3.0,
281      'notification-return@lists.sophos.com'   => -3.0,
282      'owner-postfix-users@postfix.org'        => -3.0,
283      'owner-postfix-announce@postfix.org'     => -3.0,
284      'owner-sendmail-announce@lists.sendmail.org'   => -3.0,
285      'sendmail-announce-request@lists.sendmail.org' => -3.0,
286      'donotreply@sendmail.org'                => -3.0,
287      'ca+envelope@sendmail.org'               => -3.0,
288      'noreply@freshmeat.net'                  => -3.0,
289      'owner-technews@postel.acm.org'          => -3.0,
290      'ietf-123-owner@loki.ietf.org'           => -3.0,
291      'cvs-commits-list-admin@gnome.org'       => -3.0,
292      'rt-users-admin@lists.fsck.com'          => -3.0,
293      'clp-request@comp.nus.edu.sg'            => -3.0,
294      'surveys-errors@lists.nua.ie'            => -3.0,
295      'emailnews@genomeweb.com'                => -5.0,
296      'yahoo-dev-null@yahoo-inc.com'           => -3.0,
297      'returns.groups.yahoo.com'               => -3.0,
298      'clusternews@linuxnetworx.com'           => -3.0,
299      lc('lvs-users-admin@LinuxVirtualServer.org')    => -3.0,
300      lc('owner-textbreakingnews@CNNIMAIL12.CNN.COM') => -5.0,
301
302      # soft-blacklisting (positive score)
303      'sender@example.net'                     =>  3.0,
304      '.example.net'                           =>  1.0,
305
306    },
307   ],  # end of site-wide tables
308 });
309
310
311 @decoders = (
312   ['mail', \&do_mime_decode],
313   ['asc',  \&do_ascii],
314   ['uue',  \&do_ascii],
315   ['hqx',  \&do_ascii],
316   ['ync',  \&do_ascii],
317   ['F',    \&do_uncompress, ['unfreeze','freeze -d','melt','fcat'] ],
318   ['Z',    \&do_uncompress, ['uncompress','gzip -d','zcat'] ],
319   ['gz',   \&do_uncompress,  'gzip -d'],
320   ['gz',   \&do_gunzip],
321   ['bz2',  \&do_uncompress,  'bzip2 -d'],
322   ['lzo',  \&do_uncompress,  'lzop -d'],
323   ['rpm',  \&do_uncompress, ['rpm2cpio.pl','rpm2cpio'] ],
324   ['cpio', \&do_pax_cpio,   ['pax','gcpio','cpio'] ],
325   ['tar',  \&do_pax_cpio,   ['pax','gcpio','cpio'] ],
326   ['deb',  \&do_ar,          'ar'],
327 # ['a',    \&do_ar,          'ar'],  # unpacking .a seems an overkill
328   ['zip',  \&do_unzip],
329   ['7z',   \&do_7zip,       ['7zr','7za','7z'] ],
330   ['rar',  \&do_unrar,      ['rar','unrar'] ],
331   ['arj',  \&do_unarj,      ['arj','unarj'] ],
332   ['arc',  \&do_arc,        ['nomarch','arc'] ],
333   ['zoo',  \&do_zoo,        ['zoo','unzoo'] ],
334   ['lha',  \&do_lha,         'lha'],
335 # ['doc',  \&do_ole,         'ripole'],
336   ['cab',  \&do_cabextract,  'cabextract'],
337   ['tnef', \&do_tnef_ext,    'tnef'],
338   ['tnef', \&do_tnef],
339 # ['sit',  \&do_unstuff,     'unstuff'],  # broken/unsafe decoder
340   ['exe',  \&do_executable, ['rar','unrar'], 'lha', ['arj','unarj'] ],
341 );
342
343
344 @av_scanners = (
345
346 # ### http://www.clanfield.info/sophie/ (http://www.vanja.com/tools/sophie/)
347 # ['Sophie',
348 #   \&ask_daemon, ["{}/\n", '/var/run/sophie'],
349 #   qr/(?x)^ 0+ ( : | [\000\r\n]* $)/,  qr/(?x)^ 1 ( : | [\000\r\n]* $)/,
350 #   qr/(?x)^ [-+]? \d+ : (.*?) [\000\r\n]* $/ ],
351
352 # ### http://www.csupomona.edu/~henson/www/projects/SAVI-Perl/
353 # ['Sophos SAVI', \&sophos_savi ],
354
355  ### http://www.clamav.net/
356  ['ClamAV-clamd',
357    \&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd"],
358    qr/\bOK$/, qr/\bFOUND$/,
359    qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],
360  # NOTE: run clamd under the same user as amavisd, or run it under its own
361  #   uid such as clamav, add user clamav to the amavis group, and then add
362  #   AllowSupplementaryGroups to clamd.conf;
363  # NOTE: match socket name (LocalSocket) in clamav.conf to the socket name in
364  #   this entry; when running chrooted one may prefer socket "$MYHOME/clamd".
365
366 # ### http://www.clamav.net/ and CPAN  (memory-hungry! clamd is preferred)
367 # # note that Mail::ClamAV requires perl to be build with threading!
368 # ['Mail::ClamAV', \&ask_clamav, "*", [0], [1], qr/^INFECTED: (.+)/],
369
370 # ### http://www.openantivirus.org/
371 # ['OpenAntiVirus ScannerDaemon (OAV)',
372 #   \&ask_daemon, ["SCAN {}\n", '127.0.0.1:8127'],
373 #   qr/^OK/, qr/^FOUND: /, qr/^FOUND: (.+)/ ],
374
375 # ### http://www.vanja.com/tools/trophie/
376 # ['Trophie',
377 #   \&ask_daemon, ["{}/\n", '/var/run/trophie'],
378 #   qr/(?x)^ 0+ ( : | [\000\r\n]* $)/,  qr/(?x)^ 1 ( : | [\000\r\n]* $)/,
379 #   qr/(?x)^ [-+]? \d+ : (.*?) [\000\r\n]* $/ ],
380
381 # ### http://www.grisoft.com/
382 # ['AVG Anti-Virus',
383 #   \&ask_daemon, ["SCAN {}\n", '127.0.0.1:55555'],
384 #   qr/^200/, qr/^403/, qr/^403 .*?: ([^\r\n]+)/ ],
385
386 # ### http://www.f-prot.com/
387 # ['FRISK F-Prot Daemon',
388 #   \&ask_daemon,
389 #   ["GET {}/*?-dumb%20-archive%20-packed HTTP/1.0\r\n\r\n",
390 #     ['127.0.0.1:10200','127.0.0.1:10201','127.0.0.1:10202',
391 #      '127.0.0.1:10203','127.0.0.1:10204'] ],
392 #   qr/(?i)<summary[^>]*>clean<\/summary>/,
393 #   qr/(?i)<summary[^>]*>infected<\/summary>/,
394 #   qr/(?i)<name>(.+)<\/name>/ ],
395
396 # ### http://www.sald.com/, http://www.dials.ru/english/, http://www.drweb.ru/
397 # ['DrWebD', \&ask_daemon,   # DrWebD 4.31 or later
398 #   [pack('N',1).  # DRWEBD_SCAN_CMD
399 #    pack('N',0x00280001).   # DONT_CHANGEMAIL, IS_MAIL, RETURN_VIRUSES
400 #    pack('N',     # path length
401 #      length("$TEMPBASE/amavis-yyyymmddTHHMMSS-xxxxx/parts/pxxx")).
402 #    '{}/*'.       # path
403 #    pack('N',0).  # content size
404 #    pack('N',0),
405 #    '/var/drweb/run/drwebd.sock',
406 #  # '/var/amavis/var/run/drwebd.sock',   # suitable for chroot
407 #  # '/usr/local/drweb/run/drwebd.sock',  # FreeBSD drweb ports default
408 #  # '127.0.0.1:3000',                    # or over an inet socket
409 #   ],
410 #   qr/\A\x00[\x10\x11][\x00\x10]\x00/s,         # IS_CLEAN,EVAL_KEY; SKIPPED
411 #   qr/\A\x00[\x00\x01][\x00\x10][\x20\x40\x80]/s, # KNOWN_V,UNKNOWN_V,V._MODIF
412 #   qr/\A.{12}(?:infected with )?([^\x00]+)\x00/s,
413 # ],
414 # # NOTE: If using amavis-milter, change length to:
415 # # length("$TEMPBASE/amavis-milter-xxxxxxxxxxxxxx/parts/pxxx").
416
417   ### http://www.kaspersky.com/  (kav4mailservers)
418   ['KasperskyLab AVP - aveclient',
419     ['/usr/local/kav/bin/aveclient','/usr/local/share/kav/bin/aveclient',
420      '/opt/kav/5.5/kav4mailservers/bin/aveclient','aveclient'],
421     '-p /var/run/aveserver -s {}/*',
422     [0,3,6,8], qr/\b(INFECTED|SUSPICION|SUSPICIOUS)\b/,
423     qr/(?:INFECTED|WARNING|SUSPICION|SUSPICIOUS) (.+)/,
424   ],
425   # NOTE: one may prefer [0],[2,3,4,5], depending on how suspicious,
426   # currupted or protected archives are to be handled
427
428   ### http://www.kaspersky.com/
429   ['KasperskyLab AntiViral Toolkit Pro (AVP)', ['avp'],
430     '-* -P -B -Y -O- {}', [0,3,6,8], [2,4],    # any use for -A -K   ?
431     qr/infected: (.+)/,
432     sub {chdir('/opt/AVP') or die "Can't chdir to AVP: $!"},
433     sub {chdir($TEMPBASE) or die "Can't chdir back to $TEMPBASE $!"},
434   ],
435
436   ### The kavdaemon and AVPDaemonClient have been removed from Kasperky
437   ### products and replaced by aveserver and aveclient
438   ['KasperskyLab AVPDaemonClient',
439     [ '/opt/AVP/kavdaemon',       'kavdaemon',
440       '/opt/AVP/AvpDaemonClient', 'AvpDaemonClient',
441       '/opt/AVP/AvpTeamDream',    'AvpTeamDream',
442       '/opt/AVP/avpdc', 'avpdc' ],
443     "-f=$TEMPBASE {}", [0,8], [3,4,5,6], qr/infected: ([^\r\n]+)/ ],
444     # change the startup-script in /etc/init.d/kavd to:
445     #   DPARMS="-* -Y -dl -f=/var/amavis /var/amavis"
446     #   (or perhaps:   DPARMS="-I0 -Y -* /var/amavis" )
447     # adjusting /var/amavis above to match your $TEMPBASE.
448     # The '-f=/var/amavis' is needed if not running it as root, so it
449     # can find, read, and write its pid file, etc., see 'man kavdaemon'.
450     # defUnix.prf: there must be an entry "*/var/amavis" (or whatever
451     #   directory $TEMPBASE specifies) in the 'Names=' section.
452     # cd /opt/AVP/DaemonClients; configure; cd Sample; make
453     # cp AvpDaemonClient /opt/AVP/
454     # su - vscan -c "${PREFIX}/kavdaemon ${DPARMS}"
455
456   ### http://www.centralcommand.com/
457   ['CentralCommand Vexira (new) vascan',
458     ['vascan','/usr/lib/Vexira/vascan'],
459     "-a s --timeout=60 --temp=$TEMPBASE -y $QUARANTINEDIR ".
460     "--log=/var/log/vascan.log {}",
461     [0,3], [1,2,5],
462     qr/(?x)^\s* (?:virus|iworm|macro|mutant|sequence|trojan)\ found:\ ( [^\]\s']+ )\ \.\.\.\ / ],
463     # Adjust the path of the binary and the virus database as needed.
464     # 'vascan' does not allow to have the temp directory to be the same as
465     # the quarantine directory, and the quarantine option can not be disabled.
466     # If $QUARANTINEDIR is not used, then another directory must be specified
467     # to appease 'vascan'. Move status 3 to the second list if password
468     # protected files are to be considered infected.
469
470   ### http://www.avira.com/
471   ### Avira AntiVir (formerly H+BEDV) or (old) CentralCommand Vexira Antivirus
472   ['Avira AntiVir', ['antivir','vexira'],
473     '--allfiles -noboot -nombr -rs -s -z {}', [0], qr/ALERT:|VIRUS:/,
474     qr/(?x)^\s* (?: ALERT: \s* (?: \[ | [^']* ' ) |
475          (?i) VIRUS:\ .*?\ virus\ '?) ( [^\]\s']+ )/ ],
476     # NOTE: if you only have a demo version, remove -z and add 214, as in:
477     #  '--allfiles -noboot -nombr -rs -s {}', [0,214], qr/ALERT:|VIRUS:/,
478
479   ### http://www.commandsoftware.com/
480   ['Command AntiVirus for Linux', 'csav',
481     '-all -archive -packed {}', [50], [51,52,53],
482     qr/Infection: (.+)/ ],
483
484   ### http://www.symantec.com/
485   ['Symantec CarrierScan via Symantec CommandLineScanner',
486     'cscmdline', '-a scan -i 1 -v -s 127.0.0.1:7777 {}',
487     qr/^Files Infected:\s+0$/, qr/^Infected\b/,
488     qr/^(?:Info|Virus Name):\s+(.+)/ ],
489
490   ### http://www.symantec.com/
491   ['Symantec AntiVirus Scan Engine',
492     'savsecls', '-server 127.0.0.1:7777 -mode scanrepair -details -verbose {}',
493     [0], qr/^Infected\b/,
494     qr/^(?:Info|Virus Name):\s+(.+)/ ],
495     # NOTE: check options and patterns to see which entry better applies
496
497   ### http://www.f-secure.com/products/anti-virus/  version 4.65
498    ['F-Secure Antivirus for Linux servers',
499     ['/opt/f-secure/fsav/bin/fsav', 'fsav'],
500     '--delete=no --disinf=no --rename=no --archive=yes --auto=yes '.
501     '--dumb=yes --list=no --mime=yes {}', [0], [3,6,8],
502     qr/(?:infection|Infected|Suspected): (.+)/ ],
503
504 # ### http://www.avast.com/
505 # ['avast! Antivirus daemon',
506 #   \&ask_daemon,    # greets with 220, terminate with QUIT
507 #   ["SCAN {}\015\012QUIT\015\012", '/var/run/avast4/mailscanner.sock'],
508 #   qr/\t\[\+\]/, qr/\t\[L\]\t/, qr/\t\[L\]\t([^[ \t\015\012]+)/ ],
509
510 # ### http://www.avast.com/
511 # ['avast! Antivirus - Client/Server Version', 'avastlite',
512 #   '-a /var/run/avast4/mailscanner.sock -n {}', [0], [1],
513 #   qr/\t\[L\]\t([^[ \t\015\012]+)/ ],
514
515   ['CAI InoculateIT', 'inocucmd',  # retired product
516     '-sec -nex {}', [0], [100],
517     qr/was infected by virus (.+)/ ],
518   # see: http://www.flatmtn.com/computer/Linux-Antivirus_CAI.html
519
520   ### http://www3.ca.com/Solutions/Product.asp?ID=156  (ex InoculateIT)
521   ['CAI eTrust Antivirus', 'etrust-wrapper',
522     '-arc -nex -spm h {}', [0], [101],
523     qr/is infected by virus: (.+)/ ],
524     # NOTE: requires suid wrapper around inocmd32; consider flag: -mod reviewer
525     # see http://marc.theaimsgroup.com/?l=amavis-user&m=109229779912783
526
527   ### http://mks.com.pl/english.html
528   ['MkS_Vir for Linux (beta)', ['mks32','mks'],
529     '-s {}/*', [0], [1,2],
530     qr/--[ \t]*(.+)/ ],
531
532   ### http://mks.com.pl/english.html
533   ['MkS_Vir daemon', 'mksscan',
534     '-s -q {}', [0], [1..7],
535     qr/^... (\S+)/ ],
536
537 # ### http://www.nod32.com/,  version v2.52 and above
538 # ['ESET NOD32 for Linux Mail servers',
539 #   ['/opt/eset/nod32/bin/nod32cli', 'nod32cli'],
540 #    '--subdir --files -z --sfx --rtp --adware --unsafe --pattern --heur '.
541 #    '-w -a --action-on-infected=accept --action-on-uncleanable=accept '.
542 #    '--action-on-notscanned=accept {}',
543 #   [0,3], [1,2], qr/virus="([^"]+)"/ ],
544
545   ### http://www.eset.com/, version v2.7
546   ['ESET NOD32 Linux Mail Server - command line interface',
547     ['/usr/bin/nod32cli', '/opt/eset/nod32/bin/nod32cli', 'nod32cli'],
548     '--subdir {}', [0], [1,2], qr/virus="([^"]+)"/ ],
549
550   ## http://www.nod32.com/,  NOD32LFS version 2.5 and above
551   ['ESET NOD32 for Linux File servers',
552     ['/opt/eset/nod32/sbin/nod32','nod32'],
553     '--files -z --mail --sfx --rtp --adware --unsafe --pattern --heur '.
554     '-w -a --action=1 -b {}',
555     [0], [1,10], qr/^object=.*, virus="(.*?)",/ ],
556
557 # Experimental, based on posting from Rado Dibarbora (Dibo) on 2002-05-31
558 # ['ESET Software NOD32 Client/Server (NOD32SS)',
559 #   \&ask_daemon2,    # greets with 200, persistent, terminate with QUIT
560 #   ["SCAN {}/*\r\n", '127.0.0.1:8448' ],
561 #   qr/^200 File OK/, qr/^201 /, qr/^201 (.+)/ ],
562
563   ### http://www.norman.com/products_nvc.shtml
564   ['Norman Virus Control v5 / Linux', 'nvcc',
565     '-c -l:0 -s -u -temp:$TEMPBASE {}', [0,10,11], [1,2,14],
566     qr/(?i).* virus in .* -> \'(.+)\'/ ],
567
568   ### http://www.pandasoftware.com/
569   ['Panda CommandLineSecure 9 for Linux',
570     ['/opt/pavcl/usr/bin/pavcl','pavcl'],
571     '-auto -aex -heu -cmp -nbr -nor -nos -eng -nob {}',
572     qr/Number of files infected[ .]*: 0+(?!\d)/,
573     qr/Number of files infected[ .]*: 0*[1-9]/,
574     qr/Found virus :\s*(\S+)/ ],
575   # NOTE: for efficiency, start the Panda in resident mode with 'pavcl -tsr'
576   # before starting amavisd - the bases are then loaded only once at startup.
577   # To reload bases in a signature update script:
578   #   /opt/pavcl/usr/bin/pavcl -tsr -ulr; /opt/pavcl/usr/bin/pavcl -tsr
579   # Please review other options of pavcl, for example:
580   #  -nomalw, -nojoke, -nodial, -nohackt, -nospyw, -nocookies
581
582 # ### http://www.pandasoftware.com/
583 # ['Panda Antivirus for Linux', ['pavcl'],
584 #   '-TSR -aut -aex -heu -cmp -nbr -nor -nso -eng {}',
585 #   [0], [0x10, 0x30, 0x50, 0x70, 0x90, 0xB0, 0xD0, 0xF0],
586 #   qr/Found virus :\s*(\S+)/ ],
587
588 # GeCAD AV technology is acquired by Microsoft; RAV has been discontinued.
589 # Check your RAV license terms before fiddling with the following two lines!
590 # ['GeCAD RAV AntiVirus 8', 'ravav',
591 #   '--all --archive --mail {}', [1], [2,3,4,5], qr/Infected: (.+)/ ],
592 # # NOTE: the command line switches changed with scan engine 8.5 !
593 # # (btw, assigning stdin to /dev/null causes RAV to fail)
594
595   ### http://www.nai.com/
596   ['NAI McAfee AntiVirus (uvscan)', 'uvscan',
597     '--secure -rv --mime --summary --noboot - {}', [0], [13],
598     qr/(?x) Found (?:
599         \ the\ (.+)\ (?:virus|trojan)  |
600         \ (?:virus|trojan)\ or\ variant\ ([^ ]+)  |
601         :\ (.+)\ NOT\ a\ virus)/,
602   # sub {$ENV{LD_PRELOAD}='/lib/libc.so.6'},
603   # sub {delete $ENV{LD_PRELOAD}},
604   ],
605   # NOTE1: with RH9: force the dynamic linker to look at /lib/libc.so.6 before
606   # anything else by setting environment variable LD_PRELOAD=/lib/libc.so.6
607   # and then clear it when finished to avoid confusing anything else.
608   # NOTE2: to treat encrypted files as viruses replace the [13] with:
609   #  qr/^\s{5,}(Found|is password-protected|.*(virus|trojan))/
610
611   ### http://www.virusbuster.hu/en/
612   ['VirusBuster', ['vbuster', 'vbengcl'],
613     "{} -ss -i '*' -log=$MYHOME/vbuster.log", [0], [1],
614     qr/: '(.*)' - Virus/ ],
615   # VirusBuster Ltd. does not support the daemon version for the workstation
616   # engine (vbuster-eng-1.12-linux-i386-libc6.tgz) any longer. The names of
617   # binaries, some parameters AND return codes have changed (from 3 to 1).
618   # See also the new Vexira entry 'vascan' which is possibly related.
619
620 # ### http://www.virusbuster.hu/en/
621 # ['VirusBuster (Client + Daemon)', 'vbengd',
622 #   '-f -log scandir {}', [0], [3],
623 #   qr/Virus found = (.*);/ ],
624 # # HINT: for an infected file it always returns 3,
625 # # although the man-page tells a different story
626
627   ### http://www.cyber.com/
628   ['CyberSoft VFind', 'vfind',
629     '--vexit {}/*', [0], [23], qr/##==>>>> VIRUS ID: CVDL (.+)/,
630   # sub {$ENV{VSTK_HOME}='/usr/lib/vstk'},
631   ],
632
633   ### http://www.avast.com/
634   ['avast! Antivirus', ['/usr/bin/avastcmd','avastcmd'],
635     '-a -i -n -t=A {}', [0], [1], qr/\binfected by:\s+([^ \t\n\[\]]+)/ ],
636
637   ### http://www.ikarus-software.com/
638   ['Ikarus AntiVirus for Linux', 'ikarus',
639     '{}', [0], [40], qr/Signature (.+) found/ ],
640
641   ### http://www.bitdefender.com/
642   ['BitDefender', 'bdc',
643     '--arc --mail {}', qr/^Infected files *:0+(?!\d)/,
644     qr/^(?:Infected files|Identified viruses|Suspect files) *:0*[1-9]/,
645     qr/(?:suspected|infected): (.*)(?:\033|$)/ ],
646   # consider also: --all --nowarn --alev=15 --flev=15.  The --all argument may
647   # not apply to your version of bdc, check documentation and see 'bdc --help'
648
649   ### ArcaVir for Linux and Unix http://www.arcabit.pl/
650   ['ArcaVir for Linux', ['arcacmd','arcacmd.static'],
651     '-v 1 -summary 0 -s {}', [0], [1,2],
652     qr/(?:VIR|WIR):[ \t]*(.+)/ ],
653
654 # ['File::Scan', sub {Amavis::AV::ask_av(sub{
655 #   use File::Scan; my($fn)=@_;
656 #   my($f)=File::Scan->new(max_txt_size=>0, max_bin_size=>0);
657 #   my($vname) = $f->scan($fn);
658 #   $f->error ? (2,"Error: ".$f->error)
659 #   : ($vname ne '') ? (1,"$vname FOUND") : (0,"Clean")}, @_) },
660 #   ["{}/*"], [0], [1], qr/^(.*) FOUND$/ ],
661
662 # ### fully-fledged checker for JPEG marker segments of invalid length
663 # ['check-jpeg',
664 #   sub { use JpegTester (); Amavis::AV::ask_av(\&JpegTester::test_jpeg, @_) },
665 #   ["{}/*"], undef, [1], qr/^(bad jpeg: .*)$/ ],
666 # # NOTE: place file JpegTester.pm somewhere where Perl can find it,
667 # #       for example in /usr/local/lib/perl5/site_perl
668
669 );
670
671
672 @av_scanners_backup = (
673
674   ### http://www.clamav.net/   - backs up clamd or Mail::ClamAV
675   ['ClamAV-clamscan', 'clamscan',
676     "--stdout --no-summary -r --tempdir=$TEMPBASE {}",
677     [0], qr/:.*\sFOUND$/, qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],
678
679   ### http://www.f-prot.com/   - backs up F-Prot Daemon
680   ['FRISK F-Prot Antivirus', ['f-prot','f-prot.sh'],
681     '-dumb -archive -packed {}', [0,8], [3,6],   # or: [0], [3,6,8],
682     qr/(?:Infection:|security risk named) (.+)|\s+contains\s+(.+)$/ ],
683
684   ### http://www.trendmicro.com/   - backs up Trophie
685   ['Trend Micro FileScanner', ['/etc/iscan/vscan','vscan'],
686     '-za -a {}', [0], qr/Found virus/, qr/Found virus (.+) in/ ],
687
688   ### http://www.sald.com/, http://drweb.imshop.de/   - backs up DrWebD
689   ['drweb - DrWeb Antivirus',  # security LHA hole in Dr.Web 4.33 and earlier
690     ['/usr/local/drweb/drweb', '/opt/drweb/drweb', 'drweb'],
691     '-path={} -al -go -ot -cn -upn -ok-',
692     [0,32], [1,9,33], qr' infected (?:with|by)(?: virus)? (.*)$'],
693
694    ### http://www.kaspersky.com/
695    ['Kaspersky Antivirus v5.5',
696      ['/opt/kaspersky/kav4fs/bin/kav4fs-kavscanner',
697       '/opt/kav/5.5/kav4unix/bin/kavscanner',
698       '/opt/kav/5.5/kav4mailservers/bin/kavscanner', 'kavscanner'],
699      '-i0 -xn -xp -mn -R -ePASBME {}/*', [0,10,15], [5,20,21,25],
700      qr/(?:INFECTED|WARNING|SUSPICION|SUSPICIOUS) (.*)/ ,
701 #    sub {chdir('/opt/kav/bin') or die "Can't chdir to kav: $!"},
702 #    sub {chdir($TEMPBASE) or die "Can't chdir back to $TEMPBASE $!"},
703    ],
704
705 # Commented out because the name 'sweep' clashes with Debian and FreeBSD
706 # package/port of an audio editor. Make sure the correct 'sweep' is found
707 # in the path when enabling.
708 #
709 # ### http://www.sophos.com/   - backs up Sophie or SAVI-Perl
710 # ['Sophos Anti Virus (sweep)', 'sweep',
711 #   '-nb -f -all -rec -ss -sc -archive -cab -mime -oe -tnef '.
712 #   '--no-reset-atime {}',
713 #   [0,2], qr/Virus .*? found/,
714 #   qr/^>>> Virus(?: fragment)? '?(.*?)'? found/,
715 # ],
716 # # other options to consider: -idedir=/usr/local/sav
717
718 # always succeeds (uncomment to consider mail clean if all other scanners fail)
719 # ['always-clean', sub {0}],
720
721 );
722
723
724 @bypass_virus_checks_maps = (
725    \%bypass_virus_checks, \@bypass_virus_checks_acl, \$bypass_virus_checks_re);
726
727 @bypass_spam_checks_maps = (
728    \%bypass_spam_checks, \@bypass_spam_checks_acl, \$bypass_spam_checks_re);
729
730 #   
731 # Database connection settings
732 #
733
734 @lookup_sql_dsn =
735    ( ['DBI:mysql:database={mysql_server_database};host={mysql_server_ip};port={mysql_server_port}', '{mysql_server_ispconfig_user}', '{mysql_server_ispconfig_password}'] );
736
737 # @storage_sql_dsn = @lookup_sql_dsn;  # none, same, or separate database
738 #$sql_select_policy = 'SELECT "Y" as local FROM mail_domain WHERE CONCAT("@",domain) IN (%k)';
739 # $banned_files_quarantine_method = 'sql';
740 # $spam_quarantine_method         = 'sql';
741
742 #
743 # SQL Select statements
744 #
745
746 $sql_select_policy =
747    'SELECT *,spamfilter_users.id'.
748    ' FROM spamfilter_users LEFT JOIN spamfilter_policy ON spamfilter_users.policy_id=spamfilter_policy.id'.
749    ' WHERE spamfilter_users.email IN (%k) ORDER BY spamfilter_users.priority DESC';
750
751
752 $sql_select_white_black_list = 'SELECT wb FROM spamfilter_wblist'.
753     ' WHERE (spamfilter_wblist.rid=?) AND (spamfilter_wblist.email IN (%k))' .
754     ' ORDER BY spamfilter_wblist.priority DESC';
755
756 #
757 # Quarantine settings
758 #
759
760 $final_virus_destiny = D_BOUNCE;
761 $final_spam_destiny = D_DISCARD;
762 $final_banned_destiny = D_BOUNCE;
763 $final_bad_header_destiny = D_DISCARD;
764
765 #
766 # Disable spam and virus notifications for the admin user.
767 # Can be overridden by the policies in mysql
768 #
769
770 $virus_admin = undef;
771 $spam_admin = undef;
772
773
774 #
775 # Enable Logging
776 #
777
778 $DO_SYSLOG = 1;
779 $LOGFILE = "/var/log/amavis.log";  # (defaults to empty, no log)
780
bd68aa 781 # DKIM
MC 782
783 $enable_dkim_verification = 1;
d6742c 784 $enable_dkim_signing = 1; # load DKIM signing code
FS 785 $signed_header_fields{'received'} = 0;  # turn off signing of Received
bd68aa 786 @dkim_signature_options_bysender_maps = (
MC 787 { '.' => { ttl => 21*24*3600, c => 'relaxed/simple' } } );
7d89f5 788
T 789 1;  # insure a defined return