From 7166e7d2b2a912fc85658527a15d2e04c31ddd98 Mon Sep 17 00:00:00 2001 From: Florent Daigniere Date: Sat, 19 Feb 2022 18:37:37 +0100 Subject: [PATCH 1/4] 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" From a62ebceb3d9bcae8a7669767af6e7b229a7a9e33 Mon Sep 17 00:00:00 2001 From: Florent Daigniere Date: Sun, 20 Feb 2022 13:29:28 +0100 Subject: [PATCH 2/4] document --- docs/faq.rst | 14 ++++++++++++++ towncrier/newsfragments/2213.feature | 1 + 2 files changed, 15 insertions(+) create mode 100644 towncrier/newsfragments/2213.feature diff --git a/docs/faq.rst b/docs/faq.rst index 626f92ad..a077e6eb 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -476,6 +476,20 @@ Any mail related connection is proxied by nginx. Therefore the SMTP Banner is al .. _`1368`: https://github.com/Mailu/Mailu/issues/1368 +My emails are getting rejected, I am being told to slow down, what can I do? +```````````````````````````````````````````````````````````````````````````` + +Some email operators insist that emails are delivered slowly. Mailu maintains two separate queues for such destinations: ``polite`` and ``turtle``. To enable them for some destination you can creating an override at ``overrides/postfix/transport.map`` as follow: + +.. code-block:: bash + + yahoo.com polite: + orange.fr turtle: + +*Issue reference:* `2213`_. + +.. _`2213`: https://github.com/Mailu/Mailu/issues/2213 + My emails are getting defered, what can I do? ````````````````````````````````````````````` diff --git a/towncrier/newsfragments/2213.feature b/towncrier/newsfragments/2213.feature new file mode 100644 index 00000000..1792cf27 --- /dev/null +++ b/towncrier/newsfragments/2213.feature @@ -0,0 +1 @@ +Create a polite and turtle delivery queue to accomodate destinations that expect emails to be sent slowly From ee34417c8c2c3dd25d7363104e36d4cf478d7bfb Mon Sep 17 00:00:00 2001 From: Florent Daigniere Date: Sun, 20 Feb 2022 13:31:00 +0100 Subject: [PATCH 3/4] typo --- towncrier/newsfragments/2213.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/towncrier/newsfragments/2213.feature b/towncrier/newsfragments/2213.feature index 1792cf27..bc859cb1 100644 --- a/towncrier/newsfragments/2213.feature +++ b/towncrier/newsfragments/2213.feature @@ -1 +1 @@ -Create a polite and turtle delivery queue to accomodate destinations that expect emails to be sent slowly +Create a polite and turtle delivery queue to accommodate destinations that expect emails to be sent slowly From 66b660d33101ef0b8d6665c604873462fdbd0b86 Mon Sep 17 00:00:00 2001 From: Florent Daigniere Date: Sun, 20 Feb 2022 13:37:49 +0100 Subject: [PATCH 4/4] clarify --- docs/faq.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/faq.rst b/docs/faq.rst index a077e6eb..dfe9b3fb 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -486,6 +486,8 @@ Some email operators insist that emails are delivered slowly. Mailu maintains tw yahoo.com polite: orange.fr turtle: +Re-starting the smtp container will be required for changes to take effect. + *Issue reference:* `2213`_. .. _`2213`: https://github.com/Mailu/Mailu/issues/2213 @@ -502,7 +504,7 @@ If delivery to a specific domain fails because their DANE records are invalid or domain.example.com may domain.example.org encrypt -The syntax and options are as described in `postfix's documentation`_. Re-creating the smtp container will be required for changes to take effect. +The syntax and options are as described in `postfix's documentation`_. Re-starting the smtp container will be required for changes to take effect. .. _`postfix's documentation`: http://www.postfix.org/postconf.5.html#smtp_tls_policy_maps