summaryrefslogtreecommitdiffstats
path: root/doc/wiki/LMTP.Exim.txt
blob: d1150b2d52845d07afd695177fa2781301a79fe1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
Contents


 1. Using LMTP over UNIX Socket

 2. Using LMTP over TCP Socket

 3. Striping domain to avoid user unknown / doesn't exist error

 4. Verifying recipients using LMTP

 5. Delivering mails case insensitively

Exim provides support for LMTP over UNIX sockets using the LMTP transport
[http://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_lmtp_transport.html],
your distribution may/not provide this, run exim -bV and check for 'lmtp' in
'Transports:'. Support for LMTP over TCP sockets is provided by the SMTP
transport
[http://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_smtp_transport.html].

Using LMTP over UNIX Socket
---------------------------

Use this configuration if dovecot runs on the same host as exim.

Example router:

---%<-------------------------------------------------------------------------
local_user:
        debug_print = "R: local_user for $local_part@$domain"
        driver = accept
        domains = +local_domains
        check_local_user
        transport = dovecot_lmtp
        cannot_route_message = Unknown user
---%<-------------------------------------------------------------------------

Example transport:

---%<-------------------------------------------------------------------------
dovecot_lmtp:
        driver = lmtp
        socket = /var/run/dovecot/lmtp
        #maximum number of deliveries per batch, default 1
        batch_max = 200
        #allow suffixes/prefixes (default unset)
        rcpt_include_affixes
---%<-------------------------------------------------------------------------

Using LMTP over TCP Socket
--------------------------

Example router:

---%<-------------------------------------------------------------------------
local_user:
        transport = dovecot_lmtp
        domains = +local_domains
        driver = manualroute
        route_list = "* 192.168.1.0 byname"
        #if destination server is the local host enable this
        #self = send
---%<-------------------------------------------------------------------------

Set IP and port as appropriate to your setup.

Example transport:

---%<-------------------------------------------------------------------------
dovecot_lmtp:
        driver = smtp
        #allow suffixes/prefixes (default unset)
        rcpt_include_affixes
        protocol = lmtp
        port = 2525
---%<-------------------------------------------------------------------------

Striping domain to avoid user unknown / doesn't exist error
-----------------------------------------------------------

If you are using a userdb which does not have domain names, you may need to add
a setting to 20-lmtp.conf

---%<-------------------------------------------------------------------------
protocol lmtp {
   ...
   # use %n to strip away the domain part
   auth_username_format = %n
}
---%<-------------------------------------------------------------------------

Symptoms:

 * Exim says something like "LMTP error after RCPT ... 550 ... User doesn't
   exist  someuser@somedomain"
 * Dovecot verbose log says something like "auth-worker(9048):
   passwd(someuser@somedomain): unknown user"

Verifying recipients using LMTP
-------------------------------

You can use callout verification to avoid accepting mail for addresses which do
not exist in Dovecot. Below is a config snippet which could be used in
acl_smtp_rcpt to achieve this:

---%<-------------------------------------------------------------------------
deny
        message = invalid recipient
        domains = +local_domains
        !verify = recipient/callout=no_cache
---%<-------------------------------------------------------------------------

For more information on address verification see the related section of the
Exim specification
[http://www.exim.org/exim-html-current/doc/html/spec_html/ch-access_control_lists.html#SECTaddressverification].

Delivering mails case insensitively
-----------------------------------

*Warning: *Just use this setup if all your login names contain only lower case
characters! (On Linux see /etc/adduser.conf under NAME_REGEX variable).

Exim retains the case of the local part. Dovecot's LMTP /may/ fail looking up
an incorrect cased local part in your userdb. You can solve this problem by
extending the /protocol lmtp/ section:

---%<-------------------------------------------------------------------------
protocol lmtp {
   ...
   # use %Ln to strip away the domain part
   auth_username_format = %Lu
}
---%<-------------------------------------------------------------------------

(If you don't mind allowing case insensitive logins for dovecoth
authentication, you may set /auth_username_format/ in the global configuration
accordingly and renounce the above change).

In case you prefer to configure exim to lower case the local part instead, add
a router just before your local delivery router:

---%<-------------------------------------------------------------------------
lowercase_local:
        debug_print = "R: lower case local_part for local delivery"
        driver = redirect
        redirect_router = local_user
        data = ${lc:${local_part}}
---%<-------------------------------------------------------------------------

Make sure to reference the name you have chosen for your local delivery router
within /redirect_router/.

(This file was created from the wiki on 2019-06-19 12:42)