From 7166e7d2b2a912fc85658527a15d2e04c31ddd98 Mon Sep 17 00:00:00 2001 From: Florent Daigniere Date: Sat, 19 Feb 2022 18:37:37 +0100 Subject: [PATCH] Implement #2213: slow transports --- core/postfix/conf/main.cf | 2 +- core/postfix/conf/master.cf | 16 ++++++++++++++++ core/postfix/start.py | 7 ++++--- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/core/postfix/conf/main.cf b/core/postfix/conf/main.cf index 444dacad..1d66bcc3 100644 --- a/core/postfix/conf/main.cf +++ b/core/postfix/conf/main.cf @@ -80,7 +80,7 @@ virtual_mailbox_maps = ${podop}mailbox # Mails are transported if required, then forwarded to Dovecot for delivery relay_domains = ${podop}transport -transport_maps = ${podop}transport +transport_maps = lmdb:/etc/postfix/transport.map, ${podop}transport virtual_transport = lmtp:inet:{{ LMTP_ADDRESS }} # Sender and recipient canonical maps, mostly for SRS diff --git a/core/postfix/conf/master.cf b/core/postfix/conf/master.cf index 15613476..bec96a30 100644 --- a/core/postfix/conf/master.cf +++ b/core/postfix/conf/master.cf @@ -15,6 +15,22 @@ outclean unix n - n - 0 cleanup -o header_checks=pcre:/etc/postfix/outclean_header_filter.cf -o nested_header_checks= +# Polite policy +polite unix - - n - - smtp + -o syslog_name=postfix-polite + -o polite_destination_concurrency_limit=3 + -o polite_destination_rate_delay=0 + -o polite_destination_recipient_limit=20 + -o polite_destination_concurrency_failed_cohort_limit=10 + +# Turtle policy +turtle unix - - n - - smtp + -o syslog_name=postfix-turtle + -o turtle_destination_concurrency_limit=1 + -o turtle_destination_rate_delay=1 + -o turtle_destination_recipient_limit=5 + -o turtle_destination_concurrency_failed_cohort_limit=10 + # Internal postfix services pickup unix n - n 60 1 pickup cleanup unix n - n - 0 cleanup diff --git a/core/postfix/start.py b/core/postfix/start.py index dc5015d7..fe93de86 100755 --- a/core/postfix/start.py +++ b/core/postfix/start.py @@ -74,9 +74,10 @@ if os.path.exists("/overrides/mta-sts-daemon.yml"): else: conf.jinja("/conf/mta-sts-daemon.yml", os.environ, "/etc/mta-sts-daemon.yml") -if not os.path.exists("/etc/postfix/tls_policy.map.lmdb"): - open("/etc/postfix/tls_policy.map", "a").close() - os.system("postmap /etc/postfix/tls_policy.map") +for policy in ['tls_policy', 'transport']: + if not os.path.exists(f'/etc/postfix/{policy}.map.lmdb'): + open(f'/etc/postfix/{policy}.map', 'a').close() + os.system(f'postmap /etc/postfix/{policy}.map') if "RELAYUSER" in os.environ: path = "/etc/postfix/sasl_passwd"