Мы переносим наш почтовый сервер с EXIM и боремся с электронными письмами, генерируемыми на хост-сервере, такими как веб-формы и системные сообщения, поскольку они не доставляются на новый хост.
Я ищу сценарий маршрутизации, который в основном остановит ВСЕ локальную доставку и доставит все электронные письма @ domain.com на наш новый сервер hqmail.domain.com
Однако есть одно предостережение, если это действительно так - у нас осталась одна функция для этого сервера, она адресуется напрямую встроенным устройством, которое знает свой IP-адрес, и оно использует сервер для отправки статусных сообщений с alerts@domain.com на recipent@theirdomain.com Этот пользователь находится в базе данных mysql и имеет сложную систему контроля отказов.
Я увидел, что в нашей базе данных vmail.user есть столбцы маршрута и маршрутизатора, и попытался установить их в 1, логика мышления hqmail.mydomain.com где-то была, но, похоже, ее не существует. Это было бы очень просто!
Итак, теперь я просматриваю файлы 00_exim4-config в каталоге маршрутизатора и, честно говоря, совершенно не понимаю, как это сделать.
Во время просмотра я вижу, что есть много способов сделать это, для меня было бы проще использовать логику маршрутизации / маршрутизации, которую я нашел в моем файле 200_exim4-config_primary
# Relay Router
smart_route:
driver = manualroute
condition = ${if eq{}{${lookup mysql {SELECT id FROM users WHERE id='${sender_address}' AND routed=1 }}}{no}{yes}}
transport = remote_smtp
route_data = ${lookup mysql {SELECT route FROM users WHERE id='${sender_address}' AND routed=1 }}
Это похоже на то, что я хочу, но если я установлю routed = 1 и помещу hqmail.mydomain.com в поле маршрута, это не сработает.
Мне интересно, не работает ли это, потому что это находится над ним в файле:
dnslookup_relay_to_domains:
debug_print = "R: dnslookup_relay_to_domains for $local_part@$domain"
driver = dnslookup
errors_to = bounce_control
condition = ${if eq{}{${lookup mysql {SELECT id FROM users WHERE id='${sender_address}' }}}{no}{yes}}
domains = ! +local_domains : +relay_to_domains
transport = remote_smtp
same_domain_copy_routing = yes
no_more
Любая помощь будет оценена по достоинству!
Вот полный файл 200_exim-4_primary:
### router/200_exim4-config_primary
#################################
# This file holds the primary router, responsible for nonlocal mails
.ifdef DCconfig_internet
# configtype=internet
#
# deliver mail to the recipient if recipient domain is a domain we
# relay for. We do not ignore any target hosts here since delivering to
# a site local or even a link local address might be wanted here, and if
# such an address has found its way into the MX record of such a domain,
# the local admin is probably in a place where that broken MX record
# could be fixed.
dnslookup_relay_to_domains:
debug_print = "R: dnslookup_relay_to_domains for $local_part@$domain"
driver = dnslookup
errors_to = bounce_control
condition = ${if eq{}{${lookup mysql {SELECT id FROM users WHERE id='${sender_address}' }}}{no}{yes}}
domains = ! +local_domains : +relay_to_domains
transport = remote_smtp
same_domain_copy_routing = yes
no_more
#mysql_autorespond:
# driver = accept
# no_verify
# no_expn
# debug_print = "auto responder lookup for $local_part@$domain"
# senders = "! ^.*-request@.*:\
# ! ^owner-.*@.*:\
# ! ^root@.*:\
# ! ^postmaster@.*:\
# ! ^listmaster@.*:\
# ! ^mailer-daemon@.*"
# condition = ${if eq{} {${lookup mysql{SELECT activ FROM responder WHERE \
# ((username='$local_part' AND domain='$domain') OR (username='$local_part_prefix' AND domain='$local_part_suffix')) \
# AND (sender ='$sender_address' or sender ='$reply_address' or sender ='*') \
# AND activ='YES' AND valid_from <= now() AND valid_to >= now() ORDER BY sender DESC LIMIT 1 }}}{NO}{YES}}
# unseen
# transport = autorespond_mysql
# deliver mail directly to the recipient. This router is only reached
# for domains that we do not relay for. Since we most probably can't
# have broken MX records pointing to site local or link local IP
# addresses fixed, we ignore target hosts pointing to these addresses.
# Relay Router
smart_route:
driver = manualroute
condition = ${if eq{}{${lookup mysql {SELECT id FROM users WHERE id='${sender_address}' AND routed=1 }}}{no}{yes}}
transport = remote_smtp
route_data = ${lookup mysql {SELECT route FROM users WHERE id='${sender_address}' AND routed=1 }}
dnslookup:
debug_print = "R: dnslookup for $local_part@$domain"
driver = dnslookup
condition = ${if eq{}{${lookup mysql {SELECT id FROM users WHERE id='${sender_address}' }}}{no}{yes}}
#errors_to = bounce_control
domains = ! +local_domains
transport = remote_smtp
same_domain_copy_routing = yes
# ignore private rfc1918 and APIPA addresses
ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8 : 192.168.0.0/16 :\
172.16.0.0/12 : 10.0.0.0/8 : 169.254.0.0/16 :\
255.255.255.255
no_more
#denied_lookup:
# debug_print = "R: DENIED"
# driver = redirect
# transport = bounce_control_pipe
# no_more
.endif
.ifdef DCconfig_local
# configtype=local
#
# Stand-alone system, so generate an error for mail to a non-local domain
nonlocal:
debug_print = "R: nonlocal for $local_part@$domain"
driver = error
domains = ! +local_domains
allow_fail
data = :fail: Mailing to remote domains not supported
no_more
.endif
.ifdef DCconfig_smarthost DCconfig_satellite
# configtype=smarthost or configtype=satellite
#
# Send all non-local mail to a single other machine (smarthost).
#
# This means _ALL_ non-local mail goes to the smarthost. This will most
# probably not do what you want for domains that are listed in
# relay_domains. The most typical use for relay_domains is to control
# relaying for incoming e-mail on secondary MX hosts. In that case,
# it doesn't make sense to send the mail to the smarthost since the
# smarthost will probably send the message right back here, causing a
# loop.
#
# If you want to use a smarthost while being secondary MX for some
# domains, you'll need to copy the dnslookup_relay_to_domains router
# here so that mail to relay_domains is handled separately.
smarthost:
debug_print = "R: smarthost for $local_part@$domain"
driver = manualroute
domains = ! +local_domains
transport = remote_smtp_smarthost
route_list = * DCsmarthost byname
host_find_failed = defer
same_domain_copy_routing = yes
no_more
.endif
# The "no_more" above means that all later routers are for
# domains in the local_domains list, i.e. just like Exim 3 directors.
Их должно быть два; Ни больше ни меньше:
begin routers
alerts:
driver = accept
condition = ${if eq{$local_part@$domain}{'recipent@theirdomain.com'}{yes}{no}}
condition = ${if eq{$sender_address}{'alert@domain.com'}{yes}{no}}
transport = remote_smtp
migrator:
driver = manualroute
condition = ${if eq{$domain}{'domain.com'}{yes}{no}}
transport = remote_smtp
route_data = hqmail.domain.com
cannot_route_message = User unknown
# end routers
Надеюсь, это поможет.