68 lines
2.2 KiB
Markdown
68 lines
2.2 KiB
Markdown
+++
|
|
title = "use dovecot to store mails with lmtp"
|
|
date = "2013-11-06T06:37:32+00:00"
|
|
author = "Gibheer"
|
|
draft = false
|
|
+++
|
|
|
|
After more than a year working on my mail setup, I think I have it running in
|
|
a pretty good way. As some of the stuff is not documented at all in the wide of
|
|
the internet, I will post parts here to make it accessible to others.
|
|
|
|
Many setups use the MTA (postfix, exim) to store mails on the filesystem. My
|
|
setup lets [dovecot take care of that][dovecot-lmtp]. That way it is the only
|
|
process able to change data on the filesystem.
|
|
|
|
to make this work, we first need a [lmtp socket][lmtp socket] opened by dovecot.
|
|
The configuration part looks like this
|
|
|
|
service lmtp {
|
|
unix_listener /var/spool/postfix/private/delivery.sock {
|
|
mode = 0600
|
|
user = postfix
|
|
group = postfix
|
|
}
|
|
}
|
|
|
|
LMTP is a lightweight smtp protocol and most mail server components can speak
|
|
it.
|
|
|
|
Next we need to tell postfix to send mails to this socket instead storing it
|
|
on the filesystem. This can be done with with the following setting
|
|
|
|
mailbox_transport = lmtp:unix:/var/spool/postfix/private/delivery.sock
|
|
|
|
or for virtal accounts with
|
|
|
|
virtual_transport = lmtp:unix:/var/spool/postfix/private/delivery.sock
|
|
|
|
Now postfix will use the socket to deliver the mails.
|
|
|
|
It is also possible to use other services between these two like dspam. In my
|
|
case postfix delivers the mails to dspam and that will deliver them to dovecot.
|
|
|
|
For dovecot change the path of the socket to something dspam can reach. I'm
|
|
using `/var/run/delivery.sock`.
|
|
|
|
Then change the dspam.conf to use that socket as a delivery host
|
|
|
|
DeliveryProto LMTP
|
|
DeliveryHost "/var/run/delivery.sock"
|
|
|
|
As postfix needs to speak to dspam, we set dspam to create a socket too
|
|
|
|
ServerMode auto
|
|
ServerDomainSocketPath "/var/run/dspam.sock"
|
|
|
|
`ServerMode` should be set to either `auto` or `standard`.
|
|
|
|
Now the only thing left to do is to tell postfix to use that socket to deliver
|
|
its mails. For that, set the options from before to the new socket
|
|
|
|
virtual_transport = lmtp:unix:/var/run/dspam.sock
|
|
|
|
And with that, we have a nice setup where only dovecot stores mails.
|
|
|
|
[lmtp socket]: http://wiki2.dovecot.org/LMTP
|
|
[dovecot-lmtp]: http://wiki2.dovecot.org/HowTo/PostfixDovecotLMTP
|