transport auf basis von sender und receiver bestimmen

Patrick Landolt patrick.landolt at artack.ch
Do Jun 22 15:02:52 CEST 2017


Ich versuche folgendes setup zu erreichen:

1. Ich habe mehrere ip Adressen über den postfix die nachrichten an andere MTA senden soll
2. Ich habe verschiedene transport in der master.cf Datei erstellt. Jede mit einer eigenen smtp_bind_address
soweit so gut. dieses setup funktioniert bereits.

Aber jetzt muss ich auch noch langsame bzw. rasch (temp) blockende ISPs wie yahoo handhaben. Mein erster Versuch war den transport via tranpsort_maps zu ändern:
yahoo.com slow:

Aber mit diesem Eintrag wird der transport geändert ohne auf den sender Rücksicht zu nehmen. Denn mit sender_dependent_default_transport_maps setze ich den transport abhängig von der sender Adresse.

Ich habe nun 4 transports definiert:
* m1
* m1-slow
* m2
* m2-slow

Wenn ich nun auf m1.mxsend.ch verbinde soll die E-Mail via transport m1 verschickt werden. Bei einer Verbindung auf m2.mxsend.ch über den transport m2. Dies funktioniert. Aber ich kann keine Lösung finden, bei der der transport anhand des Senders UND des Empfängers bestimmt wird wie es folgend sein müsste:
- Sender ist @m1.mxsend.ch und Empfänger ist someone at example.com > nutze transport m1
- Sender ist @m1.mxsend.ch und Empfänger ist someone at yahoo.com   > nutze transport m1-slow
- Sender ist @m2.mxsend.ch und Empfänger ist someone at exmaple.com > nutze transport m2
- Sender ist @m2.mxsend.ch und Empfänger ist someone at yahoo.com   > nutze transport m2-slow


Folgend noch mein komplettes setup:
main.cf (postconf -n):
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
anvil_rate_time_unit = 60s
anvil_status_update_time = 600s
append_dot_mydomain = no
biff = no
bounce_queue_lifetime = 3d
broken_sasl_auth_clients = yes
debug_peer_level = 2
debug_peer_list = 5.102.146.19
html_directory = /usr/share/doc/postfix/html
inet_interfaces = all
inet_protocols = ipv4
m1-slow_destination_concurrency_failed_cohort_limit = 100
m1-slow_destination_concurrency_limit = 4
m1-slow_destination_concurrency_positive_feedback = 1/35
m1-slow_initial_destination_concurrency = 1
m2-slow_destination_concurrency_failed_cohort_limit = 100
m2-slow_destination_concurrency_limit = 1
m2-slow_initial_destination_concurrency = 1
mailbox_size_limit = 0
maximal_queue_lifetime = 3d
message_size_limit = 20480000
milter_default_action = accept
milter_protocol = 2
mydestination = $myhostname, localhost.$myhostname, localhost
mydomain = mxsend.ch
myhostname = m1
mynetworks = 127.0.0.0/8 5.102.146.19 5.102.145.149 5.102.151.226
myorigin = $myhostname
non_smtpd_milters = inet:localhost:12301
readme_directory = /usr/share/doc/postfix
recipient_delimiter = +
sender_dependent_default_transport_maps = mysql:/etc/postfix/mysql_sender_dependent_default_transport_maps.cf
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name
smtpd_client_connection_count_limit = 0
smtpd_client_connection_rate_limit = 0
smtpd_client_event_limit_exceptions =
smtpd_error_sleep_time = 1s
smtpd_hard_error_limit = 2000
smtpd_milters = inet:localhost:12301
smtpd_recipient_restrictions = reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unauthenticated_sender_login_mismatch permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_soft_error_limit = 1000
smtpd_tls_auth_only = no
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
transport_maps = mysql:/etc/postfix/mysql_transport_maps.cf
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_gid_maps = static:5000
virtual_mailbox_base = /var/spool/maildirs
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_mailbox_domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_minimum_uid = 5000
virtual_transport = lmtp:unix:private/dovecot-lmtp
virtual_uid_maps = static:5000

master.cf (postconf -P):
m1/unix/smtp_bind_address = 5.102.145.149
m1/unix/smtp_helo_name = m1.mxsend.ch
m1/unix/syslog_name = postfix-m1
m2/unix/smtp_bind_address = 5.102.151.226
m2/unix/smtp_helo_name = m2.mxsend.ch
m2/unix/syslog_name = postfix-m2
m1-slow/unix/smtp_bind_address = 5.102.145.149
m1-slow/unix/smtp_helo_name = m1.mxsend.ch
m1-slow/unix/syslog_name = postfix-m1-slow
m2-slow/unix/smtp_bind_address = 5.102.151.226
m2-slow/unix/smtp_helo_name = m2.mxsend.ch
m2-slow/unix/syslog_name = postfix-m2-slow
5.102.145.149:smtp/inet/myhostname = m1.mxsend.ch
5.102.145.149:submission/inet/myhostname = m1.mxsend.ch
5.102.151.226:smtp/inet/myhostname = m2.mxsend.ch
5.102.151.226:submission/inet/myhostname = m2.mxsend.ch


Mehr Informationen über die Mailingliste postfix-users