Страница 1 из 1

Проблема с превышением кол-ва отсылки на релей

Добавлено: 2009-05-20 10:35:09
3t0n
Возникла такая проблема:

Freebsd + postfix

Сервер устанавливает соединения с релеем mail.domain.ru и шлет сразу тучу писем накопившехся.
Но там стоит ограничение, которое довольно часто превышается и мой сервак просто блокирует.

Выдержка из mailq
(host mail.domain.ru[2хх.х2.3х.3х] refused to talk to me: 421 4.3.2 Connection rate limit exceeded.)

как и где ограничить выстрел сообщений на релей в сек?

За ранее спасибо!

Re: Проблема с превышением кол-ва отсылки на релей

Добавлено: 2009-05-20 10:38:43
Alex Keda
перейти на экзим?

Re: Проблема с превышением кол-ва отсылки на релей

Добавлено: 2009-05-20 10:59:01
3t0n
lissyara писал(а):перейти на экзим?
займет время, настройка + прикрутка антивиря + сапамассасина, проще параметр какойто прикрутить в конфиг кстати

main.cf

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

# Global Postfix configuration file. This file lists only a subset
# of all 300+ parameters. See the sample-xxx.cf files for a full list.
#
# The general format is lines with parameter = value pairs. Lines
# that begin with whitespace continue the previous line. A value can
# contain references to other $names or ${name}s.
#
# NOTE - CHANGE NO MORE THAN 2-3 PARAMETERS AT A TIME, AND TEST IF
# POSTFIX STILL WORKS AFTER EVERY CHANGE.

# LOCAL PATHNAME INFORMATION

queue_directory = /var/spool/postfix

command_directory = /usr/local/sbin

daemon_directory = /usr/local/libexec/postfix

# QUEUE AND PROCESS OWNERSHIP

mail_owner = postfix

# SENDING MAIL

myorigin = a1tis.ru
#smtp_bind_address=2x.xxx.xx

# RECEIVING MAIL

inet_interfaces = 192.168.3.254, xxx.xxx.xx.xxx, 192.168.100.1, 127.0.0.1, 192.168.0.1
mydestination = my_domain.ru my_domain1.ru my_domain2.ru my_domain3.ru


#smtpd_sender_restrictions = permit_myneworks,reject_unknown_sender_domain,reject_unknown_client
#smtpd_helo_required = yes
#smtpd_client_restrictions = permit_myneworks,reject_unknown_client

# REJECTING MAIL FOR UNKNOWN LOCAL USERS

#local_recipient_maps =
local_recipient_maps = hash:/usr/local/etc/postfix/local_recipients

unknown_local_recipient_reject_code = 550

# TRUST AND RELAY CONTROL

mynetworks = 192.168.3.0/24, 192.168.100.0/24, 192.168.101.4, 192.168.102.0/24, 127.0.0.0/8



#smtpd_client_restrictions = hash:/usr/local/etc/postfix/clients_without_dns,permit_mynetworks,reject_unknown_client
#unknown_client_reject_code = 450




# TRANSPORT MAP

relayhost = mail.domain.ru:25

transport_maps = hash:/usr/local/etc/postfix/transport

smtp_destination_concurrency_limit = 19
default_destination_concurrency_limit = 19

# SHOW SOFTWARE VERSION OR NOT

smtpd_banner = $myhostname ESMTP $mail_name

message_size_limit = 20480000

# TLS encryption setings
smtpd_use_tls = yes
smtpd_enforce_tls = no
smtpd_tls_cert_file = /usr/local/etc/postfix/tls/mail_a1tis_ru.cert
smtpd_tls_key_file = /usr/local/etc/postfix/tls/mail_a1tis_ru.key
#smtpd_tls_cert_file = /usr/local/etc/postfix/tls/mail_a1tis_ru.cert
#smtpd_tls_key_file = /usr/local/etc/postfix/tls/mail_a1tis_ru.key
smtpd_tls_loglevel = 1
smtpd_tls_ask_ccert = yes
smtpd_tls_req_ccert = no
smtpd_starttls_timeout = 900s

smtp_tls_cert_file = /usr/local/etc/postfix/tls/mail_a1tis_ru.cert
smtp_tls_key_file = /usr/local/etc/postfix/tls/mail_a1tis_ru.key
#smtp_tls_cert_file = /usr/local/etc/postfix/tls/mail_a1tis_ru.cert
#smtp_tls_key_file = /usr/local/etc/postfix/tls/mail_a1tis_ru.key
smtp_tls_loglevel = 1
smtp_use_tls = yes
smtp_enforce_tls = no
smtp_tls_enforce_peername = no
smtp_starttls_timeout = 900s



# DEBUGGING CONTROL

debug_peer_level = 5

debugger_command =
         PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
         xxgdb $daemon_directory/$process_name $process_id & sleep 5
notify_classes =

# INSTALL-TIME CONFIGURATION INFORMATION

sendmail_path = /usr/local/sbin/sendmail

newaliases_path = /usr/local/bin/newaliases

mailq_path = /usr/local/bin/mailq

setgid_group = maildrop

manpage_directory = /usr/local/man

sample_directory = /usr/local/etc/postfix

readme_directory = no
html_directory = no

body_checks = pcre:/usr/local/etc/postfix/body_checks


master.cf

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

#
# Postfix master process configuration file.  Each logical line
# describes how a Postfix daemon program should be run.
#
# ==========================================================================
# service type      private unpriv  chroot  wakeup  maxproc command + args
#                    (yes)  (yes)    (yes)  (never) (100)
# ==========================================================================

#192.168.0.1:smtp      inet  n       -       n       -       -       smtpd
#-o content_filter=av_filter:dummy
#192.168.3.254:smtp    inet  n       -       n       -       -       smtpd

192.168.100.1:smtp    inet  n       -       n       -       -       smtpd -o smtp_destination_concurrency_limit=19
#-o content_filter=av_filter:dummy
127.0.0.1:smtp        inet  n       -       n       -       -       smtpd
xxx.xxx.xxx.xxx:smtp    inet  n       -       n       -       -       smtpd -o content_filter=av_filter:dummy
                                                                          -o smtp_destination_concurrency_limit=19

#-o content_filter=av_filter:dummy
#       -o smtpd_helo_required=yes
#       -o smtpd_sender_restrictions=reject_unknown_sender_domain
#xxx.xxx.xxx.xxx:smtp    inet  n       -       n       -       -       smtpd
#192.168.100.21:smtp   inet  n       -       n       -       -       smtpd
#       -o content_filter=av_filter:dummy
#       -o smtpd_helo_required=yes
#       -o smtpd_sender_restrictions=reject_unknown_sender_domain,reject_unknown_client
#628                  inet  n       -       n       -       -       qmqpd
pickup                fifo  n       -       n       60      1       pickup
cleanup               unix  n       -       n       -       0       cleanup
qmgr                  fifo  n       -       n       300     1       qmgr
#qmgr                 fifo  n       -       n       300     1       nqmgr
rewrite               unix  -       -       n       -       -       trivial-rewrite
bounce                unix  -       -       n       -       0       bounce
defer                 unix  -       -       n       -       0       bounce
flush                 unix  n       -       n       1000?   0       flush
proxymap              unix  -       -       n       -       -       proxymap
smtp                  unix  -       -       n       -       -       smtp
relay                 unix  -       -       n       -       -       smtp

#-o smtp_helo_timeout=5 -o smtp_connect_timeout=5

showq                 unix  n       -       n       -       -       showq
error                 unix  -       -       n       -       -       error
local                 unix  -       n       n       -       -       local
virtual               unix  -       n       n       -       -       virtual
lmtp                  unix  -       -       n       -       -       lmtp
#
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# maildrop. See the Postfix MAILDROP_README file for details.
#
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
#
# The Cyrus deliver program has changed incompatibly, multiple times.
#
old-cyrus unix  -       n       n       -       -       pipe
  flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
# Cyrus 2.1.5 (Amos Gouaux)
cyrus     unix  -       n       n       -       -       pipe
  user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
ifmail    unix  -       n       n       -       -       pipe
  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp     unix  -       n       n       -       -       pipe
  flags=Fq. user=foo argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient

av_filter    unix  -       n       n       -       -       pipe flags=R user=drweb argv=/usr/local/bin/av_filter.sh -f ${sender} -- ${recipient}

trace     unix  -       -       n       -       0       bounce
verify    unix  -       -       n       -       1       verify
anvil     unix  -       -       n       -       1       anvil
scache    unix  -       -       n       -       1       scache
discard   unix  -       -       n       -       -       discard
tlsmgr    unix  -       -       n       1000?   1       tlsmgr

Re: Проблема с превышением кол-ва отсылки на релей

Добавлено: 2009-05-20 14:19:20
moury
ИМХО важнее ограничивать не частоту исходящих соединений, а количество одновременных соединений.

Первый подобный параметр, который попался в доке на постфикс - smtp_destination_concurrency_limit.
smtp_destination_concurrency_limit (default: $default_destination_concurrency_limit)

The maximal number of parallel deliveries to the same destination via the smtp message delivery transport. This limit is enforced by the queue manager. The message delivery transport name is the first field in the entry in the master.cf file.
Может, этот параметр Вам подойдет.

Re: Проблема с превышением кол-ва отсылки на релей

Добавлено: 2009-05-20 14:24:25
3t0n
moury писал(а):ИМХО важнее ограничивать не частоту исходящих соединений, а количество одновременных соединений.

Первый подобный параметр, который попался в доке на постфикс - smtp_destination_concurrency_limit.
smtp_destination_concurrency_limit (default: $default_destination_concurrency_limit)

The maximal number of parallel deliveries to the same destination via the smtp message delivery transport. This limit is enforced by the queue manager. The message delivery transport name is the first field in the entry in the master.cf file.
Может, этот параметр Вам подойдет.
в конфиге в разделе # TRANSPORT MAP

он есть и в master.cf засунул, куда правильней то? и не помогает

Re: Проблема с превышением кол-ва отсылки на релей

Добавлено: 2009-05-20 18:19:00
moury

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

smtp_destination_concurrency_limit = 19
Как бы это сказать.. Я, пожалуй, тоже отправлю лесом хост, который попытается поднять на меня больше десятка входящих SMTP-сессий.

Уменьшите это число для начала до 10.