Здравствуйте. Столкнулся с такой проблемой: когда на майл приходит письмо с большим атачьментом (к примеру 100Мб ISO)ClamAV начинает его проверять, забирая все ресурсы компа. Я пробовал связки Postfix - ClamSMTP - ClamAV - SpamAssasin и Postfix - AmaVis-new - ClamAV. Но не в одной из них не смог настроить почту так, что бы письма больше 5Мб не отправлялись на проверку ClamAV. Подскажите в какой связке и как можно настроить что бы большие письма не отправлялись на проверку в ClamAV.FreeBSD 6.0
Все программы ставил 3 дня назад из портов, предварительно обновил порты.
Пример конфигов связки Postfix - ClamSMTP - ClamAV - SpamAssasin*************************************************************************************
Вот это я добавил в Main.cf:content_filter = avscan:127.0.0.1:10025
receive_override_options = no_address_mappings
spamfilter_destination_recipient_limit = 1
**************************************************************************************************************************************************************************
clamsmtpd.conf:# The address to send scanned mail to.
# This option is required unless TransparentProxy is enabled
OutAddress: 10026# The maximum number of connection allowed at once.
# Be sure that clamd can also handle this many connections
#MaxConnections: 64# Amount of time (in seconds) to wait on network IO
#TimeOut: 180# Keep Alives (ie: NOOP's to server)
#KeepAlives: 0# Send XCLIENT commands to receiving server
XClient: off# Address to listen on (defaults to all local addresses on port 10025)
Listen: 127.0.0.1:10025# The address clamd is listening on
ClamAddress: /var/run/clamav/clamd# A header to add to all scanned email
Header: X-Virus-Scanned: ClamAV using ClamSMTP# Directory for temporary files
TempDirectory: /tmp/clamav# Whether or not to bounce email (default is to silently drop)
#Bounce: off
Bounce: off# Whether or not to keep virus files
Quarantine: off# Enable transparent proxy support
TransparentProxy: off# User to switch to
User: clamav# Virus actions: There's an option to run a script every time a virus is found.
# !IMPORTANT! This can open a hole in your server's security big enough to drive
# farm vehicles through. Be sure you know what you're doing. !IMPORTANT!
VirusAction: /usr/local/etc/clamsmtpd_virus.sh
**************************************************************************************************************************************************************************
Вот это я добавил в master.cf:
# ====================================================================
#
# ClamSMTP
#avscan unix - - n - 16 smtp
-o smtp_send_xforward_command=yes127.0.0.1:10026 inet n - n - 16 smtpd
# -o content_filter=
-o content_filter=spamfilter
-o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
-o smtpd_helo_restrictions=
-o smtpd_client_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o mynetworks_style=host
-o smtpd_authorized_xforward_hosts=127.0.0.0/8# ====================================================================
#
# SpamAssasin
#
spamfilter unix - n n - 10 pipe
flags=R
user=spamd argv=/usr/local/etc/postfix/spam.pl "localhost:10027" "spamfilter"\
"${sender}" "${recipient}" "/usr/local/bin/spamc"
localhost:10027 inet n - n - 10 smtpd
-o content_filter=
-o local_recipient_maps=
-o relay_recipient_maps=
-o smtpd_helo_restrictions=
-o smtpd_client_restrictions=
-o smtpd_sender_restrictions=
-o mynetworks=127.0.0.0/8
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o myhostname=localhost
*************************************************************************************Зарание Спасибо.
Мдя... сегодня в этом же форуме....
http://www.opennet.me/openforum/vsluhforumID1/65535.html
У amavisd-new в конфиге есть установка на ограничение размера файла, который передается на проверку... Зачем же конфиги постфикса и кламава приводить - постфикс о вирусах ничего не знает - и не обязан, а кламав все, что ему скормили, обязан проверить
>Мдя... сегодня в этом же форуме....
>http://www.opennet.me/openforum/vsluhforumID1/65535.html
>У amavisd-new в конфиге есть установка на ограничение размера файла, который передается
>на проверку... Зачем же конфиги постфикса и кламава приводить - постфикс
>о вирусах ничего не знает - и не обязан, а кламав
>все, что ему скормили, обязан проверитьистинно так.
Мне почему-то казалось что для больших объемов >= 20MB удобней использовать НЕ SMTP,
а FTP или HTTP
>>Мдя... сегодня в этом же форуме....
>>http://www.opennet.me/openforum/vsluhforumID1/65535.html
>>У amavisd-new в конфиге есть установка на ограничение размера файла, который передается
>>на проверку... Зачем же конфиги постфикса и кламава приводить - постфикс
>>о вирусах ничего не знает - и не обязан, а кламав
>>все, что ему скормили, обязан проверить
>
>истинно так.
>
>Мне почему-то казалось что для больших объемов >= 20MB удобней использовать НЕ SMTP,
>а FTP или HTTPДа это удобнее, но не все умеют пользоваться FTP :). По этому и шлют по почте.
А где именно это настраивается. Шлю ISO 80Мб она проверяется. Вот мой конфиг:
use strict;
# a minimalistic configuration file for amavisd-new with all necessary settings
#
# see amavisd.conf-default for a list of all variables with their defaults;
# see amavisd.conf-sample for a traditional-style commented file;
# for more details see documentation in INSTALL, README_FILES/*
# and at http://www.ijs.si/software/amavisd/amavisd-new-docs.html
# COMMONLY ADJUSTED SETTINGS:# @bypass_virus_checks_maps = (1); # uncomment to DISABLE anti-virus code
@bypass_spam_checks_maps = (1); # uncomment to DISABLE anti-spam code$max_servers = 2; # number of pre-forked children (2..15 is common)
$daemon_user = 'vscan'; # (no default; customary: vscan or amavis)
$daemon_group = 'vscan'; # (no default; customary: vscan or amavis)$mydomain = 'aaaaaaa.aa'; # a convenient default for other settings
$MYHOME = '/var/amavis'; # a convenient default for other settings
$TEMPBASE = "$MYHOME/tmp"; # working directory, needs to be created manually
[root@mail ~]# vim /usr/local/etc/amavisd.conf
use strict;# a minimalistic configuration file for amavisd-new with all necessary settings
#
# see amavisd.conf-default for a list of all variables with their defaults;
# see amavisd.conf-sample for a traditional-style commented file;
# for more details see documentation in INSTALL, README_FILES/*
# and at http://www.ijs.si/software/amavisd/amavisd-new-docs.html
# COMMONLY ADJUSTED SETTINGS:# @bypass_virus_checks_maps = (1); # uncomment to DISABLE anti-virus code
@bypass_spam_checks_maps = (1); # uncomment to DISABLE anti-spam code$max_servers = 2; # number of pre-forked children (2..15 is common)
$daemon_user = 'vscan'; # (no default; customary: vscan or amavis)
$daemon_group = 'vscan'; # (no default; customary: vscan or amavis)$mydomain = 'aaaaaaa.aa'; # a convenient default for other settings
$MYHOME = '/var/amavis'; # a convenient default for other settings
$TEMPBASE = "$MYHOME/tmp"; # working directory, needs to be created manually
$SYSLOG_LEVEL = 'mail.debug';$enable_db = 1; # enable use of BerkeleyDB/libdb (SNMP and nanny)
$enable_global_cache = 1; # enable use of libdb-based cache if $enable_db=1$inet_socket_port = 10024; # listen on this local TCP port(s) (see $protocol)
# $unix_socketname = "$MYHOME/amavisd.sock"; # when using sendmail milter$sa_tag_level_deflt = 2.0; # add spam info headers if at, or above that level
$sa_tag2_level_deflt = 6.31; # add 'spam detected' headers at that level
$sa_kill_level_deflt = 6.31; # triggers spam evasive actions
$sa_dsn_cutoff_level = 9; # spam level beyond which a DSN is not sent
# $sa_quarantine_cutoff_level = 20; # spam level beyond which quarantine is off$sa_mail_body_size_limit = 200*1024; # don't waste time on SA if mail is larger
$sa_local_tests_only = 0; # only tests which do not require internet access?
$sa_auto_whitelist = 1; # turn on AWL in SA 2.63 or older (irrelevant
# for SA 3.0, cf option is 'use_auto_whitelist')# @lookup_sql_dsn =
# ( ['DBI:mysql:database=mail;host=127.0.0.1;port=3306', 'user1', 'passwd1'],
# ['DBI:mysql:database=mail;host=host2', 'username2', 'password2'],
# ["DBI:SQLite:dbname=$MYHOME/sql/mail_prefs.sqlite", '', ''] );
$MAXLEVELS = 14;
$MAXFILES = 1500;
$MIN_EXPANSION_QUOTA = 100*1024; # bytes (default undef, not enforced)
$MAX_EXPANSION_QUOTA = 300*1024; # bytes (default undef, not enforced)$sa_spam_subject_tag = '***SPAM*** ';
$defang_virus = 1; # MIME-wrap passed infected mail
$defang_banned = 1; # MIME-wrap passed mail containing banned name$undecipherable_subject_tag = '***UNCHECKED*** ';
# OTHER MORE COMMON SETTINGS (defaults may suffice):
# $myhostname = 'host.example.com'; # must be a fully-qualified domain name!
# $notify_method = 'smtp:[127.0.0.1]:10025';
# $forward_method = 'smtp:[127.0.0.1]:10025'; # set to undef with milter!# $final_virus_destiny = D_DISCARD;
# $final_banned_destiny = D_BOUNCE;
# $final_spam_destiny = D_BOUNCE;
# $final_bad_header_destiny = D_PASS;
# REMAINING IMPORTANT VARIABLES ARE LISTED HERE BECAUSE OF LONGER ASSIGNMENTS
@viruses_that_fake_sender_maps = (new_RE(
# [qr'\bEICAR\b'i => 0], # av test pattern name
# [qr'^(WM97|OF97|Joke\.)'i => 0], # adjust names to match your AV scanner
[qr/^/ => 1], # true for everything else
));@keep_decoded_original_maps = (new_RE(
# qr'^MAIL$', # retain full original message for virus checking (can be slow)
qr'^MAIL-UNDECIPHERABLE$', # recheck full mail if it contains undecipherables
qr'^(ASCII(?! cpio)|text|uuencoded|xxencoded|binhex)'i,
# qr'^Zip archive data', # don't trust Archive::Zip
));
# for $banned_namepath_re, a new-style of banned table, see amavisd.conf-sample$banned_filename_re = new_RE(
# qr'^UNDECIPHERABLE$', # is or contains any undecipherable components# block certain double extensions anywhere in the base name
# wmf|wsc|wsf|wsh)$'ix, # banned ext - long# qr'.\.(mim|b64|bhx|hqx|xxe|uu|uue)$'i, # banned extension - WinZip vulnerab.
qr'^\.(exe-ms)$', # banned file(1) types
# qr'^\.(exe|lha|tnef|cab|dll)$', # banned file(1) types
);
# See http://support.microsoft.com/default.aspx?scid=kb;EN-US;q262631
# and http://www.cknow.com/vtutor/vtextensions.htm
# ENVELOPE SENDER SOFT-WHITELISTING / SOFT-BLACKLISTING@score_sender_maps = ({ # a by-recipient hash lookup table,
# results from all matching recipient tables are summed# ## per-recipient personal tables (NOTE: positive: black, negative: white)
# 'user1@example.com' => [{'bla-mobile.press@example.com' => 10.0}],
# 'user3@example.com' => [{'.ebay.com' => -3.0}],
# 'user4@example.com' => [{'cleargreen@cleargreen.com' => -7.0,
# '.cleargreen.com' => -5.0}],## site-wide opinions about senders (the '.' matches any recipient)
'bugtraq@securityfocus.com' => -3.0,
'ntbugtraq@listserv.ntbugtraq.com' => -3.0,
'security-alerts@linuxsecurity.com' => -3.0,
'mailman-announce-admin@python.org' => -3.0,
'amavis-user-admin@lists.sourceforge.net'=> -3.0,
'notification-return@lists.sophos.com' => -3.0,
'owner-postfix-users@postfix.org' => -3.0,
'owner-postfix-announce@postfix.org' => -3.0,
'owner-sendmail-announce@lists.sendmail.org' => -3.0,
'sendmail-announce-request@lists.sendmail.org' => -3.0,
'donotreply@sendmail.org' => -3.0,
'ca+envelope@sendmail.org' => -3.0,
'noreply@freshmeat.net' => -3.0,
'owner-technews@postel.acm.org' => -3.0,
'ietf-123-owner@loki.ietf.org' => -3.0,
'cvs-commits-list-admin@gnome.org' => -3.0,
'rt-users-admin@lists.fsck.com' => -3.0,
'clp-request@comp.nus.edu.sg' => -3.0,
'surveys-errors@lists.nua.ie' => -3.0,
'emailnews@genomeweb.com' => -5.0,
'yahoo-dev-null@yahoo-inc.com' => -3.0,
'returns.groups.yahoo.com' => -3.0,
'clusternews@linuxnetworx.com' => -3.0,
['Z', \&do_uncompress, ['uncompress','gzip -d','zcat'] ],
['gz', \&do_gunzip],
['gz', \&do_uncompress, 'gzip -d'],
['bz2', \&do_uncompress, 'bzip2 -d'],
['lzo', \&do_uncompress, 'lzop -d'],
['rpm', \&do_uncompress, ['rpm2cpio.pl','rpm2cpio'] ],
['cpio', \&do_pax_cpio, ['pax','gcpio','cpio'] ],
['tar', \&do_pax_cpio, ['pax','gcpio','cpio'] ],
['tar', \&do_tar],
['deb', \&do_ar, 'ar'],
# ['a', \&do_ar, 'ar'], # unpacking .a seems an overkill
['zip', \&do_unzip],
['rar', \&do_unrar, ['rar','unrar'] ],
['arj', \&do_unarj, ['arj','unarj'] ],
['arc', \&do_arc, ['nomarch','arc'] ],
['zoo', \&do_zoo, 'zoo'],
['lha', \&do_lha, 'lha'],
# ['doc', \&do_ole, 'ripole'],
['cab', \&do_cabextract, 'cabextract'],
['tnef', \&do_tnef_ext, 'tnef'],
['tnef', \&do_tnef],
['exe', \&do_executable, ['rar','unrar'], 'lha', ['arj','unarj'] ],
);
1; # insure a defined return
Опять километровый конфиг... И зачем?
Я могу свой конфиг амависа бросить - он раз в 20 подлиннее будет.
Не лучше ли зайти на сайт амависа и в разделе документации задать поиск по size?
Тогда будут видны все переменные, отвечающие за включение-выключение лимитов по объему.
А если почитать эту доку внимательно, то станет ясно, что есть переменные, задающие набор расширений, которые проверяться не будут (напр., если нужно исключить из проверки только iso).
>Опять километровый конфиг... И зачем?
>Я могу свой конфиг амависа бросить - он раз в 20 подлиннее
>будет.
>Не лучше ли зайти на сайт амависа и в разделе документации задать
>поиск по size?
>Тогда будут видны все переменные, отвечающие за включение-выключение лимитов по объему.
>А если почитать эту доку внимательно, то станет ясно, что есть переменные,
>задающие набор расширений, которые проверяться не будут (напр., если нужно исключить
>из проверки только iso).Я знаю что есть возможность запретить проверку определённых расширений, но мне это не нужно. Мне нужно запретит проверку больших писем.
На сколько я смог разобраться за это отвечают вот эти опции:$MIN_EXPANSION_QUOTA = 100*1024; # bytes (default undef, not enforced)
$MAX_EXPANSION_QUOTA = 300*1024; # bytes (default undef, not enforced)Если я прав, то при этих значениях письма больше 300Кб не должны проверятся. Однако они проверяются. По этому я и выкладываю весь конфиг, дабы добрые люди, которые решат помочь мне ламеру имели полное представления о том что творится у меня в Amavis-new
вот из документации...Файл: amavisd.conf
#
# Section VI - Resource limits
## Sanity limit to the number of allowed recipients per SMTP transaction
# $smtpd_recipient_limit = 1100; # (default is 1100)# Resource limits to protect unpackers, decompressors and virus scanners
# against mail bombs (e.g. 42.zip)
# Maximum recursion level for extraction/decoding (0 or undef disables limit)
$MAXLEVELS = 14; # (default is undef, no limit)# Maximum number of extracted files (0 or undef disables the limit)
$MAXFILES = 1500; # (default is undef, no limit)# For the cumulative total of all decoded mail parts we set max storage size
# to defend against mail bombs. Even though parts may be deleted (replaced
# by decoded text) during decoding, the size they occupied is _not_ returned
# to the quota pool.
#
# Parameters to storage quota formula for unpacking/decoding/decompressing
# Formula:
# quota = max($MIN_EXPANSION_QUOTA,
# $mail_size*$MIN_EXPANSION_FACTOR,
# min($MAX_EXPANSION_QUOTA, $mail_size*$MAX_EXPANSION_FACTOR))
# In plain words (later condition overrules previous ones):
# allow MAX_EXPANSION_FACTOR times initial mail size,
# but not more than MAX_EXPANSION_QUOTA,
# but not less than MIN_EXPANSION_FACTOR times initial mail size,
# but never less than MIN_EXPANSION_QUOTA
#
$MIN_EXPANSION_QUOTA = 100*1024; # bytes (default undef, not enforced)
$MAX_EXPANSION_QUOTA = 300*1024*1024; # bytes (default undef, not enforced)
$MIN_EXPANSION_FACTOR = 5; # times original mail size (default is 5)
$MAX_EXPANSION_FACTOR = 500; # times original mail size (default is 500)# expiration time of cached results: time to live in seconds
# (how long the result of a virus/spam test remains valid)
$virus_check_negative_ttl= 3*60; # time to remember that mail was not infected
$virus_check_positive_ttl= 30*60; # time to remember that mail was infected
$spam_check_negative_ttl= 30*60; # time to remember that mail was not spam
$spam_check_positive_ttl= 30*60; # time to remember that mail was spamСложно это было взять самому? Причем у меня может быть другая сборка - у тебя умолчания могут быть другими.