Documente Academic
Documente Profesional
Documente Cultură
Introduction:
There are many different scenarios and combinations that can be used when setting up an email
server (far to many to cover here), so this TP makes some basic choices for you, such as the
software we will use (postfix and dovecot). Other options are required to be altered by the user,
such as your network addresses and domain names.
This TP uses postfix as the mail transport agent (MTA), as opposed to sendmail, the default MTA
for CentOS 5 (postfix is the default in CentOS 6). Dovecot is used to allow users to access their
email by either imap or pop protocols. We assume a domain name of esprit.com which should
be changed by the reader and can be either a real domain name for a fully qualified email server
or a fake domain name if you only wish to implement an internal mail server.
Objectifs:
Add user accounts (user1 and unser2).
Installing the MTA and MDA services.
Configuring Postfix and Dovecot software module.
Testing
#useradd –m user1
#passwd user1
#useradd –m user2
#passwd user2
1
Step 2 : Install Postfix server
Before installing postfix, you should check if it is already installed because postfix is the
default MTA in CentOS 6. If you’re using centos 5 then you have to remove sendmail which
is the default mail MTA and install positsfix.
*COMMANDS REQUIRED ONLY FOR CENTOS 5, IF YOUR USING CENTOS 6 SKIP THIS PART
Postfix is installed by default. If it is not installed, use the below command to install postfix.
By default Port number 25, 110 and 143 are closed so we need to allow access throw those
ports
Enabling access on port SMPT (tcp/25), POP3 (tcp/110), and IMAP (tcp/143) in the iptables.
# nano /etc/sysconfig/iptables
CentOS 6.3 –install & configure Postfix – Dovecot |
Open the postfix config file /etc/postfix/main.cf. Find the below lines and edit them as shown
below.
[root@server ~]# nano /etc/postfix/main.cf
2
##line no 83 - uncomment and enter your domain name
mydomain = esprit.com
##line no 99 - uncomment
myorigin = $mydomain
#change to all
inet_interfaces = all
Now let’s take a look at each setting it turn to understand what we've just done:
myhostname: is the host name of the system ( the system is called mail or mail.esprit.com).
mydomain: is the domain name for the email server (it can be a real or fake domain name).
myorigin: is the domain name that locally-posted email appears to have come from and is
delivered to.
inet_interfaces: sets the network interfaces that Postfix can receive mail on. These need to
include at least localhost and the local domain.
mydestination: is the list of domains that will be delivered to ( this server is the final
destination for email addressed to these domains).
CentOS 6.3 –install & configure Postfix – Dovecot |
mynetworks: is a list of trusted IP addresses that may send or relay mail through the server.
Users attempting to send email through the server originating from IP addresses not listed
here will be rejected.
relay_domains: is a list of destination domains this system will relay mail to. By setting it to
be blank we ensure that our mail server isn't acting as an open relay for untrusted networks.
home_mailbox: sets the path of the mailbox relative to the users home directory and also
specifies the style of mailbox to be used. Postfix supports both Maildir and mbox formats and
readers are encouraged to read up on the merits of each for themselves.
3
Step 5 : Start the services
After finishing the configuration we should start the service and keep it on
Check Mail
Navigate to the user mail directory and check for the new mail.
4
by esprit.com (Postfix) with ESMTP id 117113FF18
for <user1>; Thu, 7 Feb 2013 17:05:32 +0530 (IST)
Message-Id: <20130207113547.117113FF18@server.ostechnix.com>
Date: Thu, 7 Feb 2013 17:05:32 +0530 (IST)
From: user1@esprit.com
To: undisclosed-recipients:;
test
Dovecot is used to allow users to access their email by either imap or pop protocols.
Open the dovecot config file /etc/dovecot/dovecot.conf. Find and uncomment the line as
shown below.
[root@server ~]# nano /etc/dovecot/dovecot.conf
protocols = imap pop3 lmtp
Open the file /etc/dovecot/conf.d/10-mail.conf and uncomment the line as shown below.
[root@server ~]# nano /etc/dovecot/conf.d/10-mail.conf
mail_location = maildir:~/Maildir ##line no 24 - uncomment
CentOS 6.3 –install & configure Postfix – Dovecot |
5
Again, looking at each option:
protocols: specifies the protocols available to users to access their email. Dovecot supports
imap(s) and pop3(s), and any or all may be used.
mail_location: specifies the format and location of each users mailbox. Here we see we are
using maildir format and each user has their mailbox located at ~/Maildir. Examples for
mbox format are provided in the configuration file.
Message-Id: <20130207113547.117113FF18@esprit.com>
Date: Thu, 7 Feb 2013 17:05:32 +0530 (IST)
From: user1@esprit.com
To: undisclosed-recipients:;
test
.
quit
+OK Logging out.
Connection closed by foreign host.
[root@server ~]#
Required tests:
After testing postfix and dovecot with user1 now try to send a Mail from user 1 to user 2 and
check if user2 receives the mail.
Configuration « Outlook » sous windows :
6
Allez à : outils -> paramètres de compte -> nouveau
7
Configuring services for IPv6
Configuring your system consists of two distinct steps. First, you need to enable IPv6 on your
network interface and second you need to configure your applications to bind to the right IPv6
addresses.
Many of the services will use IPv6 automatically if an IPv6 network is present at startup,
some services require explicit configuration to enable IPv6. I will shortly mention those that I
needed to configure on my own server.
Postfix
Postfix needs to be told to use IPv6 by adding the below configuration in /etc/postfix/main.cf:
inet_protocols = all
Dovecot
To make Dovecot listen on IPv6 addresses it needs to have an explicit listen configuration added.
To make it listen on all addresses add the line in dovecot.conf:
listen = *, [::]
CentOS 6.3 –install & configure Postfix – Dovecot |
Testing
Confirm that you can connect OK to your IPv6 smtpd: