The Dovecot LDA is a local delivery agent which takes mail from an MTA and delivers it to a user's mailbox.
Key features :-
1. Mailbox indexing during mail delivery which provides faster mailbox access later.
2. Quota enforcing by a plugin.
3. Sieve language support by a plugin.
Here I will explain how to configure Dovecot as your LDA/MDA having MTA running under Postfix. And also I will cover giving Quota and sieve support to Dovecot.
The Mail server installation can be followed from the link below,
postfix-mailserver
The above documentation uses Postfix itself as LDA and this should be modified as explained below.
First we need to add the following to the master file,
vim /etc/postfix/master.cf
dovecot unix - n n - - pipe
flags=DRhu user=dovecot:dovecot argv=/usr/local/libexec/dovecot/deliver -f ${sender} -d ${recipient}
Now we need to tell postfix to use dovecot as LDA,
vim /etc/postfix/main.cf
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
Restart postfix,
/etc/init.d/postfix restart
Edit dovecot.conf and add postmaster mail address,
vim /usr/local/etc/dovecot/dovecot.conf
protocol lda {
postmaster_address = postmaster@test.com
}
If you don't have any user-specific settings, you can avoid the user_query by using userdb static instead of userdb sql.
vim /usr/local/etc/dovecot/conf.d/auth-sql.conf.ext
userdb {
driver = static
args = uid=dovecot gid=dovecot home=/home/vmail/%u
}
If you need user specific quota support then we need to use userdb sql instead of userdb static.
For that,
userdb {
driver = sql
args = /usr/local/etc/dovecot/dovecot-sql.conf.ext
}
We need to set the system UID and GID of the LDA user, dovecot(5000) in my case.
vim /usr/local/etc/dovecot/conf.d/10-mail.conf
mail_uid = 5000
mail_gid = 5000
#Specify the mail folder location
mail_location = maildir:/home/vmail/%u
mail_privileged_group = dovecot
Restart Dovecot
/etc/init.d/dovecot restart
We can check the dovecot and postfix configurations using these commands,
doveconf -n
postconf -n
Now Dovecot starts receiving mails from Postfix for local delivery.
Go through the logs for debugging ..
tailf /var/log/mail.log
SASL authentication
The Postfix documentation mentioned in above link uses Cyrus as SASL authentication method. Here I will show you how to configure dovecot for SMTP AUTH.
First check whether postfix is having dovecot sasl support,
postconf -a
cyrus
dovecot
Once you have verified that your installation of Postfix supports Dovecot SASL, it's very simple to configure:
vim /usr/local/etc/dovecot/conf.d/10-master.conf
Added inside service auth,
service auth {
#Postfix smtp-auth
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0660
user = postfix
}
}
vim /usr/local/etc/dovecot/conf.d/10-auth.conf
auth_mechanisms = plain login digest-md5 cram-md5
disable_plaintext_auth = yes
Change Postfix configuration as follows,
vim /etc/postfix/main.cf
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
Restart Postfix and Dovecot.
Test Authentication,
telnet localhost 25
ehlo localhost
250-localhost.localdomain
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN DIGEST-MD5 CRAM-MD5
250-AUTH=PLAIN LOGIN DIGEST-MD5 CRAM-MD5
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
AUTH PLAIN AHJpbkBleGFwbGUuY29tAHJpbg==
235 2.7.0 Authentication successful
Thanks for Reading
Cheers /-
Key features :-
1. Mailbox indexing during mail delivery which provides faster mailbox access later.
2. Quota enforcing by a plugin.
3. Sieve language support by a plugin.
Here I will explain how to configure Dovecot as your LDA/MDA having MTA running under Postfix. And also I will cover giving Quota and sieve support to Dovecot.
The Mail server installation can be followed from the link below,
postfix-mailserver
The above documentation uses Postfix itself as LDA and this should be modified as explained below.
First we need to add the following to the master file,
vim /etc/postfix/master.cf
dovecot unix - n n - - pipe
flags=DRhu user=dovecot:dovecot argv=/usr/local/libexec/dovecot/deliver -f ${sender} -d ${recipient}
Now we need to tell postfix to use dovecot as LDA,
vim /etc/postfix/main.cf
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
Restart postfix,
/etc/init.d/postfix restart
Edit dovecot.conf and add postmaster mail address,
vim /usr/local/etc/dovecot/dovecot.conf
protocol lda {
postmaster_address = postmaster@test.com
}
If you don't have any user-specific settings, you can avoid the user_query by using userdb static instead of userdb sql.
vim /usr/local/etc/dovecot/conf.d/auth-sql.conf.ext
userdb {
driver = static
args = uid=dovecot gid=dovecot home=/home/vmail/%u
}
If you need user specific quota support then we need to use userdb sql instead of userdb static.
For that,
userdb {
driver = sql
args = /usr/local/etc/dovecot/dovecot-sql.conf.ext
}
We need to set the system UID and GID of the LDA user, dovecot(5000) in my case.
vim /usr/local/etc/dovecot/conf.d/10-mail.conf
mail_uid = 5000
mail_gid = 5000
#Specify the mail folder location
mail_location = maildir:/home/vmail/%u
mail_privileged_group = dovecot
Restart Dovecot
/etc/init.d/dovecot restart
We can check the dovecot and postfix configurations using these commands,
doveconf -n
postconf -n
Now Dovecot starts receiving mails from Postfix for local delivery.
Go through the logs for debugging ..
tailf /var/log/mail.log
SASL authentication
The Postfix documentation mentioned in above link uses Cyrus as SASL authentication method. Here I will show you how to configure dovecot for SMTP AUTH.
First check whether postfix is having dovecot sasl support,
postconf -a
cyrus
dovecot
Once you have verified that your installation of Postfix supports Dovecot SASL, it's very simple to configure:
vim /usr/local/etc/dovecot/conf.d/10-master.conf
Added inside service auth,
service auth {
#Postfix smtp-auth
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0660
user = postfix
}
}
vim /usr/local/etc/dovecot/conf.d/10-auth.conf
auth_mechanisms = plain login digest-md5 cram-md5
disable_plaintext_auth = yes
Change Postfix configuration as follows,
vim /etc/postfix/main.cf
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
Restart Postfix and Dovecot.
Test Authentication,
telnet localhost 25
ehlo localhost
250-localhost.localdomain
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN DIGEST-MD5 CRAM-MD5
250-AUTH=PLAIN LOGIN DIGEST-MD5 CRAM-MD5
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
AUTH PLAIN AHJpbkBleGFwbGUuY29tAHJpbg==
235 2.7.0 Authentication successful
Thanks for Reading
Cheers /-
No comments:
Post a Comment