diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2014-04-17 04:56:43 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2015-06-07 02:51:47 +0200 |
commit | e9e8ce2add2b7c020daa02228e506e7c02828c15 (patch) | |
tree | 88aee2a20e3c1961aa94769a4df4f236a21741bc /roles/IMAP | |
parent | 3d4b17515fc21dbb218873b23ff9272ca9474e8e (diff) |
Decongestion potential bottlenecks on trivial_rewrite(8).
Which might be caused by slow LDAP lookups in transport_maps. Instead,
we alias each addresses for which we want a custom transport to a
dedicated "dummy" domain, and use a static (CDB) transport_maps to map
said domains to their transport; the receiver can then use canonical(8)
to restore the original envelope recipient. Since the alias resolution
is performed by cleanup(8), which can run in parallel with other
instances, it should decongestion bottlenecks under heavy loads.
So far only the MX:es have been decongestioned. The list manager and
the MDA should be treated as well.
Diffstat (limited to 'roles/IMAP')
-rw-r--r-- | roles/IMAP/files/etc/postfix/recipient_canonical.pcre | 4 | ||||
-rw-r--r-- | roles/IMAP/tasks/mda.yml | 6 | ||||
-rw-r--r-- | roles/IMAP/templates/etc/postfix/main.cf.j2 | 5 |
3 files changed, 15 insertions, 0 deletions
diff --git a/roles/IMAP/files/etc/postfix/recipient_canonical.pcre b/roles/IMAP/files/etc/postfix/recipient_canonical.pcre new file mode 100644 index 0000000..07c5859 --- /dev/null +++ b/roles/IMAP/files/etc/postfix/recipient_canonical.pcre @@ -0,0 +1,4 @@ +# Restore the original envelope recipient (drop our internal domain). +# Extensions are preserved as they are included in $2. + +/^([^\/]+)\/(.+)@[^@]+$/ $2@$1 diff --git a/roles/IMAP/tasks/mda.yml b/roles/IMAP/tasks/mda.yml index 1aac519..0358f12 100644 --- a/roles/IMAP/tasks/mda.yml +++ b/roles/IMAP/tasks/mda.yml @@ -29,6 +29,12 @@ - mailbox.cf - transport_content_filter.cf +- name: Copy recipient canonical + copy: src=etc/postfix/recipient_canonical.pcre + dest=/etc/postfix-{{ postfix_instance[inst].name }}/recipient_canonical.pcre + owner=root group=root + mode=0644 + - name: Start Postfix service: name=postfix state=started when: not r.changed diff --git a/roles/IMAP/templates/etc/postfix/main.cf.j2 b/roles/IMAP/templates/etc/postfix/main.cf.j2 index e4c01bd..d0421ce 100644 --- a/roles/IMAP/templates/etc/postfix/main.cf.j2 +++ b/roles/IMAP/templates/etc/postfix/main.cf.j2 @@ -55,6 +55,11 @@ virtual_mailbox_domains = ldap:$config_directory/virtual/mailbox_domains.cf virtual_mailbox_maps = ldap:$config_directory/virtual/mailbox.cf transport_maps = ldap:$config_directory/virtual/transport_content_filter.cf +# Restore the original envelope recipient +relay_domains = $myhostname +recipient_canonical_classes = envelope_recipient +recipient_canonical_maps = pcre:$config_directory/recipient_canonical.pcre + # Don't rewrite remote headers local_header_rewrite_clients = # Tolerate occasional high latency |