Dovecot
Configuring Dovecot
/etc/dovecot/dovecot.conf
The following lines will need to be uncommented and if necessary changed to reflect your plans for the environment :
protocols = imap pop3
mail_location = maildir:~/Maildir
protocols - specifies the protocols that are available for users to access their email
mail_location - specifies the format and the location of each user’s mailbox
Authentication process file
This config file can be located at /etc/dovecot/conf.d/10-auth.conf
The following line will need to be uncommented and change if necessary
auth_mechanisms = plain login
auth_mechanisms = specifies the way in which the email client authenticates with Dovecot
Mail Location
to set the location for your mail, use the configuration file at /etc/dovecot/conf.d/10-mail.conf
Either add or uncomment the following line in the configuration file:
mail_location = maildir:~/Maildir
Postfix smtp-auth
change the configuration file to configure the unix socket for postfix smtp-auth. This can be found at /etc/dovecot/conf.d/10-master.conf
Comment out the following lines first
#unix_listener auth-userdb {
#mode = 0600
#user =
#group =
#}
Postfix smtp-auth
Now edit these lines in the same file.
# Postfix smtp-auth
unix_listener /var/spool/postfix/private/auth {
mode = 0666
user = postfix
group = postfix
}
POP3 Configuration
now we need to configure the pop3.conf file. This will allow some older or lesser-used email clients to connect and transmit correctly. This file can be found at /etc/dovecot/conf.d/20-pop3.conf
We will now need to uncomment or add the following lines.
pop3_uidl_format = %08Xu%08Xv
pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
Creating a Mailbox
Now create an example mailbox for a user John Doe (john.doe) to send and receive emails.
You will need to create a user for this example
# useradd john.doe
then create the mail directory for the user
# mkdir /home/john.doe/Maildir
Then give john.doe ownership of the mailbox we just created by changing its permissions
# chown john.doe:john.doe /home/john.doe/Maildir
# chmod -R 700 /home/john.doe/Maildir
Starting Dovecot
Once you have finished creating the mailbox you will need to make sure the Dovecot application will be run with the server upon restart. You can use chkconfig for this.
# chkconfig --level 345 dovecot start
then you will need to start the service
# service dovecot start
Postfix configuration
Now you will need to go over the Postfix directories and make the following changes in the main.cf file. We do this so that we can allow our email client to connect to our newly built SMTP server.
Add the following lines to /etc/postfix/main.cf
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks, reject_unauth_destination
broken_sasl_auth_clients = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
Once done you will need to restart the postfix service
# service postfix restart
Iptables port additions
Now that you have enabled secure SMTP ‘SSL’ we should allow connections to port 587 by opening the port in iptables for the server. Add the rules for this port by entering the following command:
# iptables -I INPUT 2 -p tcp --dport 587 -j ACCEPT
Iptables port additions
After adding the SSL SMTP port we should also add the POP and IMAP ports along with their secure counterparts.
# iptables -I INPUT 3 -p tcp --dport 110 -j ACCEPT
# iptables -I INPUT 3 -p tcp --dport 143 -j ACCEPT
# iptables -I INPUT 3 -p tcp --dport 993 -j ACCEPT
# iptables -I INPUT 3 -p tcp --dport 995 -j ACCEPT
Once these lines have been added you should save the iptables rules and restart iptables
# /etc/init.d/iptables save
# /etc/init.d/iptables restart
Last updated
Was this helpful?