exim: Unrouteable address

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

Модератор: xM

Правила форума
Убедительная просьба юзать теги [code] при оформлении листингов.
Сообщения не оформленные должным образом имеют все шансы быть незамеченными.
Аватара пользователя
skeletor
майор
Сообщения: 2548
Зарегистрирован: 2007-11-16 18:22:04

exim: Unrouteable address

Непрочитанное сообщение skeletor » 2009-09-07 14:26:28

Настраиваю тестовый сервак (связка exim+dovecot, авторизация через dovecot). Домены юзаю локально, дальше сервака никуда не видны. Назвал так: domain.ru, router2.tld. Почему-то почта не хочет пересылаться внутри этого тестового домена. Пишет такое:

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

router2# telnet localhost 25
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 mail.router2.tld ESMTP Exim 4.69 Mon, 07 Sep 2009 11:18:15 +0000
ehlo domain.ru
250-mail.router2.tld Hello domain.ru [10.0.3.132]
250-SIZE 52428800
250-PIPELINING
250-AUTH PLAIN LOGIN CRAM-MD5
250 HELP
mail from:user@domain.ru
250 OK
rctp to:admin@router2.tld
500 unrecognized command
tcpt to:admin@router2.tld
500 unrecognized command
rcpt to:admin@router2.tld
550-Verification failed for <user@domain.ru>
550-Unrouteable address
550 Sender verify failed
в логах такое

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

Sep  7 10:39:12 router2 exim[68336]: [68336] cwd=/usr/local/etc 3 args: send-mail -i user@domain.ru
Sep  7 10:39:12 router2 exim[68336]: [68336] 1Mkbcu-000HmC-Sw <= root@router2.tld U=root P=local S=355 T="test" from <root@router2.tld> for user@domain.ru
Sep  7 10:39:12 router2 exim[68337]: [68337] cwd=/var/spool/exim 3 args: /usr/local/sbin/exim -Mc 1Mkbcu-000HmC-Sw
Sep  7 10:39:12 router2 exim[68337]: [68337] 1Mkbcu-000HmC-Sw ** user@domain.ru F=<root@router2.tld>: Unrouteable address
Sep  7 10:39:12 router2 exim[68338]: [68338] cwd=/var/spool/exim 7 args: /usr/local/sbin/exim -t -oem -oi -f <> -E1Mkbcu-000HmC-Sw
Sep  7 10:39:12 router2 exim[68338]: [68338] 1Mkbcu-000HmE-V9 <= <> R=1Mkbcu-000HmC-Sw U=mailnull P=local S=1159 T="Mail delivery failed: returning message to sender" from <> for root@router2.tld
Пробовал продебажить, но ничего нового:

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

router2# exim -d+route -bt user@domain.ru
Exim version 4.69 (FreeBSD 7.2) uid=0 gid=0 pid=69203 D=fbb95cfd
Probably Berkeley DB version 1.8x (native mode)
Support for: crypteq iconv() IPv6 use_setclassresources PAM Perl Expand_dlfunc OpenSSL Content_Scanning Old_Demime
Lookups: lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmnz dnsdb dsearch mysql nis nis0 passwd
Authenticators: cram_md5 dovecot plaintext spa
Routers: accept dnslookup ipliteral manualroute queryprogram redirect
Transports: appendfile/maildir/mailstore/mbx autoreply lmtp pipe smtp
Fixed never_users: 0
Size of off_t: 8
changed uid/gid: forcing real = effective
  uid=0 gid=0 pid=69203
  auxiliary group list: 0
seeking password data for user "mailnull": using cached result
getpwnam() succeeded uid=26 gid=26
seeking password data for user "root": cache not available
getpwnam() succeeded uid=0 gid=0
configuration file is /usr/local/etc/exim/configure
log selectors = ffffffff 7fffffff
trusted user
admin user
seeking password data for user "mailnull": cache not available
getpwnam() succeeded uid=26 gid=26
seeking password data for user "mailnull": using cached result
getpwnam() succeeded uid=26 gid=26
originator: uid=0 gid=0 login=root name=Charlie Root
sender address = root@mail.router2.tld
Address testing: uid=0 gid=6 euid=0 egid=6
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Testing user@domain.ru
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Considering user@domain.ru
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
routing user@domain.ru
--------> dnslookup router <--------
local_part=user domain=domain.ru
checking domains
search_open: mysql "NULL"
search_find: file="NULL"
  key="SELECT `domain` FROM `transport` WHERE `domain`='domain.ru' " partial=-1 affix=NULL starflags=0
LRU list:
internal_search_find: file="NULL"
  type=mysql key="SELECT `domain` FROM `transport` WHERE `domain`='domain.ru' "
database lookup required for SELECT `domain` FROM `transport` WHERE `domain`='domain.ru'
MySQL query: SELECT `domain` FROM `transport` WHERE `domain`='domain.ru'
MYSQL new connection: host=localhost port=0 socket=NULL database=maildb user=dovecot
lookup yielded: domain.ru
domain.ru in "domain.ru"? yes (matched "domain.ru")
domain.ru in "! +local_domains"? no (matched "! +local_domains")
dnslookup router skipped: domains mismatch
--------> system_aliases router <--------
local_part=user domain=domain.ru
calling system_aliases router
rda_interpret (string): ${lookup{$local_part}lsearch{/etc/aliases}}
search_open: lsearch "/etc/aliases"
search_find: file="/etc/aliases"
  key="user" partial=-1 affix=NULL starflags=0
LRU list:
  ;/etc/aliases
  End
internal_search_find: file="/etc/aliases"
  type=lsearch key="user"
file lookup required for user
  in /etc/aliases
lookup failed
expanded:
file is not a filter file
parse_forward_list:
system_aliases router declined for user@domain.ru
--------> userforward router <--------
local_part=user domain=domain.ru
checking for local user
seeking password data for user "user": cache not available
getpwnam() returned NULL (user not found)
userforward router skipped: user is not a local user
--------> dovecot_user router <--------
local_part=user domain=domain.ru
checking "condition"
search_open: mysql "NULL"
  cached open
search_find: file="NULL"
  key="SELECT `destination` FROM `virtual` WHERE `address`='user@domain.ru' OR `address`='@domain.ru'" partial=-1 affix=NULL starflags=0
LRU list:
  ;/etc/aliases
  End
internal_search_find: file="NULL"
  type=mysql key="SELECT `destination` FROM `virtual` WHERE `address`='user@domain.ru' OR `address`='@domain.ru'"
database lookup required for SELECT `destination` FROM `virtual` WHERE `address`='user@domain.ru' OR `address`='@domain.ru'
MySQL query: SELECT `destination` FROM `virtual` WHERE `address`='user@domain.ru' OR `address`='@domain.ru'
MYSQL using cached connection for localhost/maildb/dovecot
MYSQL: no data found
lookup failed
dovecot_user router skipped: condition failure
no more routers
user@domain.ru is undeliverable: Unrouteable address
search_tidyup called
close MYSQL connection: localhost/maildb/dovecot
>>>>>>>>>>>>>>>> Exim pid=69203 terminating with rc=2 >>>>>>>>>>>>>>>>
Вот конфиг:

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

primary_hostname = mail.router2.tld
hide mysql_servers = localhost/maildb/dovecot/dovecot

domainlist local_domains = ${lookup mysql{SELECT `domain` \
                            FROM `transport` WHERE \
                            `domain`='${domain}' }}

domainlist relay_to_domains = ${lookup mysql{SELECT `domain` \
                            FROM `domain` WHERE \
                            `domain`='${domain}' }}


hostlist   relay_from_hosts = localhost:127.0.0.0/8:192.168.0.0/16

acl_smtp_rcpt = acl_check_rcpt
acl_smtp_data = acl_check_data

daemon_smtp_ports = 25

qualify_domain = mail.router2.tld
qualify_recipient = mail.router2.tld

exim_user = mailnull
exim_group = mail
never_users = root

rfc1413_query_timeout = 5s

sender_unqualified_hosts = +relay_from_hosts
recipient_unqualified_hosts = +relay_from_hosts

host_lookup = *

ignore_bounce_errors_after = 2d
timeout_frozen_after = 7d

log_selector = +all \

syslog_timestamp = no



begin acl

acl_check_rcpt:

   accept  hosts = :

  deny    message       = Restricted characters in address
          domains       = +local_domains
          local_parts   = ^[.] : ^.*[@%!/|]

  deny    message       = Restricted characters in address
          domains       = !+local_domains
          local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./

  accept  local_parts   = postmaster
          domains       = +local_domain

  require verify        = sender

  accept  hosts         = +local_domains : +relay_from_hosts
          control       = submission

  accept  authenticated = *
          control       = submission

  require message = relay not permitted
          domains = +local_domains : +relay_to_domain

  require verify = recipient

  accept



acl_check_data:

  accept


begin routers

dnslookup:
  driver = dnslookup
  domains = ! +local_domains
  transport = remote_smtp
  ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8 : 10.0.3.132/32
  no_more

system_aliases:
  driver = redirect
  allow_fail
  allow_defer
  data = ${lookup{$local_part}lsearch{/etc/aliases}}
  user = mailnull
  group = mail
  file_transport = address_file
  pipe_transport = address_pipe

userforward:
  driver = redirect
  check_local_user
  file = $home/.forward
  no_verify
  no_expn
  check_ancestor
  file_transport = address_file
  pipe_transport = address_pipe
  reply_transport = address_reply
  condition = ${if exists{$home/.forward} {yes} {no} }

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


begin transports

remote_smtp:
  driver = smtp


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_file:
  driver = appendfile
  delivery_date_add
  envelope_to_add
  return_path_add



address_reply:
  driver = autoreply




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


begin rewrite


begin authenticators

auth_plain:
   driver = dovecot
   public_name = PLAIN
   server_socket = /var/run/dovecot/auth-client
   server_set_id = $auth1

auth_login:
   driver = dovecot
   public_name = LOGIN
   server_socket = /var/run/dovecot/auth-client
   server_set_id = $auth1

auth_cram_md5:
  driver = dovecot
  public_name = CRAM-MD5
  server_socket = /var/run/dovecot/auth-client
  server_set_id = $auth1
Вот БД, где находяться домены:

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

router2# mysql maildb -e "select * from transport;"
+----+------------------+-------------+
| id | domain           | destination |
+----+------------------+-------------+
|  1 | router2.tld      | virtual:    |
|  2 | mail.router2.tld | local:      |
|  3 | domain.ru        | virtual:    |
+----+------------------+-------------+
router2#
сервак называется mail.router2.tld

Где накосячил, а то уже 3-ий день бьюсь, не могу понять в чём проблема.

Хостинговая компания 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/

Аватара пользователя
manefesto
Группенфюррер
Сообщения: 6934
Зарегистрирован: 2007-07-20 8:27:30
Откуда: Пермь
Контактная информация:

Re: exim: Unrouteable address

Непрочитанное сообщение manefesto » 2009-09-07 19:56:06

а named настроен ?
я такой яростный шо аж пиздеЦ
Изображение

Аватара пользователя
skeletor
майор
Сообщения: 2548
Зарегистрирован: 2007-11-16 18:22:04

Re: exim: Unrouteable address

Непрочитанное сообщение skeletor » 2009-09-07 21:15:34

Ну я ж хочу, что бы у меня домены были виртуальными, то есть он их ищет в БД, находит и ложит у себя на серваке письма в соответствующие папки. Никаких писем на mail.ru и прочие внешние домены не нужно.

Аватара пользователя
skeletor
майор
Сообщения: 2548
Зарегистрирован: 2007-11-16 18:22:04

Re: exim: Unrouteable address

Непрочитанное сообщение skeletor » 2009-09-08 12:47:04

Разобрался.
Проблема была в настройках доставки, а не в доменах. Неправильно указывал условие доставки в

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

dovecot_user:
  driver = accept
  condition = ${lookup mysql{SELECT `destination` FROM \
  `virtual` WHERE \
  `address`='${quote_mysql:$local_part@$domain}' OR \
  `address`='${quote_mysql:@$domain}'}{yes}{no}}
  transport = dovecot_delivery 
изменил на правильное - и заработало.