Postfix: check_recipient_mx_access 사용 시 잘못된 수신자에게 라우팅이 적용됨

Postfix: check_recipient_mx_access 사용 시 잘못된 수신자에게 라우팅이 적용됨

저는 check_recipient_mx_access를 사용하여 모든 office365 호스팅 또는 Google 호스팅 도메인을 [SPF, DMARC 등] 특수 이메일 게이트웨이로 라우팅할 수 있습니다.

smtpd_recipient_restrictions = ..., check_recipient_mx_access hash:/etc/postfix/mx_access,...

/etc/postfix/mxaccess에서

 .protection.outlook.com FILTER smtp:[IP.AD.DR.ESS]
 .google.com FILTER smtp:[IP.AD.DR.ESS]

이는 모든 단일 수신자에게 잘 작동하지만 수신자가 여러 명인 경우 실패하는 경우가 있습니다.

예를 들어 sender@mydom이 dest1@hotmail AND dest2@mydom2로 보내면 dest2@mydom2가 [IP.AD.DR.ESS]로 전달되는데 이는 잘못된 것입니다.

첫 번째 수신자에게는 괜찮습니다. 왜냐하면 MX가 Something.protection.outlook.com을 해결하지만 두 번째 수신자는 그렇지 않기 때문입니다. 왜냐하면 mydom2는 이 경우에 사용되지 않는 Transport_maps에 특별한 라우팅을 갖고 있고 해당 MX가 일치하는 항목을 확인하지 않기 때문입니다. mxaccess 테이블.

[수신자가 dest2@mydom2만 있으면 라우팅 OK]

[mxaccess와 일치하지 않고 @mydom2 @mydom3 대상이 여러 개 있으면 라우팅은 괜찮습니다.]

주의: 이것은 우분투의 postfix 3.3.0입니다.

postconf -M
smtp       inet  n       -       -       -       -       smtpd
pickup     fifo  n       -       -       60      1       pickup
cleanup    unix  n       -       -       -       0       cleanup
qmgr       fifo  n       -       n       300     1       qmgr
tlsmgr     unix  -       -       -       1000?   1       tlsmgr
rewrite    unix  -       -       -       -       -       trivial-rewrite
bounce     unix  -       -       -       -       0       bounce
defer      unix  -       -       -       -       0       bounce
trace      unix  -       -       -       -       0       bounce
verify     unix  -       -       -       -       1       verify
flush      unix  n       -       -       1000?   0       flush
proxymap   unix  -       -       n       -       -       proxymap
smtp       unix  -       -       -       -       -       smtp
relay      unix  -       -       -       -       -       smtp -o fallback_relay=
showq      unix  n       -       -       -       -       showq
error      unix  -       -       -       -       -       error
discard    unix  -       -       -       -       -       discard
local      unix  -       n       n       -       -       local
virtual    unix  -       n       n       -       -       virtual
lmtp       unix  -       -       -       -       -       lmtp
anvil      unix  -       -       -       -       1       anvil
scache     unix  -       -       -       -       1       scache
maildrop   unix  -       n       n       -       -       pipe flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
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=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix - n       n       -       2       pipe flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman    unix  -       n       n       -       -       pipe flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user}
retry      unix  -       -       -       -       -       error
policyd-spf unix -       n       n       -       0       spawn user=policyd-spf argv=/usr/sbin/postfix-policyd-spf-perl


~# postconf -n
alias_database = hash:/etc/postfix/aliases
alias_maps = hash:/etc/postfix/aliases
command_directory = /usr/sbin
compatibility_level = 2
debug_peer_level = 2
debugger_command = PATH=/usr/bin:/usr/X11R6/bin xxgdb $daemon_directory/$process_name $process_id & sleep 5
inet_interfaces = all
local_recipient_maps =
mail_owner = postfix
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
message_size_limit = 20480000
mydestination = $myhostname, localhost.$mydomain, penty.of.domains.tld
mynetworks = 172.16.0.0/16, 192.168.10.0/24, 127.0.0.0/8, 10.0.0.0/24
myorigin = /etc/mailname
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-1.1.12/README_FILES
recipient_delimiter = +
relayhost =
sample_directory = /usr/share/doc/postfix-1.1.12/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_recipient_restrictions = reject_invalid_hostname, check_recipient_mx_access hash:/etc/postfix/mxaccess, permit_mynetworks, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_non_fqdn_sender, check_recipient_access hash:/etc/postfix/recipientaccess, reject_unauth_pipelining, reject_unauth_destination, reject_unverified_recipient, check_sender_access hash:/etc/postfix/senderaccess, reject_unknown_sender_domain, reject_rbl_client sbl.spamhaus.org, reject_rbl_client psbl.surriel.com, reject_rbl_client bl.spamcop.net, reject_rbl_client dnsbl-3.uceprotect.net, check_policy_service inet:127.0.0.1:60000, check_policy_service unix:private/policyd-spf, permit
smtpd_relay_restrictions = reject_invalid_hostname, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unknown_recipient_domain, permit_mynetworks, reject_unknown_sender_domain, reject_unauth_pipelining, reject_unauth_destination, check_recipient_access hash:/etc/postfix/recipientaccess, reject_unverified_recipient, check_sender_access hash:/etc/postfix/senderaccess, reject_rbl_client sbl.spamhaus.org, reject_rbl_client psbl.surriel.com, reject_rbl_client bl.spamcop.net, reject_rbl_client dnsbl-3.uceprotect.net, check_policy_service inet:127.0.0.1:60000, check_policy_service unix:private/policyd-spf, permit
smtpd_tls_cert_file = /etc/letsencrypt/live/XXXXXXXXXXXXXXX/fullchain.pem
smtpd_tls_ciphers = high
smtpd_tls_key_file = /etc/letsencrypt/live/XXXXXXXXXXXXXXX/privkey.pem
smtpd_tls_loglevel = 1
smtpd_tls_protocols = !SSLv2, !SSLv3
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
transport_maps = hash:/etc/postfix/transport
virtual_alias_domains = XXXXXXXXXX
virtual_alias_maps = regexp:/etc/postfix/virtual_re

답변1

첫 번째 수신자에게는 괜찮습니다. 왜냐하면 MX가 Something.protection.outlook.com을 해결하지만 두 번째 수신자는 그렇지 않기 때문입니다. 왜냐하면 mydom2는 이 경우에 사용되지 않는 Transport_maps에 특별한 라우팅을 갖고 있고 해당 MX가 일치하는 항목을 확인하지 않기 때문입니다. mxaccess 테이블.

내가 찾은 텍스트는 다음과 같습니다.

  • 메시지가 둘 이상의 필터 작업을 트리거하는 경우 마지막 필터 작업만 적용됩니다.
  • 해당 메시지의 모든 수신자에게 동일한 콘텐츠 필터가 적용됩니다.

에:http://www.postfix.org/FILTER_README.html#dynamic_filter

관련 정보