Заставить не проверять исходящую почту Exim + ClamAV + SA

EXIM, sendmail, postfix, Dovecot и прочие. Решение проблем связанных с работой электронной почты

Модератор: xM

Правила форума
Убедительная просьба юзать теги [code] при оформлении листингов.
Сообщения не оформленные должным образом имеют все шансы быть незамеченными.
Аватара пользователя
Gigi
рядовой
Сообщения: 21
Зарегистрирован: 2008-12-18 17:54:55

Заставить не проверять исходящую почту Exim + ClamAV + SA

Непрочитанное сообщение Gigi » 2009-02-17 12:46:49

Доброго времени суток!

Настроил Exim по статье http://www.lissyara.su/?id=1728
только прикрутил еще ClamAV и Spamassassin

это все работает на не очень новенькой машинке)
в результате исходящая почта > 1 мб отправляется ну очень долго...

если отключить ClamAV и Spamassassin письма улетают мгновенно

Код: Выделить всё

acl_check_data:

deny malware = *
message = "Found virus - $malware_name"

warn spam = spamd
        #hosts = !127.0.0.1 : !localhost : * - если раскоментить эту строчку, все равно проверки идут, только заголовки не добавляются
        add_header = X-Spam_score: $spam_score_int

deny message = "We don't need ypur spam"
        #hosts = !127.0.0.1 : !localhost : * - если раскоментить эту строчку, все равно проверки идут
        condition = ${if>{$spam_score_int}{69}{1}{0}

accept
пытался прописать в local.cf спамассассина trusted_networks 192.168.1.0/22 127.0.0.1
он матерится на 127.0.0.1

Код: Выделить всё

warn: netset: cannot include 127.0.0.1/32 as it has already been included
все равно проверяется исходящая почта. Подскажите, в каком месте отключить проверки исходящей почты clamav и spamassassin.
Спасибо
Лучше выпить водки литр, чем не выпить водки литр...

Хостинговая компания Host-Food.ru
Хостинг HostFood.ru
 

Услуги хостинговой компании Host-Food.ru

Хостинг HostFood.ru

Тарифы на хостинг в России, от 12 рублей: https://www.host-food.ru/tariffs/hosting/
Тарифы на виртуальные сервера (VPS/VDS/KVM) в РФ, от 189 руб.: https://www.host-food.ru/tariffs/virtualny-server-vps/
Выделенные сервера, Россия, Москва, от 2000 рублей (HP Proliant G5, Intel Xeon E5430 (2.66GHz, Quad-Core, 12Mb), 8Gb RAM, 2x300Gb SAS HDD, P400i, 512Mb, BBU):
https://www.host-food.ru/tariffs/vydelennyi-server-ds/
Недорогие домены в популярных зонах: https://www.host-food.ru/domains/

Аватара пользователя
estade
мл. сержант
Сообщения: 92
Зарегистрирован: 2008-06-18 11:16:41
Откуда: Челябинск
Контактная информация:

Re: Заставить не проверять исходящую почту Exim + ClamAV + SA

Непрочитанное сообщение estade » 2009-02-17 19:28:15

Полный конфиг экзима и спамассасина в студию
попробуй вместо 127.0.0.1 указать 127/8

Аватара пользователя
dikens3
подполковник
Сообщения: 4856
Зарегистрирован: 2006-09-06 16:24:08
Откуда: Нижний Новгород
Контактная информация:

Re: Заставить не проверять исходящую почту Exim + ClamAV + SA

Непрочитанное сообщение dikens3 » 2009-02-18 10:22:52

Подскажите, в каком месте отключить проверки исходящей почты
Твои пользователи могут отправлять почту как в свой домен, так и во внешний мир. Осюда вопрос - какую исходящую почту ты хочешь исключить из проверок?:
1. Исходящую во внешний мир.
2. Исходящую для моего домена.
3. Обе вместе.

Если требуется пункт 3, тогда определяешь кто именно твои пользователи? Они аутентифицируются? Имеют определённые IP-Адреса?

Я вообще не вижу особых проблем. Что-нибудь типа этого можно сделать:

Код: Выделить всё

deny  !authenticated = *
malware = *
message = "Found virus - $malware_name"
Последний раз редактировалось dikens3 2009-02-18 10:26:31, всего редактировалось 3 раза.
Лучше установить FreeBSD, чем потратить 30 лет на Linux'ы и выяснить какой из них хуже.

Аватара пользователя
Gigi
рядовой
Сообщения: 21
Зарегистрирован: 2008-12-18 17:54:55

Re: Заставить не проверять исходящую почту Exim + ClamAV + SA

Непрочитанное сообщение Gigi » 2009-02-18 10:24:02

попробуй вместо 127.0.0.1 указать 127/8
не канает
подсказали на другом форуме
man Mail::SpamAssassin::Conf :
Note: 127/8 is always included in trusted_networks, regardless
of your config.

exim/configure:

Код: Выделить всё

primary_hostname = mail

hide mysql_servers = localhost/exim/.....

domainlist local_domains = ${lookup mysql{SELECT domain FROM domain WHERE domain='${domain}' AND active='1'}}
domainlist relay_to_domains =${lookup mysql{SELECT domain FROM domain WHERE  domain='${domain}' AND  active='1'}}

hostlist relay_from_hosts = localhost:127.0.0.1/8:192.168.1.0/22

acl_smtp_rcpt = acl_check_rcpt
acl_smtp_data = acl_check_data

av_scanner = clamd:/var/run/clamav/clamd.sock

spamd_address = 127.0.0.1 783

qualify_domain = mail

allow_domain_literals = false
exim_user = mailnull
exim_group = mail
never_users = root

rfc1413_query_timeout = 0s

 sender_unqualified_hosts = +relay_from_hosts
 recipient_unqualified_hosts = +relay_from_hosts

ignore_bounce_errors_after = 25m

timeout_frozen_after = 7d

freeze_tell = admin@yyy.xx
helo_accept_junk_hosts = localhost:127.0.0.1/8:192.168.1.0/22

auto_thaw = 30m

split_spool_directory = true

smtp_banner = ""
smtp_accept_max = 50
smtp_accept_max_per_connection = 25
smtp_accept_max_per_host = 10

helo_allow_chars= _ 
smtp_enforce_sync = false

log_selector = \
    +all_parents \
    +connection_reject \
    +incoming_interface \
    +lost_incoming_connection \
    +received_sender \
    +received_recipients \
    +smtp_confirmation \
    +smtp_syntax_error \
    +smtp_protocol_error \
    -queue_run
syslog_timestamp = no
begin acl
acl_check_rcpt:

  # Accept if the source is local SMTP (i.e. not over TCP/IP). We do this by
  # testing for an empty sending host field.

  accept  hosts =  :
  deny message       = "incorrect symbol in address"
          domains       = +local_domains
          local_parts   = ^[.] : ^.*[@%!/|]
  deny message       = "incorrect symbol in address"
          domains       = !+local_domains
          local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./

  accept  local_parts   = postmaster
          domains       = +local_domains

  require verify        = sender

  deny    message       = "HELO/EHLO require by SMTP RFC"
          condition     = ${if eq{$sender_helo_name}{}{yes}{no}}

  accept  authenticated = *

  deny    message       = "Your IP in HELO - access denied!"
          hosts         =  * : !+relay_from_hosts : !xxx.yy
          condition     = ${if eq{$sender_helo_name}\
    {$sender_host_address}{true}{false}}

  deny    condition     = ${if eq{$sender_helo_name}\
    {$interface_address}{yes}{no}}
          hosts         = !127.0.0.1 : !localhost : *
          message       = "main IP in your HELO! Access denied!"
  deny    condition     = ${if match{$sender_helo_name}\
    {\N^\d+$\N}{yes}{no}}
          hosts         = !127.0.0.1 : !localhost : *
          message       = "can not be only number in HELO!"
  deny    condition     = ${if eq{$sender_address}{}{yes}{no}}
          hosts         = !127.0.0.1 : !localhost : *
          message       = "б ЛБЛПЗП HELO РХУФПЕ?! оЕ РП RFC..."

  deny    condition     = ${if match{$sender_address}{\N^\s+$\N}{yes}{no}}
          hosts         = !127.0.0.1 : !localhost : *
          message       = "б ЛБЛПЗП HELO РХУФПЕ (ФПЛБ РТПВЕМЩ)?! оЕ РП RFC..."
 
  deny    message       = "your hostname is bad (adsl, poll, ppp & etc)."
          condition     = ${if match{$sender_host_name} \
                               {adsl|dialup|pool|peer|dhcp} \
                               {yes}{no}}


  warn
        set acl_m0 = 20s
  warn
        hosts = +relay_from_hosts:127.0.0.1/8:192.168.1.0/22
        set acl_m0 = 0s
  warn
        logwrite = Delay $acl_m0 for $sender_host_name \
[$sender_host_address] with HELO=$sender_helo_name. Mail \
from $sender_address to $local_part@$domain.
        delay = $acl_m0

  accept  domains       = +local_domains
          endpass
          message       = "In my mailserver not stored this user"
          verify        = recipient
  accept  domains       = +relay_to_domains
          endpass
          message       = "main server not know how relay to this address"
          verify        = recipient

  #  deny    message       = "you in blacklist - $dnslist_domain \n $dnslist_text"
  #        dnslists      = opm.blitzed.org : \
  #                        cbl.abuseat.org : \
  #                        bl.csma.biz : \
  #                        dynablock.njabl.org

  accept  hosts         = +relay_from_hosts

  deny    message       = "Rumambaharumambarum!"

acl_check_data:

  # Add headers to a message if it is judged to be spam. Before enabling this,
  # you must install SpamAssassin. You may also need to set the spamd_address
  # option above.
  #

 deny   malware = *
        message = "Found virus -  $malware_name"
        #hosts   =  !192.168.1.0/22

    
 warn    spam       = spamd
	 #hosts	    = !192.168.1.0/22
         add_header = X-Spam_score: $spam_score\n\
                      X-Spam_score_int: $spam_score_int

 deny	 message    = "We don't need your spam"
	 #hosts      = !192.168.1.0/22
	 condition  = ${if>{$spam_score_int}{69}{1}{0}}	
  # Accept the message.

  accept


begin routers

#dnslookup:
#  driver = dnslookup
#  domains = ! +local_domains
#  transport = remote_smtp
#  ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8 : 192.168.1.0/22
#  no_more

send_to_gateway:
    driver = manualroute
    domains = !+local_domains
    transport = remote_smtp 
    route_list = * mail.bbb.yy

system_aliases:
    driver = redirect
    allow_fail
    allow_defer
    data = ${lookup mysql{SELECT `goto` FROM `alias` WHERE `address`='${quote_mysql:$local_part@$domain}' OR `address`='${quote_mysql:@$domain}'}}

dovecot_user:
  driver = accept
  condition = ${lookup mysql{SELECT `goto` FROM `alias` WHERE `address`='${quote_mysql:$local_part@$domain}' OR `address`='${quote_mysql:@$domain}'}{yes}{no}}
  transport = dovecot_delivery


######################################################################
#                      TRANSPORTS CONFIGURATION                      #
######################################################################
#                       ORDER DOES NOT MATTER                        #
#     Only one appropriate transport is called for each delivery.    #
######################################################################

# A transport is used only when referenced from a router that successfully
# handles an address.

begin transports


# This transport is used for delivering messages over SMTP connections.

remote_smtp:
  driver = smtp


# This transport is used for local delivery to user mailboxes in traditional
# BSD mailbox format. By default it will be run under the uid and gid of the
# local user, and requires the sticky bit to be set on the /var/mail directory.
# Some systems use the alternative approach of running mail deliveries under a
# particular group instead of using the sticky bit. The commented options below
# show how this can be done.

dovecot_delivery:
  driver = pipe
  command = /usr/local/libexec/dovecot/deliver -d $local_part@$domain
  message_prefix =
  message_suffix =
  delivery_date_add
  envelope_to_add
  return_path_add
  log_output
  user = mailnull

address_pipe:
  driver = pipe
  return_output

address_reply:
  driver = autoreply


######################################################################
#                      RETRY CONFIGURATION                           #
######################################################################

begin retry

# This single retry rule applies to all domains and all errors. It specifies
# retries every 15 minutes for 2 hours, then increasing retry intervals,
# starting at 1 hour and increasing each time by a factor of 1.5, up to 16
# hours, then retries every 6 hours until 4 days have passed since the first
# failed delivery.

# WARNING: If you do not have any retry rules at all (this section of the
# configuration is non-existent or empty), Exim will not do any retries of
# messages that fail to get delivered at the first attempt. The effect will
# be to treat temporary errors as permanent. Therefore, DO NOT remove this
# retry rule unless you really don't want any retries.

# Address or Domain    Error       Retries
# -----------------    -----       -------

*                      *           F,2h,15m; G,16h,1h,1.5; F,4d,6h



######################################################################
#                      REWRITE CONFIGURATION                         #
######################################################################

# There are no rewriting specifications in this default configuration file.

begin rewrite



######################################################################
#                   AUTHENTICATION CONFIGURATION                     #
######################################################################

# The following authenticators support plaintext username/password
# authentication using the standard PLAIN mechanism and the traditional
# but non-standard LOGIN mechanism, with Exim acting as the server.
# PLAIN and LOGIN are enough to support most MUA software.
#
# These authenticators are not complete: you need to change the
# server_condition settings to specify how passwords are verified.
# They are set up to offer authentication to the client only if the
# connection is encrypted with TLS, so you also need to add support
# for TLS. See the global configuration options section at the start
# of this file for more about TLS.
#
# The default RCPT ACL checks for successful authentication, and will accept
# messages from authenticated users from anywhere on the Internet.

begin authenticators

auth_plain:
  driver = plaintext
  public_name = PLAIN
  server_condition = ${lookup mysql{SELECT `username` FROM `mailbox` WHERE `username` = '${quote_mysql:$auth2}' AND `password` = '${quote_mysql:$auth3}'}{yes}{no}}
  server_prompts = :
  server_set_id = $auth2

auth_login:
  driver = plaintext
  public_name = LOGIN
  server_condition = ${lookup mysql{SELECT `username` FROM `mailbox` WHERE `username` = '${quote_mysql:$auth1}' AND `password` = '${quote_mysql:$auth2}'}{yes}{no}}
  server_prompts = Username:: : Password::
  server_set_id = $auth1

auth_cram_md5:
  driver = cram_md5
  public_name = CRAM-MD5
  server_secret = ${lookup mysql{SELECT `password` FROM `mailbox` WHERE `username` = '${quote_mysql:$auth1}'}{$value}fail}
  server_set_id = $auth2


#PLAIN:
#  driver                     = plaintext
#  server_set_id              = $auth2
#  server_prompts             = :
#  server_condition           = Authentication is not yet configured
#  server_advertise_condition = ${if def:tls_cipher }

# LOGIN authentication has traditional prompts and responses. There is no
# authorization ID in this mechanism, so unlike PLAIN the username and
# password are $auth1 and $auth2. Apart from that you can use the same
# server_condition setting for both authenticators.

#LOGIN:
#  driver                     = plaintext
#  server_set_id              = $auth1
#  server_prompts             = <| Username: | Password:
#  server_condition           = Authentication is not yet configured
#  server_advertise_condition = ${if def:tls_cipher }


######################################################################
#                   CONFIGURATION FOR local_scan()                   #
######################################################################

# If you have built Exim to include a local_scan() function that contains
# tables for private options, you can define those options here. Remember to
# uncomment the "begin" line. It is commented by default because it provokes
# an error with Exim binaries that are not built with LOCAL_SCAN_HAS_OPTIONS
# set in the Local/Makefile.

# begin local_scan


# End of Exim configuration file

local.cf

Код: Выделить всё

# This is the right place to customize your installation of SpamAssassin.
#
# See 'perldoc Mail::SpamAssassin::Conf' for details of what can be
# tweaked.
#
# Only a small subset of options are listed below
#
###########################################################################

#   Add *****SPAM***** to the Subject header of spam e-mails
rewrite_header Subject  SPAM


#   Save spam messages as a message/rfc822 MIME attachment instead of
#   modifying the original message (0: off, 2: use text/plain instead)
#
report_safe 0


#   Set which networks or hosts are considered 'trusted' by your mail
#   server (i.e. not spammers)
#
trusted_networks 192.168.1.0/22

#   Set file-locking method (flock is not safe over NFS, but is faster)
#
# lock_method flock


#   Set the threshold at which a message is considered spam (default: 5.0)
#
 required_score 5.0


#   Use Bayesian classifier (default: 1)
#
# use_bayes 1


#   Bayesian classifier auto-learning (default: 1)
#
# bayes_auto_learn 1


#   Set headers which may provide inappropriate cues to the Bayesian
#   classifier
#
# bayes_ignore_header X-Bogosity
# bayes_ignore_header X-Spam-Flag
# bayes_ignore_header X-Spam-Status

use_razor2 0
cat /var/log/maillog | grep spam :

Код: Выделить всё

Feb 16 10:12:56 inet-serv spamd[966]: spamd: connection from localhost [127.0.0.1] at port 58158
Feb 16 10:12:56 inet-serv spamd[966]: spamd: setuid to spamd succeeded
Feb 16 10:12:56 inet-serv spamd[966]: spamd: checking message (unknown) for spamd:58
Feb 16 10:12:56 inet-serv spamd[966]: spamd: clean message (0.8/5.0) for spamd:58 in 0.4 seconds, 2176 bytes.
Feb 16 10:12:56 inet-serv spamd[966]: spamd: result: . 0 - ALL_TRUSTED,AWL,FH_FROMEML_NOTLD,MISSING_DATE,MISSING_MID scantime=0.4,size=2176,user=spamd,uid=58,required_score=5.0,rhost=localhost,raddr=127.0.0.1,rport=58158,mid=(unknown),autolearn=no
Feb 16 10:12:58 inet-serv spamd[966]: spamd: connection from localhost [127.0.0.1] at port 49487
Feb 16 10:12:58 inet-serv spamd[966]: spamd: setuid to spamd succeeded
Feb 16 10:13:07 inet-serv spamd[966]: spamd: checking message <005901c9900d$f64a5150$0701a8c0@GIGI> for spamd:58
Feb 16 10:13:16 inet-serv spamd[966]: spamd: clean message (2.4/5.0) for spamd:58 in 18.0 seconds, 10055725 bytes.
Feb 16 10:13:16 inet-serv spamd[966]: spamd: result: . 2 - ALL_TRUSTED,AWL,HTML_MESSAGE,MIME_HTML_MOSTLY,MISSING_SUBJECT,TVD_SPACE_RATIO scantime=18.0,size=10055725,user=spamd,uid=58,required_score=5.0,rhost=localhost,raddr=127.0.0.1,rport=49487,mid=<005901c9900d$f64a5150$0701a8c0@GIGI>,autolearn=no

cat /var/log/exim/mainlog :

Код: Выделить всё


2009-02-16 10:13:16 1LZ0Sd-0000Vh-Fk <= admin@xxxxx.xx H=(GIGI) [192.168.1.7] I=[192.168.1.1]:25 P=smtp S=10055644 id=005901c9900d$f64a5150$0701a8c0@GIGI from <admin@xxxxx.xx> for yyyy@xx.xx
...

# интересная строчка... раньше не обращал внимания rrrr.net - мой провайдер, через которого отправляю письма
2009-02-16 10:13:19 no IP address found for host localhost.rrrr.net (during SMTP connection from (inet-serv) [127.0.0.1] I=[127.0.0.1]:25)

Лучше выпить водки литр, чем не выпить водки литр...

Аватара пользователя
Gigi
рядовой
Сообщения: 21
Зарегистрирован: 2008-12-18 17:54:55

Re: Заставить не проверять исходящую почту Exim + ClamAV + SA

Непрочитанное сообщение Gigi » 2009-02-18 10:28:06

Код: Выделить всё

какую исходящую почту ты хочешь исключить из проверок?
Ту, которая уходит во внешний мир

аутентификация только по IP. Т е нужно не проверять всю почту, идущую от 192.168.1.0/22
Лучше выпить водки литр, чем не выпить водки литр...

Аватара пользователя
dikens3
подполковник
Сообщения: 4856
Зарегистрирован: 2006-09-06 16:24:08
Откуда: Нижний Новгород
Контактная информация:

Re: Заставить не проверять исходящую почту Exim + ClamAV + SA

Непрочитанное сообщение dikens3 » 2009-02-18 10:30:02

Код: Выделить всё

deny  !hosts = 192.168.1.0/22
malware = *
message = "Found virus - $malware_name"
Аналогично со spamassasin.
Лучше установить FreeBSD, чем потратить 30 лет на Linux'ы и выяснить какой из них хуже.

Аватара пользователя
Gigi
рядовой
Сообщения: 21
Зарегистрирован: 2008-12-18 17:54:55

Re: Заставить не проверять исходящую почту Exim + ClamAV + SA

Непрочитанное сообщение Gigi » 2009-02-18 10:52:07

dikens3 писал(а):

Код: Выделить всё

deny  !hosts = 192.168.1.0/22
malware = *
message = "Found virus - $malware_name"
Аналогично со spamassasin.
ничего не понимаю... теперь входящая почта тоже не проверяется....
Лучше выпить водки литр, чем не выпить водки литр...

Аватара пользователя
dikens3
подполковник
Сообщения: 4856
Зарегистрирован: 2006-09-06 16:24:08
Откуда: Нижний Новгород
Контактная информация:

Re: Заставить не проверять исходящую почту Exim + ClamAV + SA

Непрочитанное сообщение dikens3 » 2009-02-18 11:07:56

Тема прилеплена, там есть отладка. Пользуйся.
Лучше установить FreeBSD, чем потратить 30 лет на Linux'ы и выяснить какой из них хуже.

Аватара пользователя
estade
мл. сержант
Сообщения: 92
Зарегистрирован: 2008-06-18 11:16:41
Откуда: Челябинск
Контактная информация:

Re: Заставить не проверять исходящую почту Exim + ClamAV + SA

Непрочитанное сообщение estade » 2009-02-18 11:50:55

попробуй вынеси свой домен из проверки
типо whitelist_from *@твой домен