LINUX-сервер пошаговые инструкции инсталляции и настройки - Бруй В. В. , Карлов С. В
..pdfГлава 30. Doctor Web – антивирусное программное обеспечение |
431 |
|
LogFileName = "syslog" |
|
|
;LogFileName = "/var/drweb/log/drwebd.log" |
|
|
;BusyFile = "/var/drweb/run/drwebd.bsy" |
|
|
SocketMode |
= TCP |
|
SocketFile |
= "/var/drweb/run/drwebd.socket" |
|
;SocketMode = Unix |
|
|
;SocketAccess 0666 |
|
|
;Расскоментировать |
|
|
;PidFile = |
"/var/drweb/run/drwebd.pid" |
|
DaemonPort |
= 3000 |
|
SocketTimeout = 40 |
|
|
SocketReuseAddr = Yes |
|
|
FileTimeout = 40 |
|
|
OutputMode |
= Terminal |
|
LimitLog = |
No |
|
MaxLogSize |
= 512 |
|
LogScanned |
= Yes |
|
LogInfo = Yes |
|
|
LogPacked = Yes |
|
|
Interfaces |
= "localhost" |
|
User = mail |
|
|
;UserID = |
|
|
;GroupID = |
|
|
ScanFiles = All |
|
|
MaxCompressionRatio = 20 |
|
|
MaxChildren = 16 |
|
|
SyslogFacility = "Daemon" |
|
|
SyslogPriority = "Alert" |
|
|
FilterRule |
X-Mailer ".*Mass.*Sender.*" Reject |
|
FilterRule |
To ".*undisclosed.*recipient.*" Reject |
|
FilterRule |
Subject ".*free.*xxx.*" Reject |
|
UpdatePath |
= "/opt/drweb/updates" |
|
RecodeNonprintable = Yes |
|
|
RecodeMode |
= QuotedPrintable |
|
RecodeChar |
= "?" |
|
Конфигурационный файл состоит из двух частей. В первой – с заголовком [Linux] – содержатся параметры конфигурации сканера, во второй – с заголовком [Linux:Daemon] – содержатся параметры конфигурации демона. Вам следует внести изменения в три строки.
Строки (в обоих разделах):
LngFileName = "/opt/drweb/lib/russian.dwl"
предписывают включение поддержки в сообщениях русского языка. Строка:
User = mail
предписывает запускать демон от имени пользователя mail – это необходимо для интеграции с Exim. Назначение остальных используемых в файле опций подробно описано на русском и английском язы-
ках в файлах /opt/drweb/doc/readme.daemon.rus и /opt/drweb/doc/readme.daemon, соот-
ветственно. После завершения установки и настройки программного обеспечения каталог с документацией
/opt/drweb/doc/следует удалить.
Шаг 2
Определите права доступа к файлу /etc/drweb/drweb32.ini и назначьте его владельцем пользователя root:
[root@test /]# chmod 640 /etc/drweb/drweb32.ini [root@test /]# chown 0.0 /etc/drweb/drweb32.ini
Шаг 3
Для обеспечения нормальной работы демона от имени пользователя mail (в рассматриваемом примере drwebd запускается от имени пользователя mail) определите пользователя mail владельцем каталога
/var/drweb:
432 |
Часть 7. Программное обеспечение для организации службы электронной почты |
[root@test /]# chown -R mail.root /var/drweb/
Конфигурационный файл /etc/mail/exim.conf
Шаг 1
Добавьте в файл /etc/mail/exim.conf параметры транспорта для фильтра, руководствуясь ниже приведенными рекомендациями:
######################################################################
# MAIN CONFIGURATION SETTINGS #
######################################################################
primary_hostname = test.bruy.info acl_smtp_rcpt = check_recipient acl_smtp_data = check_message
domainlist local_domains = @ : lsearch;/etc/mail/localdomains hostlist relay_hosts = lsearch;/etc/mail/relaydomains hostlist auth_relay_hosts = *
log_selector = \ +all_parents \ +received_sender \
+received_recipients \ +smtp_confirmation \ +smtp_syntax_error
allow_domain_literals = false never_users = root:daemon:bin:sync:named host_lookup = *
trusted_users = mail trusted_groups = mail
gecos_pattern = ^([^,:]*) gecos_name = $1 freeze_tell = postmaster auto_thaw = 1h
ignore_bounce_errors_after = 30m timeout_frozen_after = 7d
received_header_text = "Received: \
${if def:sender_rcvhost {from ${sender_rcvhost}\n\t}\ {${if def:sender_ident {from ${sender_ident} }}\
${if def:sender_helo_name {(helo=${sender_helo_name})\n\t}}}}\ by ${primary_hostname} \
${if def:received_protocol {with ${received_protocol}}} \ (Exim ${version_number} #${compile_number} )\n\t\
id ${message_id}\
${if def:received_for {\n\tfor <$received_for>}}"
system_filter = /etc/mail/system-filter system_filter_pipe_transport = filter_pipe system_filter_reply_transport = address_reply message_body_visible = 5000 message_size_limit = 10M
smtp_accept_max = 2048 smtp_connect_backlog = 256 queue_only split_spool_directory queue_run_max = 1 remote_max_parallel = 1 rfc1413_hosts = * rfc1413_query_timeout = 0s
Глава 30. Doctor Web – антивирусное программное обеспечение |
433 |
|
smtp_banner = "Welcome on |
our mail server!\n\ |
|
This system does not accept Unsolicited \ |
|
|
Commercial Email\nand will blacklist \ |
|
|
offenders via our |
spam processor.\nHave a \ |
|
nice day!\n\n${primary_hostname} ESMTP Exim \ |
|
|
${version_number} |
${tod_full}" |
|
######################################################################
# |
ACL CONFIGURATION |
# |
# |
Specifies access control lists for incoming SMTP mail |
# |
######################################################################
begin acl |
|
|
check_recipient: |
|
|
accept |
hosts = : |
|
deny |
local_parts |
= ^.*[@%!/|] |
deny |
senders |
= *@dbm;/etc/mail/access.db : \ |
|
|
dbm;/etc/mail/access.db |
require |
verify |
= sender |
deny |
message |
= unrouteable address |
|
hosts |
= !127.0.0.1/8:0.0.0.0/0 |
|
!verify |
= recipient |
accept |
domains |
= +local_domains |
|
endpass |
|
|
message |
= unknown user |
|
verify |
= recipient |
accept |
hosts |
= +relay_hosts |
accept |
hosts |
= +auth_relay_hosts |
|
endpass |
|
|
message |
= authentication required |
|
authenticated |
= * |
deny |
message |
= relay not permitted |
check_message: accept
######################################################################
# |
ROUTERS CONFIGURATION |
# |
# |
Specifies how addresses are handled |
# |
######################################################################
# THE ORDER IN WHICH THE ROUTERS ARE DEFINED IS IMPORTANT! #
# An address is passed to each router in turn until it is accepted. #
######################################################################
begin routers
dnslookup:
driver = dnslookup
domains = ! +local_domains transport = remote_smtp
ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8 no_more
434 Часть 7. Программное обеспечение для организации службы электронной почты
system_aliases: driver = redirect allow_fail allow_defer
data = ${lookup{$local_part}lsearch{/etc/mail/aliases}} user = mail
file_transport = address_file pipe_transport = address_pipe
userforward:
driver = redirect check_local_user
file = $home/.forward no_verify
no_expn check_ancestor allow_filter modemask = 002
file_transport = address_file pipe_transport = address_pipe reply_transport = address_reply
localuser:
driver = accept check_local_user
transport = local_delivery
######################################################################
# TRANSPORTS CONFIGURATION #
######################################################################
# |
ORDER DOES NOT MATTER |
# |
# |
Only one appropriate transport is called for each delivery. |
# |
######################################################################
begin transports
remote_smtp: driver = smtp
local_delivery: driver = appendfile
file = /var/mail/$local_part delivery_date_add envelope_to_add return_path_add
group = mail mode = 0600
address_pipe: driver = pipe return_output
address_file:
driver = appendfile delivery_date_add envelope_to_add return_path_add
address_reply: driver = autoreply
filter_pipe: driver = pipe
Глава 30. Doctor Web – антивирусное программное обеспечение |
435 |
user = mail group = mail
return_fail_output
######################################################################
# RETRY CONFIGURATION #
######################################################################
begin retry |
|
|
# Domain |
Error |
Retries |
# ------ |
----- |
------- |
* |
* |
F,2h,15m; G,16h,1h,1.5; F,4d,6h |
######################################################################
# REWRITE CONFIGURATION #
######################################################################
begin rewrite
######################################################################
# AUTHENTICATION CONFIGURATION #
######################################################################
begin authenticators
Вносимые изменения подробно описаны на русском и английском языках в файлах документации
/var/tmp/drweb-exim/opt/drweb/doc/exim/conf_file.rus.txt и /var/tmp/drwebexim/opt/drweb/doc/exim/conf_file.rus.txt, соответственно.
Конфигурационный файл /etc/drweb/drweb_exim.conf
Шаг 1 Руководствуясь ниже приведенными рекомендациями и вашими потребностями, отредактируйте
файл /etc/drweb/drweb_exim.conf:
#
# Configuration file for DrWeb Filters
#
#########################
#Communication section #
#########################
[DaemonCommunication]
#Definition of daemons addresses separeted by "," and given
#in a special form {FAMILY}:{ADDRESS}
#where FAMILY one of:
#inet - TCP/IP socket used, then {ADDRESS} is {PORT}@{HOST}
#local - UNIX socket used, then {ADDRESS} is {SOCKETFILE}
#pid - get daemon address from pidfile, then {ADDRESS} is {PIDFILE}
#Examples:
#Address = inet:3000@localhost
#Address = local:/usr/local/drweb/run/drwebd.skt
#Address = pid:/usr/local/drweb/run/drwebd.pid
#Address = pid:/var/drweb/run/drwebd.pid,
inet:3000@backup_server.example.com Address = inet:3000@localhost
#Enable/disable caching resolved daemon host
#(useful only if daemon uses TCP/IP communications) Cache = yes
#Timeout for whole scanning session (in seconds) Timeout = 120
436 |
Часть 7. Программное обеспечение для организации службы электронной почты |
########################
#Scan options section #
########################
[Scanning]
#Enable or disable heuristic analizer in virus-finding engine (on/off) HeuristicAnalysis = on
#Strip the smallest prefix containing StripPath leading slashes
#NOTE: Option works same the -p parameter in patch utility
#StripPath = 2
#Path that prefixes scan paths. Applied to path processed by StripPath.
#NOTE: PrefixPath MUST NOT ends by slash (/)
#PrefixPath = /sandbox/mail
#Include DrWeb report to notifications into $REPORT$
#or as separete macros $DAEMON_REPORT$(yes/no)
IncludeReport = yes
#Include DrWeb extended codes to notifications into $REPORT$
#or as separete macros $SCAN_STAT$ (yes/no)
IncludeStats = yes
#Max size of report that be created if IncludeReport is "yes",
#Specify 0 to non-restrictable size`,' but it is bad idea - report can grow
#to Mbytes for nested archives
ReportMaxSize = 8192
#Enable or disable local scanning mode (see daemon documentation) (yes/no)
#LocalScan has affect only on connection with first daemon in Address list
#If enabled then spool directory must be readable (writeable for EVAL key)
#for drwebd process (see drweb32.ini option User)
LocalScan = yes
#Enable or disable daemon rule filter (on/off) RuleFilter = on
#Deny scanning if at least one of recipient or sender address
#present in DenyList with "deny" option (yes/no), if "no" all
#addresses in the message should present in DenyList with "deny" DenyOnOne = yes
#List with rules for users or domains to block scanning
DenyList = /etc/drweb/users.conf
#Directory used for story temporary files Spool = /var/drweb/spool
#Permissions for created spool files SpoolFilesMode = 0600
###################
#Actions section #
###################
[Actions]
#NOTE: If you do not using quarantine action for some causes, please check
#templates of notification for appropriate case - if need, remove text about
Глава 30. Doctor Web – антивирусное программное обеспечение |
437 |
#where original message has been storied.
#Infected - mean that message is infected one of known virus
#Actions:
#cure - cure infected attachment or delete infected part of mes-
sage
# |
(ONLY FOR REGISTERED USERS) |
#quarantine - move such messages to quarantine and discard
# |
(or reject if discard doesnt supported) |
#discard - discard such messages
#reject - reject such messages with permanent error Infected = quarantine
#Suspicious - mean that message possible is infected one of new virus
# |
it may be false alarm (can be only if HeuristicAnalysis |
on) |
|
#Actions:
#pass - pass such messages
#quarantine - move such messages to quarantine and discard
# |
(or reject if discard doesnt supported) |
#discard - discard such messages
#reject - reject such messages with permanent error Suspicious = quarantine
#Incureable - mean that file is infected and cannot be cured
#Actions:
#quarantine - move such messages to quarantine and discard
# |
(or reject if discard doesnt supported) |
#discard - discard such messages
#reject - reject such messages with permanent error Incureable = quarantine
#RuleFilterAlert - mean that message are hits to FiltersRule in drweb32.ini
# |
possible only if RuleFilter = on |
#Actions:
#discard - discard such messages
#quarantine - move such messages to quarantine and discard
# |
|
|
(or reject if discard |
doesnt supported) |
||
# |
reject - |
reject |
such messages with |
permanent error |
||
RuleFilterAlert = |
quarantine |
|
|
|||
# EmptyFrom - mean |
that |
SMTP session initiated with |
empty envelope From: |
|||
# |
used |
for mail notifications (reports) |
and by spammers |
|||
#Actions:
#continue - continue processing such messages
#ATTENTION: Your MTA would not RFC-compliant if you set up
#non-continue action. The MTA MUST accept messages with <> sender
#(rfc-2505 see 2.6.1).
#
#discard - discard such messages
#reject - reject such messages with permanent error EmptyFrom = continue
#SkipObject - mean that daemon found object that cannot be checked:
# |
password protected archive, broken archive, sym-link, |
# |
non regular file |
#Actions:
#pass - pass such messages
#quarantine - move such messages to quarantine and discard
# |
(or reject if discard |
doesnt supported) |
# |
reject - reject such messages with |
permanent error |
SkipObject = pass
438 |
Часть 7. Программное обеспечение для организации службы электронной почты |
||
# ArchiveRestriction - mean that daemon found object in |
archive |
with com- |
|
pression |
|
|
|
# |
ratio exceeded MaxCompressionRation, |
size of |
object |
greater |
|
|
|
# |
that MaxFileSizeToExtract or level of nested |
archive |
|
greater |
|
|
|
# |
that MaxArchiveLevelfrom drweb32.ini |
|
|
#Actions:
#pass - pass such messages
#quarantine - move such messages to quarantine and discard
# |
(or reject if discard doesnt supported) |
#reject - reject such messages with permanent error ArchiveRestriction = reject
#ScanningErrors - mean that daemon fails to scan current object. Example
of
# |
cases: no memory, cannot read file for check (no per- |
missions), |
|
# |
timeout (see SocketTimeout and FileTimeout in |
drweb32.ini). |
|
#Actions:
#pass - pass such messages
#quarantine - move such messages to quarantine and discard
# |
(or reject if discard doesnt supported) |
#reject - reject such messages with permanent error
#tempfail - reject such message with temporary error ScanningErrors = quarantine
#ProcessingErrors - errors in proxy-client: no memory, misconfigured, timeout
# |
on communication with daemon and etc. |
#Actions:
#pass - pass such messages
#reject - reject such messages with permanent error
#tempfail - reject such message with temporary error ProcessingErrors = reject
#Admin mail address (may be unix-local address)
AdminMail = postmaster@bruy.info
#Filter address, that be used in From:
FilterMail = DrWEB-DAEMON@test.bruy.info
#List of unnotificable viruses UnnotificableVirusesList = /etc/drweb/viruses.conf
#List of unnotificable addresses UnnotificableAddressesList = /etc/drweb/addresses.conf
#Quarantine directory.
#The infected files could be moved in that dir
#if you stay this field empty or commented then
#infected messages would not been storied
Quarantine = /var/drweb/infected
# Permissions for quarantined files QuarantineFilesMode = 0660
#########################
#Notifications section #
#########################
[VirusNotifications]
#Enable or disable sending notifications to the persons (yes/no)
Глава 30. Doctor Web – антивирусное программное обеспечение |
439 |
|
SenderNotify = yes |
|
|
AdminNotify = |
yes |
|
RcptsNotify = |
yes |
|
# Files with notification templates |
|
|
AdminTemplate |
= /etc/drweb/templates/en-ru/exim/virus-admin.msg |
|
RcptsTemplate |
= /etc/drweb/templates/en-ru/exim/virus-rcpts.msg |
|
SenderTemplate = /etc/drweb/templates/en-ru/exim/virus-sender.msg |
|
|
[SkipNotifications] |
|
|
SenderNotify = yes |
|
|
AdminNotify = |
no |
|
RcptsNotify = |
no |
|
AdminTemplate |
= |
|
RcptsTemplate |
= |
|
SenderTemplate = /etc/drweb/templates/en-ru/exim/skip-sender.msg |
|
|
[ArchiveRestrictionNotifications] |
|
|
SenderNotify = yes |
|
|
AdminNotify = |
yes |
|
RcptsNotify = |
no |
|
AdminTemplate |
= /etc/drweb/templates/en-ru/exim/archive-admin.msg |
|
RcptsTemplate |
= |
|
SenderTemplate = /etc/drweb/templates/en-ru/exim/archive-sender.msg |
|
|
[ErrorNotifications] |
|
|
SenderNotify = yes |
|
|
AdminNotify = |
yes |
|
RcptsNotify = |
no |
|
AdminTemplate |
= /etc/drweb/templates/en-ru/exim/error-admin.msg |
|
RcptsTemplate |
= |
|
SenderTemplate = /etc/drweb/templates/en-ru/exim/error-sender.msg
###################
#Logging section #
###################
[Logging]
#Logging detalization ( Quiet, Errors, Alerts, Info, Verbose, Debug ) Level = Info
#Facility used for logging to syslog ( Daemon, Mail, Local0..7 ) SyslogFacility = Mail
#Priority used for logging to syslog ( Debug, Info, Notice, Alert ) SyslogPriority = Info
################################
#Mail system settings section #
################################
[Mailer]
#Name of Mail System
MailSystem = Exim
# Submitting program (used to send notifications)
Sendmail = /usr/sbin/exim
Вам следует внести изменения, как минимум, в три строки конфигурационного файла. В строке:
AdminMail = postmaster@bruy.info
следует указать адрес электронной почты администратора почтового севера. В строке:
FilterMail = DrWEB-DAEMON@test.bruy.info
следует указать имя системы, на которой установлен демон Doctor Web. В строке:
440 Часть 7. Программное обеспечение для организации службы электронной почты
Sendmail = /usr/sbin/exim
следует указать местоположение исполняемого файла Exim.
Назначение остальных используемых в файле опций подробно описано на русском и английском язы-
ках в файлах документации /var/tmp/drweb-exim/opt/drweb/doc/exim/conf_file.rus.txt и /var/tmp/drweb-exim/opt/drweb/doc/exim/conf_file.rus.txt, соответственно.
Шаг 2
Определите права доступа к файлу /etc/drweb/drweb_exim.conf и назначьте его владельцем пользователя root:
[root@test /]# chmod 640 /etc/drweb/drweb_exim.conf [root@test /]# chown 0.0 /etc/drweb/drweb_exim.conf
Конфигурационный файл /etc/mail/system-filter
Добавьте в файл /etc/mail/system-filter строки, определяющие фильтры для сообщений, прошедших проверку на содержание вирусов с использованием Doctor Web:
if $received_protocol is "drweb-scanned" then
# looks like a already scanned message finish
endif
if error_message and $header_from: contains "Mailer-Daemon@" then
# looks like a real error message - just ignore it finish
endif
if not first_delivery then
# not first delivery attempt finish
endif
# Dr.Web Filter
pipe "/opt/drweb/drweb-exim --conf=/etc/drweb/drweb_exim.conf -f $sender_address -- $recipients"
finish
Конфигурационный файл /etc/drweb/addresses.conf
Файл /etc/drweb/addresses.conf предназначен для блокировки отправки уведомлений на указанные адреса (или группу адресов) в зависимости от контекста, в котором используется адрес (отправителя, получателя или отправителя и получателя), для передачи сообщений.
Первая строка файла должна содержать запись вида:
[version=NN]
которая означает, что записи содержатся в формате N-й версии файла. Если такой строки нет, то считается, что файл записан в формате 1-й версии.
Остальные строки файла имеют формат:
ROLE ADDRESS_EXPRESSION
где:
параметр ROLE – может принимать значения from, to или both – предназначен для определения контекста, в котором используется адрес, соответственно, отправителя, получателя или отправителя и получателя.
ADDRESS_EXPRESSION – регулярное выражение, определяющее адреса.
Более подробно с вариантами и примерами настроек вы можете ознакомиться, прочитав документацию на русском и английском языках в файлах /var/tmp/drweb-
exim/opt/drweb/doc/exim/addresses_list.rus.txt и /var/tmp/drwebexim/opt/drweb/doc/exim/addresses_list.txt, соответственно.
Шаг 1
