# HG changeset patch # User Paul Boddie # Date 1446310344 -3600 # Node ID c164ae9c6db181a9dcc6795f9323b4cc64f1d35f # Parent 34e22c3c0bf9f68d0323284aa90f64c5d554cb45 Made LDAP and simple versions of LMTP routers for Exim. Simplified Exim routing for local and outgoing recipients using local_parts_prefix. Removed the superfluous outgoing recipients list for Exim. Renamed files for local system users to more accurately indicate their purpose. Added a diagram for LMTP in the documentation. diff -r 34e22c3c0bf9 -r c164ae9c6db1 conf/exim/ldap/020_exim4-config_ldap_people_local --- a/conf/exim/ldap/020_exim4-config_ldap_people_local Sat Oct 31 14:31:44 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -LOCAL_RECIPIENT = ${strlen:local+} - -LDAP_LOCAL_PERSON_QUERY = (&(|(mail=${quote_ldap:${substr{LOCAL_RECIPIENT}{${local_part}}}@${domain}})\ - (alias=${quote_ldap:${substr{LOCAL_RECIPIENT}{${local_part}}}@${domain}}))\ - (&(objectclass=posixAccount)(objectclass=inetorgperson))) - -ldap_local_person: - debug_print = "R: ldap_local_person for $local_part@$domain" - driver = redirect - condition = ${if eq {local+}{${substr{0}{LOCAL_RECIPIENT}{${local_part}}}}} - data = ${lookup ldap{ \ - user="LDAP_SERVICE_BIND_DN" \ - pass=LDAP_SERVICE_PASSWORD \ - ldap://LDAP_HOST:LDAP_PORT/LDAP_BASE_DN?uid?sub?LDAP_LOCAL_PERSON_QUERY} \ - } - cannot_route_message = Unknown user diff -r 34e22c3c0bf9 -r c164ae9c6db1 conf/exim/ldap/020_exim4-config_ldap_people_local_system --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/conf/exim/ldap/020_exim4-config_ldap_people_local_system Sat Oct 31 17:52:24 2015 +0100 @@ -0,0 +1,14 @@ +LDAP_LOCAL_PERSON_SYSTEM_QUERY = (&(|(mail=${quote_ldap:${local_part}}@${domain})\ + (alias=${quote_ldap:${local_part}}@${domain}))\ + (&(objectclass=posixAccount)(objectclass=inetorgperson))) + +ldap_local_person_system: + debug_print = "R: ldap_local_person_system for $local_part@$domain" + driver = redirect + local_part_prefix = local+ + data = ${lookup ldap{ \ + user="LDAP_SERVICE_BIND_DN" \ + pass=LDAP_SERVICE_PASSWORD \ + ldap://LDAP_HOST:LDAP_PORT/LDAP_BASE_DN?uid?sub?LDAP_LOCAL_PERSON_SYSTEM_QUERY} \ + } + cannot_route_message = Unknown user diff -r 34e22c3c0bf9 -r c164ae9c6db1 conf/exim/ldap/020_exim4-config_ldap_people_outgoing_recipients --- a/conf/exim/ldap/020_exim4-config_ldap_people_outgoing_recipients Sat Oct 31 14:31:44 2015 +0100 +++ b/conf/exim/ldap/020_exim4-config_ldap_people_outgoing_recipients Sat Oct 31 17:52:24 2015 +0100 @@ -1,18 +1,15 @@ -PEOPLE_OUTGOING = ${strlen:people-outgoing+} - -LDAP_PERSON_OUTGOING_RECIPIENT_QUERY = (&(|(mail=${quote_ldap:${substr{PEOPLE_OUTGOING}{${local_part}}}@${domain}})\ - (alias=${quote_ldap:${substr{PEOPLE_OUTGOING}{${local_part}}}@${domain}}))\ +LDAP_PERSON_OUTGOING_RECIPIENT_QUERY = (&(|(mail=${quote_ldap:${local_part}}@${domain})\ + (alias=${quote_ldap:${local_part}}@${domain}))\ (objectclass=inetorgperson)) ldap_person_outgoing_recipient: debug_print = "R: ldap_person_outgoing_recipient for $local_part@$domain" driver = accept - condition = ${if and { \ - {eq {people-outgoing+}{${substr{0}{PEOPLE_OUTGOING}{${local_part}}}}} \ - {!eq {}{${lookup ldap{ \ + local_part_prefix = people-outgoing+ + condition = ${if !eq {} \ + {${lookup ldap{ \ user="LDAP_SERVICE_BIND_DN" \ pass=LDAP_SERVICE_PASSWORD \ - ldap://LDAP_HOST:LDAP_PORT/LDAP_BASE_DN?mail?sub?LDAP_PERSON_OUTGOING_RECIPIENT_QUERY} \ - }}} \ - }} + ldap://LDAP_HOST:LDAP_PORT/LDAP_BASE_DN?mail?sub?LDAP_PERSON_OUTGOING_RECIPIENT_QUERY}}} \ + } transport = people_outgoing_transport diff -r 34e22c3c0bf9 -r c164ae9c6db1 conf/exim/ldap/890_exim4-config_cyrus_lmtp_local_lmtp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/conf/exim/ldap/890_exim4-config_cyrus_lmtp_local_lmtp Sat Oct 31 17:52:24 2015 +0100 @@ -0,0 +1,16 @@ +LDAP_LOCAL_LMTP_QUERY = (&(|(mail=${quote_ldap:${local_part}@${domain}})\ + (alias=${quote_ldap:${local_part}@${domain}}))\ + (objectclass=inetorgperson)) + +cyrus_lmtp_local_lmtp: + debug_print = "R: cyrus_lmtp_local_lmtp for $local_part@$domain" + driver = accept + local_part_prefix = local+ + condition = ${if !eq {} \ + {${lookup ldap{ \ + user="LDAP_SERVICE_BIND_DN" \ + pass=LDAP_SERVICE_PASSWORD \ + ldap://LDAP_HOST:LDAP_PORT/LDAP_BASE_DN?mail?sub?LDAP_LOCAL_LMTP_QUERY}}} \ + } + transport = cyrus_lmtp + cannot_route_message = Unknown user diff -r 34e22c3c0bf9 -r c164ae9c6db1 conf/exim/ldap/890_exim4-config_dovecot_lmtp_local_lmtp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/conf/exim/ldap/890_exim4-config_dovecot_lmtp_local_lmtp Sat Oct 31 17:52:24 2015 +0100 @@ -0,0 +1,16 @@ +LDAP_LOCAL_LMTP_QUERY = (&(|(mail=${quote_ldap:${local_part}@${domain}})\ + (alias=${quote_ldap:${local_part}@${domain}}))\ + (objectclass=inetorgperson)) + +dovecot_lmtp_local_lmtp: + debug_print = "R: dovecot_lmtp_local_lmtp for $local_part@$domain" + driver = accept + local_part_prefix = local+ + condition = ${if !eq {} \ + {${lookup ldap{ \ + user="LDAP_SERVICE_BIND_DN" \ + pass=LDAP_SERVICE_PASSWORD \ + ldap://LDAP_HOST:LDAP_PORT/LDAP_BASE_DN?mail?sub?LDAP_LOCAL_LMTP_QUERY}}} \ + } + transport = dovecot_lmtp + cannot_route_message = Unknown user diff -r 34e22c3c0bf9 -r c164ae9c6db1 conf/exim/lmtp/890_exim4-config_cyrus_lmtp_local_lmtp --- a/conf/exim/lmtp/890_exim4-config_cyrus_lmtp_local_lmtp Sat Oct 31 14:31:44 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -cyrus_lmtp_local_lmtp: - debug_print = "R: cyrus_lmtp_local_lmtp for $local_part@$domain" - driver = accept - domains = lsearch;/etc/exim4/virtual_domains - local_part_prefix = local+ - local_parts = lsearch;/etc/exim4/virtual_people - transport = cyrus_lmtp - cannot_route_message = Unknown user diff -r 34e22c3c0bf9 -r c164ae9c6db1 conf/exim/lmtp/890_exim4-config_dovecot_lmtp_local_lmtp --- a/conf/exim/lmtp/890_exim4-config_dovecot_lmtp_local_lmtp Sat Oct 31 14:31:44 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -dovecot_lmtp_local_lmtp: - debug_print = "R: dovecot_lmtp_local_lmtp for $local_part@$domain" - driver = accept - domains = lsearch;/etc/exim4/virtual_domains - local_part_prefix = local+ - local_parts = lsearch;/etc/exim4/virtual_people - transport = dovecot_lmtp - cannot_route_message = Unknown user diff -r 34e22c3c0bf9 -r c164ae9c6db1 conf/exim/simple/020_exim4-config_people_outgoing_recipients --- a/conf/exim/simple/020_exim4-config_people_outgoing_recipients Sat Oct 31 14:31:44 2015 +0100 +++ b/conf/exim/simple/020_exim4-config_people_outgoing_recipients Sat Oct 31 17:52:24 2015 +0100 @@ -2,6 +2,7 @@ debug_print = "R: simple_person_outgoing_recipient for $local_part@$domain" driver = accept domains = lsearch;/etc/exim4/virtual_domains - local_parts = lsearch;/etc/exim4/virtual_people_outgoing_recipients + local_part_prefix = people-outgoing+ + local_parts = lsearch;/etc/exim4/virtual_people transport = people_outgoing_transport cannot_route_message = Unknown user diff -r 34e22c3c0bf9 -r c164ae9c6db1 conf/exim/simple/890_exim4-config_cyrus_lmtp_local_lmtp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/conf/exim/simple/890_exim4-config_cyrus_lmtp_local_lmtp Sat Oct 31 17:52:24 2015 +0100 @@ -0,0 +1,8 @@ +cyrus_lmtp_local_lmtp: + debug_print = "R: cyrus_lmtp_local_lmtp for $local_part@$domain" + driver = accept + domains = lsearch;/etc/exim4/virtual_domains + local_part_prefix = local+ + local_parts = lsearch;/etc/exim4/virtual_people + transport = cyrus_lmtp + cannot_route_message = Unknown user diff -r 34e22c3c0bf9 -r c164ae9c6db1 conf/exim/simple/890_exim4-config_dovecot_lmtp_local_lmtp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/conf/exim/simple/890_exim4-config_dovecot_lmtp_local_lmtp Sat Oct 31 17:52:24 2015 +0100 @@ -0,0 +1,8 @@ +dovecot_lmtp_local_lmtp: + debug_print = "R: dovecot_lmtp_local_lmtp for $local_part@$domain" + driver = accept + domains = lsearch;/etc/exim4/virtual_domains + local_part_prefix = local+ + local_parts = lsearch;/etc/exim4/virtual_people + transport = dovecot_lmtp + cannot_route_message = Unknown user diff -r 34e22c3c0bf9 -r c164ae9c6db1 conf/exim/simple/virtual_people_outgoing_recipients --- a/conf/exim/simple/virtual_people_outgoing_recipients Sat Oct 31 14:31:44 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -people-outgoing+paul.boddie: -people-outgoing+vincent.vole: diff -r 34e22c3c0bf9 -r c164ae9c6db1 conf/postfix/simple/main.cf.example --- a/conf/postfix/simple/main.cf.example Sat Oct 31 14:31:44 2015 +0100 +++ b/conf/postfix/simple/main.cf.example Sat Oct 31 17:52:24 2015 +0100 @@ -1,7 +1,7 @@ -# Uncomment the virtual_alias_maps_local entry to support local user delivery. +# Uncomment the virtual_alias_maps_local_system entry to support local system user delivery. virtual_alias_maps = $alias_maps, hash:/etc/postfix/virtual, hash:/etc/postfix/simple/virtual_alias_maps - #, hash:/etc/postfix/simple/virtual_alias_maps_local + #, hash:/etc/postfix/simple/virtual_alias_maps_local_system sender_bcc_maps = hash:/etc/postfix/simple/virtual_alias_maps_people_outgoing diff -r 34e22c3c0bf9 -r c164ae9c6db1 conf/postfix/simple/virtual_alias_maps_local --- a/conf/postfix/simple/virtual_alias_maps_local Sat Oct 31 14:31:44 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -local+paul.boddie@example.com paulb -local+vincent.vole@example.com vole diff -r 34e22c3c0bf9 -r c164ae9c6db1 conf/postfix/simple/virtual_alias_maps_local_system --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/conf/postfix/simple/virtual_alias_maps_local_system Sat Oct 31 17:52:24 2015 +0100 @@ -0,0 +1,2 @@ +local+paul.boddie@example.com paulb +local+vincent.vole@example.com vole diff -r 34e22c3c0bf9 -r c164ae9c6db1 docs/wiki/MailIntegration--LDAP --- a/docs/wiki/MailIntegration--LDAP Sat Oct 31 14:31:44 2015 +0100 +++ b/docs/wiki/MailIntegration--LDAP Sat Oct 31 17:52:24 2015 +0100 @@ -29,13 +29,13 @@ `020_exim4-config_ldap_people_outgoing_recipients` }}} -Where [[../LocalSMTP|local SMTP routing]] is being performed, the following -file is also useful: +Where [[../LocalSMTP|local SMTP routing]] is being performed ''and'' the +recipients are local system users, the following file is also useful: {{{#!table '''File''' || '''Purpose''' == -`020_exim4-config_ldap_people_local` +`020_exim4-config_ldap_people_local_system` || Defines routing for local recipients for delivery to local system .. mailboxes }}} diff -r 34e22c3c0bf9 -r c164ae9c6db1 docs/wiki/MailIntegration--LMTP --- a/docs/wiki/MailIntegration--LMTP Sat Oct 31 14:31:44 2015 +0100 +++ b/docs/wiki/MailIntegration--LMTP Sat Oct 31 17:52:24 2015 +0100 @@ -6,11 +6,42 @@ such solutions is avoided, but then those solutions must expose their LMTP interface appropriately. +{{{#!graphviz +//format=svg +//transform=notugly +digraph lmtp { + node [shape=box,fontsize="16.0",fontname="sans-serif",tooltip="LMTP delivery"]; + edge [tooltip="LMTP delivery"]; + rankdir=LR; + + mail [label="Incoming mail",shape=folder,style=filled,fillcolor=cyan]; + + subgraph { + rank=same; + personrouter [label="Person router"]; + recipients [label="Recipient database",shape=folder]; + } + + subgraph { + rank=same; + personhandler [label="Person handler",style=filled,fillcolor=gold]; + } + + mailbox [label="Mailboxes\n(Cyrus, Dovecot, ...)",tooltip="Mailboxes"]; + + mail -> personrouter -> personhandler -> mailbox; + + recipients -> personrouter; +} +}}} + Although this topic is largely beyond the scope of this documentation, systems such as Cyrus and Dovecot can be configured to provide a Unix domain socket offering support for LMTP connections. -For Cyrus, the following bug report is pertinent: +== Cyrus == + +For Cyrus on Debian, the following bug report is pertinent: * https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=494746 diff -r 34e22c3c0bf9 -r c164ae9c6db1 docs/wiki/MailIntegration--LocalSMTP --- a/docs/wiki/MailIntegration--LocalSMTP Sat Oct 31 14:31:44 2015 +0100 +++ b/docs/wiki/MailIntegration--LocalSMTP Sat Oct 31 17:52:24 2015 +0100 @@ -1,22 +1,7 @@ = Local SMTP Delivery = By employing local SMTP, the burden of routing messages to suitable storage -becomes a configuration problem within the mail system itself. Here, imip-agent -connects to the mail transport agent (MTA) and sends a message to an -explicitly-indicated local user such as, for example: - -{{{ -local+vincent.vole@example.com -}}} - -The message is then routed to a mail delivery mechanism, perhaps by converting -the local address to a local user identity: - -{{{ -vole -}}} - -The local delivery mechanism would then deposit the message in the user's mailbox. +becomes a configuration problem within the mail system itself. {{{#!graphviz //format=svg @@ -52,7 +37,25 @@ } }}} -MTAs typically provide delivery routing for local user mailboxes. Where the +Here, imip-agent connects to the mail transport agent (MTA) and sends a +message to an explicitly-indicated local user. For example: + +{{{ +local+vincent.vole@example.com +}}} + +The message is then routed to a mail delivery mechanism, perhaps by converting +the local address to a local system user identity: + +{{{ +vole +}}} + +The local delivery mechanism would then deposit the message in the user's mailbox. +Alternatively, routing for a mail storage solution would accept the message for +the local user and deliver it to that user's mailbox. + +MTAs typically provide routing for local system users by default. Where the mail system must instead route messages to mailbox providers employing LMTP, some more effort may be required. See the [[../../MailboxIntegration|mailbox integration guide]] for more details. diff -r 34e22c3c0bf9 -r c164ae9c6db1 docs/wiki/MailIntegration--Simple --- a/docs/wiki/MailIntegration--Simple Sat Oct 31 14:31:44 2015 +0100 +++ b/docs/wiki/MailIntegration--Simple Sat Oct 31 17:52:24 2015 +0100 @@ -25,9 +25,7 @@ `020_exim4-config_people_outgoing_recipients` == `virtual_people` -|| Defines recipient identities belonging to known domains -== -`virtual_people_outgoing_recipients` +|| Defines recipient identities belonging to known domains == `virtual_resources` == @@ -75,8 +73,8 @@ {{{#!table '''File''' || '''Purpose''' == -`virtual_alias_maps_local` -|| Defines recipients and local users for delivery to local mailboxes +`virtual_alias_maps_local_system` +|| Defines recipients for delivery to mailboxes for local system users }}} These files can be incorporated into the Postfix configuration. On Debian diff -r 34e22c3c0bf9 -r c164ae9c6db1 docs/wiki/MailboxIntegration --- a/docs/wiki/MailboxIntegration Sat Oct 31 14:31:44 2015 +0100 +++ b/docs/wiki/MailboxIntegration Sat Oct 31 17:52:24 2015 +0100 @@ -44,18 +44,29 @@ On Debian systems, these files would be copied into the `/etc/exim4/conf.d/transport` directory. +The mailbox integration for local system users is also found in the +`conf/exim/lmtp` directory: + {{{#!table '''File''' || '''Purpose''' == `890_exim4-config_cyrus_lmtp_local_system` || Routes messages for local system users to Cyrus == +`890_exim4-config_dovecot_lmtp_local_system` +|| Routes messages for local system users to Dovecot +}}} + +Meanwhile, both the `conf/exim/ldap` and `conf/exim/simple` directories +provide the following files. The appropriate file for the chosen configuration +should be used: + +{{{#!table +'''File''' || '''Purpose''' +== `890_exim4-config_cyrus_lmtp_local_lmtp` || Routes messages for local virtual users to Cyrus == -`890_exim4-config_dovecot_lmtp_local_system` -|| Routes messages for local system users to Dovecot -== `890_exim4-config_dovecot_lmtp_local_lmtp` || Routes messages for local virtual users to Dovecot }}}