Contents I. Server C configuration (Debian) ............................................................................................................ 4
II. Server A configuration (CentOS) ......................................................................................................... 15
� IP configuration on server A ........................................................................................................... 15
� Webmail .......................................................................................................................................... 18
� Configure DNS ............................................................................................................................. 18
� Install and configure squirrelmail ............................................................................................... 23
� Create Virtual host ...................................................................................................................... 28
� Postfix .............................................................................................................................................. 31
� Install and configure posfix ......................................................................................................... 31
� SMTP authentication and POP3s ................................................................................................ 33
� Dovecot ........................................................................................................................................... 38
� Install and configure dovecot ..................................................................................................... 38
� Fetchmail ......................................................................................................................................... 42
Antivirus ...................................................................................................................................................... 43
III. Server B configuration (Debian) .......................................................................................................... 47
� DNS .................................................................................................................................................. 47
� Postfix .............................................................................................................................................. 52
� Dovecot ........................................................................................................................................... 59
� Squirrelmail ..................................................................................................................................... 64
� POP3S .............................................................................................................................................. 75
� IMAPs .............................................................................................................................................. 80
� SMTP authentication....................................................................................................................... 87
� SMTP authentication on squirrelmail ............................................................................................. 91
IV. Server D configuration (ubuntu) ......................................................................................................... 96
� Configure DSN ................................................................................................................................. 96
� Configure postfix ........................................................................................................................... 101
� Configure dovecot ......................................................................................................................... 103
� Configure SMTP authentication .................................................................................................... 106
� Configure squirrelmail................................................................................................................... 110
V. Send mail to each server ................................................................................................................... 124
Home work structure
Server A: - Webmail (https is optional) - Postfix (Authenticate and verify sender address, pop3s and imaps) - Dovecot - Fetchmail - Anti-Virus Server B: - Postfix (Authenticate and verify sender address, pop3s and imaps) - Dovecot - Anti-Virus Server C: - Internet Server D: - Webmail (https is optional) - Postfix (Authenticate and verify sender address, pop3s and imaps) - Dovecot - Anti-Virus
I. Server C configuration (Debian) Server C is DNS public, so we need to configure DNS on this server in order to allow each server
communicate to each other by name
Configure IP address on server in the following file
Configure DNS client on server C
II. Server A configuration (CentOS)
� IP configuration on server A
Change hostname computer: vi /etc/sysconfig/network
Change HOSTNAME
Configure ip address Longing by user root: setup
Select Network configuration
Save configuration
Configure dns name on computer
Vi /etc/resove.conf
Search :domain name, nameserver : ip address of dom
Show configure on Ethernet: ifconfig eth0
Bind information
Configure ip domain: 192.168.1.100/24
File configuration bind: vi /etc/name.conf and write configration
Configure file: forward and reverse in /var/named/master
Configure file: forward zone: vi /var/named/master/roth.edu.zone
Configure file revers zone: vi/var/named/master/192.168.1.zone
Configure domain name: vi /etc/resolv.conf
Testing configuration bind: tail –f /var/log/messege
Nslookup domain: nslookup domain name
� Install and configure squirrelmail
Remove default set mail: yum –y remove sendmail
Install squiremail: yum –y install squirrelmail
Package installation:
Squirrel mail: Install for dependencies
php-mbstring: update for dependencies
Configure squirrelmail : /usr/share/squirrelmail/config/conf.pl
Select(1) for organization preferences
Select (1) for organization Name
Type squirrelmail name: for access
Select (r): agree to rename squirrelmail’s name
Select (2): save change configuration
� Create Virtual host
Vi /etc/httpd/conf/httpd.conf
NamevirtualHost : ipaddress of webserver ServerAdmin : user admind on webmail DoccumentRoot : location store root database Servername : Address for access webmail
Create CNAME
Vim /var/named/master/roth.edu.zone : file forwardzone on DNS server
Create CNAME of webmail
Change picture on squirrelmail logo
/usr/share/squirrelmail/config/conf.pl : database store file image on squirrelmail
Type (1) : Organize Preferences
Type (2) : for organize Logo
Copy file image to the /usr/share/squirrelmail/images Type file image name on [../images/sm_logo.png] : ../images/name’s file picture
Squit and save configuration: q and y
� Postfix
Remove sendmail: yum –y remove sendmail
� Install and configure posfix
Yum –y postfix
Configure postfix File configuration: Vi /etc/postfix/main.cf
Configure parameter common:
myhostname: is the host name of the system (i.e, the system is called mail or mail.example.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 (i.e, this server is the final destination for email addressed to these domains).
Add user mail
Create user with home directory: Add user: Useradd –m username
Password: Password username
Restart postfix: rcpostfix restart telnet connection : telnet hostname/ip address port number telnet LanA 25
View mail log: for show Date /time connection mail
� SMTP authentication and POP3s
Authentication verify sender address
Restart service saslauthd: Install service cyurs-sasl-plain
Add parameter for verify sender address: vi /etc/postfix/main.cf
Restart service postfix and saslauthd
Testing Telnet smtp protocol
Configure Microsoft outlook client
Success configure POP3s
� Dovecot
� Install and configure dovecot
Yum –y install dovecot
File configure: vi /etc/dovecot.conf
Common parameter: 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.
Restart service: rcdovecot restart or /etc/init.d/dovecot restart
Testing protocol POP3: 192.168.1.100 110 (telnet ip address or hostname port )
Configure username: name user webmail Incoming and outgoing mail server: IP address or name webmail server
� Fetchmail
Install service Fetchmail Yum –y install Fetchmail
Completed installation
Create file download in home user cd /home/username
Create file download: vi ./fetchmailrc
Configuration download mail.
Pool: ip address mail server store mail for eacher server download Proto: protocol use for download User: user store mail box for each user Pass: password user download mail Is : user download mail from mail box server Keep: store mail in mail box webmail server
Antivirus
Install and configuration clamav
Location used to find location download: cd /etc/yum.repos.d
Website address for download package: wget http://www.linux-mail.info/files/dag-clamav.repo
III. Server B configuration (Debian)
IP configuration on server B
Eth0 is connect to LAN and Eth1 is connect to wan
� DNS
Install bind
I want full configuration of main.cf, so I need to replace file /etc/postfix /main.cf by
/usr/share/postfix/main.cf
Change important parameters for our mail server in configuration file /etc/postfix/main.cf
Enable mail location
Add login to the following parameter
Enable socket listen and other following parameter
Restart apache2
Install PHP5 and other services for squirrelmail
Install squirrelmail by using the following command line
File configuration of squirrelmail
Run this command for configure squirrelmail
After enter above command line we will reach the squirrelmail configuration, so we could configure
squirrel mail by follow following
• Enter 1 -> Enter 1 -> write Domain Name: Ex: mailroth.edu-> s -> Enter -> r
• Enter 2 -> Enter 1 -> write Domain Name: Ex: mailroth.edu
• Enter 2 -> Enter a -> Enter 4 -> write DNS IP Ex: 192.168.1.1
• Enter 2 -> Enter b -> Enter 4 -> write DNS IP Ex: 192.168.1.1 -> s -> enter-> r
• Enter 2 -> Enter a -> Enter 8 -> write: dovecot -> s -> Enter -> r
• Enter 3 -> Enter 3 -> write: Trash
• Enter 3 -> Enter 4 -> write: Sent
• Enter 3 -> Enter 5 -> write: Drafts -> s -> Enter -> r
And after Ctrl + C
Create directory “data and attach” and give permission
Add following line in the file /etc/apache2/apache2.conf
Configure virtual host
Comment parameter that we add at the moment
Configure virtual host in the path /etc/apache2/sites-enabled
Copy files 000-default to webmail.mailroth.edu
Add the following configuration to our Virtual host file
Restart postfix and dovecot
Logon to squirrelmail again
Success log on to squirrelmail and display mail
File smtpd.conf
Tell postfix by file main.cf
rm -r /var/run/saslauthd/
mkdir -p /var/spool/postfix/var/run/saslauthd
ln -s /var/spool/postfix/var/run/saslauthd /var/run
chgrp sasl /var/spool/postfix/var/run/saslauthd
adduser postfix sasl
Success sends mail with authentication
� SMTP authentication on squirrelmail
After we configure smtp authentication on postfix we need to tell squirrelmail about that
Type this command for change setting on squirrelmail
Type 2 for change server setting
Type b for update SMTP setting
Type 7 for configure SMTP authentication any type y for agree use SMTP authentication
Configure setting like below
IV. Server D configuration (ubuntu)
� Configure DSN
Command update system
Commands install service bind9
Select Y
Go to path “cd/etc/bind”, then delete file “name.conf”
Copy file “named.conf.default-zones to named.conf ”
Type command “vim named.conf”, go to edit in this file
Type zone name of your dns
Create one folder name “master ”
Copy file two “db.127 db.local” to folder master
Rename two file to name of your forwarder and reverser zone
Type command “vim 192.168.11.db ” go to edit in this file reverser zone
Edit two point in this file
Type command “vim serverd.com.db” go to edit in file forwarder
In this file change two points
Command restart service bind9
Command put domain name on machine
Command restart service networking
Restart service bind again
Test nslookup
Configure forward to dns publish , this is path to configure forward
In this point you put ip publish that you do forward
Select OK
Select OK
Put name of dns
Command copy file configuration postfix
Path that edit to configure postfix
Three point that you need to edit for postfix
Command restart service postfix
� Configure dovecot
Command installs service dovecot imap and pop3
� Configure SMTP authentication
Install service sasl
Type Y
Command restart service sasl
You need to add command command to postfix for configure authentication
This is syntax that add to postfix for authentication
Restart service postfix
Create user test send receive mail
Test send receive mail on outlook
You need to cross for authentication
Test send mail from user da to user root
Test sends mail from user root to user da
It successful to send and receive
� Configure squirrelmail
Install squirrelmail
Install service apache2
Type Y
Install service php5
Type Y
Configure virtual host
copy file default in /etc/apache2/sites-enabled/
Go to edit in this file
Change two point on this file
Go to edit file /etc/apache2/port.conf
Put Ip address machine dns
Command restart service apache
Add CNAME on dns server
Add CNAME for webmail
Add MX record for server D
In each server such as server B we need to add each server to mydestination in file main.cf