maddy

Fork https://github.com/foxcpp/maddy

git clone git://git.lin.moe/go/maddy.git

 1# Dovecot
 2
 3Builtin maddy IMAP server may not match your requirements in terms of
 4performance, reliability or anything. For this reason it is possible to
 5integrate it with any external IMAP server that implements necessary
 6protocols. Here is how to do it for Dovecot.
 7
 81. Get rid of `imap` endpoint and existing `local_authdb` and `local_mailboxes`
 9   blocks.
10
112. Setup Dovecot to provide LMTP endpoint
12
13Here is an example configuration snippet:
14```
15# /etc/dovecot/dovecot.conf
16protocols = imap lmtp
17
18# /etc/dovecot/conf.d/10-master.conf
19service lmtp {
20 unix_listener lmtp-maddy {
21   mode = 0600
22   user = maddy
23  }
24}
25```
26
27Add `local_mailboxes` block to maddy config using `target.lmtp` module:
28```
29target.lmtp local_mailboxes {
30    targets unix:///var/run/dovecot/lmtp-maddy
31}
32```
33
34### Authentication
35
36In addition to MTA service, maddy also provides Submission service, but it
37needs authentication provider data to work correctly, maddy can use Dovecot
38SASL authentication protocol for it.
39
40You need the following in Dovecot's `10-master.conf`:
41```
42service auth {
43  unix_listener auth-maddy-client {
44    mode = 0660
45    user = maddy
46  }
47}
48```
49
50Then just configure `dovecot_sasl` module for `submission`:
51```
52submission ... {
53    auth dovecot_sasl unix:///var/run/dovecot/auth-maddy-client
54    ... other configuration ...
55}
56```
57
58## Other IMAP servers
59
60Integration with other IMAP servers might be more problematic because there is
61no standard protocol for authentication delegation. You might need to configure
62the IMAP server to implement MSA functionality by forwarding messages to maddy
63for outbound delivery. This might require more configuration changes on maddy
64side since by default it will not allow relay on port 25 even for localhost
65addresses. The easiest way is to create another SMTP endpoint on some port
66(probably Submission port):
67```
68smtp tcp://127.0.0.1:587 {
69    deliver_to &remote_queue
70}
71```
72And configure IMAP server's Submission service to forward outbound messages
73there.
74
75Depending on how Submission service is implemented you may also need to route
76messages for local domains back to it via LMTP:
77```
78smtp tcp://127.0.0.1:587 {
79    destination postmaster $(local_domains) {
80        deliver_to &local_routing
81    }
82    default_destination {
83        deliver_to &remote_queue
84    }
85}
86```
87