Pages

Saturday 25 November 2017

Dovecot configure with postfix


Install dovecot service via yum command

[root@server ~]# yum install dovecot

Dovecot POP3/IMAP Server Setup

Edit the file /etc/dovecot/dovecot and set the following parameters:

[root@server ~]# vim /etc/dovecot/dovecot.conf
[root@server ~]# cat /etc/dovecot/dovecot.conf
...
enabled imap pop3 and lmtp protocols
# Protocols we want to be serving.
protocols = imap pop3 lmtp

enabled to listen in all ipv4 interfaces
# A comma separated list of IPs or hosts where to listen in for connections.
# "*" listens in all IPv4 interfaces, "::" listens in all IPv6 interfaces.
# If you want to specify non-default ports or anything more complex,
# edit conf.d/master.conf.
listen = *
...

[root@server ~]#


Then we need to specify the mail location by editing the file /etc/dovecot/conf.d/10-mail.conf.

[root@server ~]# vim /etc/dovecot/conf.d/10-mail.conf
[root@server ~]# cat /etc/dovecot/conf.d/10-mail.conf
....
#
# mail_location = maildir:~/Maildir
# mail_location = mbox:~/mail:INBOX=/var/mail/%u
# mail_location = mbox:/var/mail/%d/%1n/%n:INDEX=/var/indexes/%d/%1n/%n
#
# <doc/wiki/MailLocation.txt>
#
#mail_location =
mail_location = maildir:~/mailbox
...

[root@server ~]#




[root@server ~]# vim /etc/dovecot/conf.d/20-pop3.conf
[root@server ~]# cat /etc/dovecot/conf.d/20-pop3.conf
...
# Note that Outlook 2003 seems to have problems with %v.%u format which was
# Dovecot's default, so if you're building a new server it would be a good
# idea to change this. %08Xu%08Xv should be pretty fail-safe.
#
pop3_uidl_format = %08Xu%08Xv
...
..
# Workarounds for various client bugs:
# outlook-no-nuls:
# Outlook and Outlook Express hang if mails contain NUL characters.
# This setting replaces them with 0x80 character.
# oe-ns-eoh:
# Outlook Express and Netscape Mail breaks if end of headers-line is
# missing. This option simply sends it if it's missing.
# The list is space-separated.
pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
}
[root@server ~]#


Postfix SMTP Authentication and Dovecot SASL

Edit the file /etc/dovecot/conf.d/10-auth.conf and set the following parameters:

[root@server ~]#vim /etc/dovecot/conf.d/10-auth.conf
[root@server ~]#cat /etc/dovecot/conf.d/10-auth.conf
....
# If you want to allow master users to log in by specifying the master
# username within the normal username string (ie. not using SASL mechanism's
# support for it), you can specify the separator character here. The format
# is then <username><separator><master username>. UW-IMAP uses "*" as the
# separator, so that could be a good choice.
#auth_master_user_separator =
disable_plaintext_auth =no
auth_mechanisms = plain login
...

[root@server ~]#

Edit /etc/dovecot/conf.d/10-master.conf.

[root@server ~]# vim /etc/dovecot/conf.d/10-master.conf
[root@server ~]# cat /etc/dovecot/conf.d/10-master.conf
...
service auth {
# auth_socket_path points to this userdb socket by default. It's typically
# used by dovecot-lda, doveadm, possibly imap process, etc. Its default
# permissions make it readable only by root, but you may need to relax these
# permissions. Users that have access to this socket are able to get a list
# of all usernames and get results of everyone's userdb lookups.
unix_listener auth-userdb {
#mode = 0600
user = postfix
group = postfix
}
....

[root@server ~]#

Edit /etc/postfix/main.cf, find the keys below and change its values as follows or add it at the bottom of the file if the key (the word before the = sign)

[root@server ~]# vim /etc/postfix/main.cf
[root@server ~]# cat /etc/postfix/main.cf
..

mynetworks = 127.0.0.0/8
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
broken_sasl_auth_clients = yes
..

[root@server ~]#

Service dovecot restart

[root@server ~]# service dovecot restart
Stopping Dovecot Imap:                               [ OK ]
Starting Dovecot Imap:                               [ OK ]
[root@server ~]#

Enabled dovecot on reboot

[root@server ~]# chkconfig dovecot on


No comments:

Post a Comment