CentOS - Mail Server - Dovecot Installation

Following from the previous article, we have installed Postfix and setup a basic configuration with a secure connection to our mail server. As such, we can move on to installing Dovecot which will allow us to access the mail server with POP and IMAP access (as well as secure POP and IMAP).


Installation

Installation of the Dovecot package is very simple using the yum package manager.

Let's go ahead and install Dovecot:

sudo yum install dovecot

Note that MySQL will also be installed due to the dependencies of Dovecot, but we will not be referencing the application in this series.

Done.

Configure

Now we need to configure Dovecot to enable SASL authentication as we did with Postfix in the previous article(link).

First thing is to open the main Dovecot configuration file:

sudo nano /etc/dovecot.conf

and uncomment the following option:

protocols = imap imaps pop3 pop3s

This setting instructs Dovecot to listen for IMAP (143), IMAPS (993), POP3(110), and POP3S(995) connections to our mail server.

The IMAPS and POP3S protocols are used when making secure connections to the mail server.

SSL/TLS

To configure secure connections, we also need to specify the location of our SSL certificate that was generated in the last article (link).

Locate the following lines in the dovecot.conf file:

#ssl_cert_file = /etc/pki/dovecot/certs/dovecot.pem
#ssl_key_file = /etc/pki/dovecot/private/dovecot.pem

and replace them with our SSL certificate as such:

ssl_cert_file = /etc/pki/tls/certs/mail.demoslice.com.cert
ssl_key_file = /etc/pki/tls/private/mail.demoslice.com.key

Good.

Let's save the file and move on.

Start

Now that we have made the necessary changes to the Dovecot setup we need to start the application.

sudo /etc/init.d/dovecot start

Summary

Installing and configuring Dovecot is a fairly easy process that entails adjusting only a few lines of the default configuration.

This now allows us POP, secure POP, IMAP and secure IMAP access to our mail server.

However, unless we open some ports in our firewall no one will be able to access these services. We'll look at that in the next article.

Article Comments:

Sam commented Sun May 09 06:20:01 UTC 2010:

How would one go about adding an SSL certificate that is not self-signed?

cc commented Sun Oct 03 13:28:29 UTC 2010:

Thanks for a great series of articles. Now that my mail server is set up, are there any articles about setting up webmail?

rashid Iqbal commented Sat Nov 27 07:22:20 UTC 2010:

Kindly help to understand and resolve this problem.

1st Part of maillog: Nov 27 08:10:38 mail postfix/smtpd[14915]: arning: cannot get certificate from file /etc/pki/tls/private/mail.justlinux4u.com.cert Nov 27 08:10:38 mail postfix/smtpd[14915]: warning: TLS library problem: 14915:error:02001002:system library:fopen:No such file or directory:bss_file.c:352:fopen('/etc/pki/tls/private/mail.justlinux4u.com.cert','r'): Nov 27 08:10:38 mail postfix/smtpd[14915]: warning: TLS library problem: 14915:error:20074002:BIO routines:FILECTRL:system lib:bssfile.c:354: Nov 27 08:10:38 mail postfix/smtpd[14915]: warning: TLS library problem: 14915:error:140DC002:SSL routines:SSLCTXusecertificatechainfile:system lib:sslrsa.c:720: Nov 27 08:10:38 mail postfix/smtpd[14915]: cannot load RSA certificate and key data

2nd part

Nov 27 08:10:38 mail postfix/smtpd[14915]: connect from 59-112-81-3.dynamic.hinet.net[59.112.81.3] Nov 27 08:10:40 mail postfix/smtpd[14915]: NOQUEUE: reject: RCPT from 59-112-81-3.dynamic.hinet.net[59.112.81.3]: 554 5.7.1 w852@ymail.com: Relay access denied; from=peter@gmail.com to=w852@ymail.com proto=SMTP helo=<212.119.70.156> Nov 27 08:10:40 mail postfix/smtpd[14915]: lost connection after RCPT from 59-112-81-3.dynamic.hinet.net[59.112.81.3] Nov 27 08:10:40 mail postfix/smtpd[14915]: disconnect from 59-112-81-3.dynamic.hinet.net[59.112.81.3]

Marty commented Mon Apr 04 19:12:42 UTC 2011:

Wouldnt you wan't to use chkconfig to autostart dovecot?

/sbin/chkconfig --add dovecot /sbin/chkconfig --level 2345 dovecot on

Want to comment?


(not made public)

(optional)

(use plain text or Markdown syntax)