[Exim] Sample configuration: Exim-4.04 and Cyrus IMAPD 2.1.4

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Kevin P. Fleming
Dátum:  
Címzett: exim-users
Tárgy: [Exim] Sample configuration: Exim-4.04 and Cyrus IMAPD 2.1.4
Configuration for Exim 4.04 to deliver messages to Cyrus IMAPD 2.1.4 (for
the website?):

This configuration uses LMTP over TCP/IP for the actual message delivery,
and also uses direct lookups into Cyrus' mailboxes.db file to determine
whether a local part is a valid recipient name. These configuration examples
assume that you have created an Exim "domain list" called local_domains,
with the list of all domains you want to be delivered into the Cyrus message
store.

There are two "routers" required, one to verify the validity of the address,
and the other to actually deliver the message to the LMTP transport. The
first router is:

local_user_verify:
driver = accept
domains = +local_domains
local_part_suffix = +*
local_part_suffix_optional
condition = ${lookup{user.${local_part}} dbmnz
{/opt/var/imap/mailboxes.db} {yes}{no}}
verify_only

This router is used _only_ for address verification. It strips any
plus-addressed suffix from the local part, then checks to see if there is a
mailbox named "user.<local part>" in the Cyrus IMAPD mailboxes list. This
router is written assuming that you have compiled IMAPD with the default of
using db3 for the mailboxes list; if you have configured IMAPD for a
flat-file mailboxes list, change "dbmnz" to "lsearch" in the lookup
condition.

Note: As of Exim-4.04, Exim is not able to directly open the mailboxes.db
file without a small patch to Exim. This patch has been forwarded to Philip
and accepted, so it should appear in Exim-4.05 or soon after. If you need to
use Exim before this patch has been integrated into the distributed source,
the patch is listed at the end of this configuration.

The second router is:

local_user:
driver = accept
domains = +local_domains
transport = local_delivery
no_verify

This router just accepts the message and queues it to be delivered by the
"local_delivery" transport. It is vitally important that this router be
listed in the Exim configuration file _after_ the router shown above,
otherwise this router will accept any_ incoming local part and attempt to
deliver it to Cyrus IMAPD.

Finally, there is a single transport:

local_delivery:
driver = smtp
protocol = lmtp
allow_localhost = yes
hosts = 127.0.0.1

This just sends the message(s) in LMTP mode over a TCP/IP channel to the
localhost.

Exim-4.04 patch to access mailboxes.db:

--- exim-4.04/src/dbstuff.h~ Thu Apr 18 01:08:30 2002
+++ exim-4.04/src/dbstuff.h Thu Jun  6 16:39:00 2002
@@ -129,7 +129,8 @@
 /* EXIM_DBOPEN - sets *dbpp to point to an EXIM_DB, NULL if failed */
 #define EXIM_DBOPEN(name, flags, mode, dbpp)         \
        if (db_create(dbpp, NULL, 0) != 0 || \
-         (*dbpp)->open(*dbpp, CS name, NULL, DB_HASH, \
+         (*dbpp)->open(*dbpp, CS name, NULL, \
+         ((flags) == O_RDONLY)? DB_UNKNOWN : DB_HASH, \
          ((flags) == O_RDONLY)? DB_RDONLY : DB_CREATE, \
          mode) != 0) *(dbpp) = NULL