Hello all,
I try to understand Postfix's relaying behaviour but I'm struggling with
the last guy in the chain called smtp. It simply ignores the decision of
his very smart precursor, named trivial-rewrite.
Inspecting the log, trivial-rewrite uses transport_maps and
sender_dependent_relayhost_maps to correctly identify 1.1.1.1 as next
hop. But then, managed by qmgr, smtp takes over and chooses either
4.4.4.1 (relayhost in main.cf) or resolves the next hop via DNS (if no
relayhost in main.cf):
Jul 8 10:29:19 localhost
postfix/submission-rewrite/trivial-rewrite[103626]: maps_find:
address_verify_transport_maps:
hash:/etc/postfix/transport_to_exo_domains(0,lock|no_regsub|fold_fix|utf8_request):
* = relay:[1.1.1.3]
Jul 8 10:29:19 localhost
postfix/submission-rewrite/trivial-rewrite[103626]:
wildcard_{chan:hop}={relay:[1.1.1.3]}
Jul 8 10:29:19 localhost
postfix/submission-rewrite/trivial-rewrite[103626]: maps_find:
transport_maps:
hash:/etc/postfix/transport_to_exo_domains(0,lock|no_regsub|fold_fix|utf8_request):
mydomain.com = relay:[1.1.1.1]
Jul 8 10:29:19 localhost
postfix/submission-rewrite/trivial-rewrite[103626]: mail_addr_find:
te...@mydomain.com -> relay:[1.1.1.1]
Jul 8 10:29:19 localhost
postfix/submission-rewrite/trivial-rewrite[103626]: `' ->
`te...@mydomain.com' -> (`relay' `[1.1.1.1]' `te...@mydomain.com' `4096')
Jul 8 10:29:19 localhost
postfix/submission-rewrite/trivial-rewrite[103626]: send attr transport
= relay
Jul 8 10:29:19 localhost
postfix/submission-rewrite/trivial-rewrite[103626]: send attr nexthop =
[1.1.1.1]
Jul 8 10:29:20 localhost
postfix/submission-rewrite/trivial-rewrite[103626]: maps_find:
sender_dependent_relayhost_maps:
hash:/etc/postfix/transport_to_senders_relay(0,lock|no_regsub|fold_fix|utf8_request):
@mydomain.com = relay:[2.2.2.1]
Jul 8 10:29:20 localhost
postfix/submission-rewrite/trivial-rewrite[103626]: mail_addr_find:
te...@mydomain.com -> relay:[2.2.2.1]
Jul 8 10:29:20 localhost
postfix/submission-rewrite/trivial-rewrite[103626]: maps_find:
transport_maps:
hash:/etc/postfix/transport_to_exo_domains(0,lock|no_regsub|fold_fix|utf8_request):
mydomain.com = relay:[1.1.1.1]
Jul 8 10:29:20 localhost
postfix/submission-rewrite/trivial-rewrite[103626]: mail_addr_find:
te...@mydomain.com -> relay:[1.1.1.1]
Jul 8 10:29:20 localhost
postfix/submission-rewrite/trivial-rewrite[103626]: `te...@mydomain.com'
-> `te...@mydomain.com' -> (`relay' `[1.1.1.1]' `te...@mydomain.com' `4096')
Jul 8 10:29:20 localhost
postfix/submission-rewrite/trivial-rewrite[103626]: send attr nexthop =
[1.1.1.1]
# -----------------------------------> So far, so perfect, but then smtp
goes wrong!
# If relayhost=[4.4.4.1] in main.cf
Jul 8 10:29:20 localhost postfix/smtp[103629]: smtp socket: wanted
attribute: nexthop
Jul 8 10:29:20 localhost postfix/smtp[103629]: input attribute name:
nexthop
Jul 8 10:29:20 localhost postfix/smtp[103629]: input attribute value:
[4.4.4.1]
Jul 8 10:29:20 localhost postfix/smtp[103629]: smtp_parse_destination:
[4.4.4.1] smtp
# Or without relayhost in main.cf, DNS resolution is used
Jul 8 10:26:07 localhost postfix/smtp[103317]: smtp socket: wanted
attribute: nexthop
Jul 8 10:26:07 localhost postfix/smtp[103317]: input attribute name:
nexthop
Jul 8 10:26:07 localhost postfix/smtp[103317]: input attribute value:
mydomain.com
Jul 8 10:26:07 localhost postfix/smtp[103317]: dns_query: mydomain.com
(MX): OK
Jul 8 10:26:07 localhost postfix/smtp[103317]: dns_get_answer: type MX
for mydomain.com
Jul 8 10:26:07 localhost postfix/smtp[103317]: smtp_addr_one: host
mydomain-com03c.mail.protection.outlook.com
As I read smtp.8.html and qmgr.8.html, I cannot overwrite smtp's nexthop
decision. If nexthop is set correctly by trivial-rewrite, what goes
wrong with smtp (or maybe qmgr)?
Thank you very much for your help.
Josef