What is Exim?
Exim is a mail transfer agent (MTA) used on Unix-like operating systems. Exim is free software distributed under the terms of the GNU General Public License, and it aims to be a general and flexible mailer with extensive facilities for checking incoming e-mail.
What is Dovecot?
Dovecot is an open source IMAP and POP3 email server for Linux/UNIX-like systems, written with security primarily in mind. Dovecot is an excellent choice for both small and large installations.
UPDATE THE SYSTEM
First off, ssh to your server and initiate a screen session using the command below:
## screen -U -S exim-dovecot
once you’re in a screen session, update your CentOS 7 VPS using yum as in:
## yum update
ENABLE EPEL REPOSITORY
Enable EPEL repository on the CentOS system using:
## yum install http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-2.noarch.rpm
if you get a 404 not found, go at http://dl.fedoraproject.org/pub/epel/7/x86_64/e/ and install the latest epel-release rpm package available.
check if EPEL has been enabled on your system using:
## yum repolist
once EPEL is enabled, install some useful tools using:
## yum install file perl-Mail-SPF.noarch openssl vim
GENERATE SSL CERTIFICATE
Since we are going to use SSL in Dovecot and Exim, we need to have an SSL certificate. You can purchase and use one of our GeoTrust SSL Certificates or you can create your own self-signed SSL certificate for mail.mydomain.com using the commands below:
## mkdir /root/SSL/mail.mydomain.com -p
## cd /root/SSL/mail.mydomain.com
## openssl req -nodes -x509 -newkey rsa:2048 -keyout mail.mydomain.com.key -out mail.mydomain.com.crt -days 365
Move the SSL certificate and key to /etc/ssl using:
## cp mail.mydomain.com.key mail.mydomain.com.crt /etc/ssl/
INSTALL AND CONFIGURE EXIM
Install exim on the CentOS 7 virtual server using yum:
## yum install exim
next, open /etc/exim/exim.conf with your favorite editor and configure exim as follows:
## cp /etc/exim/exim.conf{,.orig}
## vim /etc/exim/exim.conf
primary_hostname = mail.mydomain.com
domainlist local_domains = @ : mydomain.com
tls_advertise_hosts = *
tls_certificate = /etc/ssl/mail.mydomain.com.crt
tls_privatekey = /etc/ssl/mail.mydomain.com.key
auth_advertise_hosts = *
find the transport section and edit the following:
local_delivery:
driver = appendfile
directory = $home/Maildir
maildir_format
maildir_use_size_file
delivery_date_add
envelope_to_add
return_path_add
scroll down the the authenticators section and add the following lines:
dovecot_login:
driver = dovecot
public_name = LOGIN
server_socket = /var/run/dovecot/auth-client
server_set_id = $auth1
dovecot_plain:
driver = dovecot
public_name = PLAIN
server_socket = /var/run/dovecot/auth-client
server_set_id = $auth1
Start the EXIM MTA and add it to system’s startup using systemctl
## systemctl start exim
## systemctl status exim
## systemctl enable exim
Exim Commands::
==============
Email Count
exim -bpc
Email queue details
exim -bp
Email header details
exim -Mvh ID
Email body details
exim -Mvb ID
Email log details
exim -Mvl ID
Email count with sender details
exim -bpr|grep "<"|awk {'print $4'}|cut -d"<" -f2|cut -d">" -f1|sort -n|uniq -c|sort -n
Count of emails sent from a sender
exiqgrep -f sendername|grep "<"|wc -l
Count of emails sent to a particular email
exiqgrep -f recipient|grep "<"|wc -l
Delete mails from a particular sender
exim -bpr| grep sendername| awk '{print $3}'|xargs exim -Mrm
List of frozen mails
exim -bp|grep frozen|wc -l
Delete frozen mails
exim -bp|grep frozen|awk {'print $3'}|xargs exim -Mrm
Summary of emails in the queue
exim -bp|exiqsumm
Display what exim is doing now
exiwhat
INSTALL AND CONFIGURE DOVECOT
===============================
Install Dovecot on the system using yum
## yum install dovecot
Once installed, configure SSL in Dovecot by editing the following:
## vim /etc/dovecot/conf.d/10-ssl.conf
ssl = yes
ssl_cert = </etc/ssl/mail.mydomain.com.crt
ssl_key = </etc/ssl/mail.mydomain.com.key
next, allow plaintext authentication in /etc/dovecot/conf.d/10-auth.conf:
## vim /etc/dovecot/conf.d/10-auth.conf
disable_plaintext_auth = no
auth_mechanisms = plain login
configure mailbox location and type in /etc/dovecot/conf.d/10-mail.conf:
## vim /etc/dovecot/conf.d/10-mail.conf
mail_location = maildir:~/Maildir
Set-up Dovecot so that is allows Exim to use its authentication system in /etc/dovecot/conf.d/10-master.conf
## vim /etc/dovecot/conf.d/10-master.conf
service auth {
...
unix_listener auth-client {
mode = 0660
user = exim
}
}
Start Dovecot and add it to system’s start-up using:
## systemctl start dovecot
## systemctl status dovecot
## systemctl enable dovecot
CREATE SYSTEM USER
## useradd -m test
## passwd test
No comments:
Post a Comment