15
Mail Server Setup using Sendmail on CentOS 5.8 Jeong Chul tland12.wordpress.com Computer Science ITC and RUPP in Cambodia

MailServer . -

  • Upload
    others

  • View
    11

  • Download
    0

Embed Size (px)

Citation preview

Mail Server Setup using Sendmail

on CentOS 5.8

Jeong Chul

tland12.wordpress.com

Computer Science

ITC and RUPP in Cambodia

Mail Server Setup using Sendmail

on CentOS 5.8 Part 1 • Step 1 Email Service

• Step 2 Essential Email Operation

• Step 3 Package installation and Startup

• Step 4 Sendmail Configuration – 1, 2

Part 2 • Step 5 Inbound Sendmail Aliases

• Step 6 Sendmail.cf file

• Step 7 Sendmail Operation

• Step 8 IMAP and POP3 on Dovecot

• Step 9 MUA Configuration

Mail Server Testing Environment

1.sever.chul.com: 192.168.80.25

Sendmail Mail server (mail.chul.com)

Evolution for MUA

2.client.chul.com: 192.168.80.10

Linux mail client

Thunderbird for MUA

3.Windows 7 : 192.168.80.1

Windows mail client

Outlook 2010 for MUA

Step 1 Email Service E-mail System Components

1.Mail User Agent (MUA):

A client used to compose and read e-mail (Outlook, Evolution, Thunderbird,

Mutt)

2.Mail Transfer Agent (MTA):

An SMTP server used to relay or accept e-mail for delivery (Postfix, Sendmail,

Exim, Qmail, Exchange server)

3.Mail Delivery Agent (MDA):

A program used by the final MTA to deliver e-mail to the message store

May be included with the MTA or a separate program such as procmail

4.Mail Access Agent (MAA):

An IMAP/POP3 server used by an MUA to access the message store (Dovecot,

Cyrus IMAP)

Step 2 Essential Email Operation

Step 3 Installation and startup

1.Package installation sendmail-cf-8.13.8-8.1.el5_7 sendmail-doc-8.13.8-8.1.el5_7 sendmail-8.13.8-8.1.el5_7 sendmail-devel-8.13.8-8.1.el5_7

2. Service startup and main directory # service sendmail start # ls –l /etc/mail/ 3. Service startup checking # ps –ef | grep sendmail # netstat –nat | grep 25 4. Runlevel registration # chkconfig sendmail on # chkconfig –list sendmail 5. Testing on command # telnet localhost 25 # mail –v –s ‘title’ [email protected] < /etc/passwd

Step 4 Sendmail Configuration (1)

1.Introduction to Sendmail Configuration /etc/mail/sendmail.mc and /etc/mail/sendmail.cf # m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf "dnl " at the start of a line is a comment in /etc/mail/sendmail.mc

2. # service sendmail restart automatically builds configuration files Converts /etc/mail/sendmail.mc into /etc/mail/sendmail.cf

3. Incoming Sendmail configuration /etc/mail/sendmail.mc dnl dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl /etc/mail/local-host-names ① mail.chul.com ② chul.com ③ jeong.net

Add a line for each domain/host for which we accept local delivery

Step 4 Sendmail Configuration (2)

4. Outgoing Sendmail configuration To relay e-mail sent by hosts on your internal network dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA') dnl /etc/mail/access : each internal network or host for which the server will relay Connect:192.168.80 RELAY Connect:127.0.0.1 RELAY Connect: chul.com RELAY Connect: spam.net REJECT To: [email protected] ERROR:550 bad name From: [email protected] REJECT

5. Sendmail: Masquerading in /etc/mail/sendmail.mc EXPOSED_USER(`root')dnl MASQUERADE_AS(`chul.com')dnl FEATURE(masquerade_envelope)dnl FEATURE(masquerade_entire_domain)dnl MASQUERADE_DOMAIN(chul.com)dnl

# service sendmail restart

Step 5 Inbound Sendmail Aliases

1.Local aliases: /etc/aliases ◄ Local mail forwarding fakename: realname

root: tland,linux,song,park,jeong

staff: :include /home/staff/staff_list ◄Mailing List

2. Virtual aliases: /etc/mail/virtusertable

[email protected] user1

[email protected] user2

[email protected] [email protected]

@abc.com [email protected]

@dom1.org %[email protected] //same user different

domain

Step 6 Sendmail.cf file 1. Name for error message DnMAILER-DAEMON //if want, change

2. Version Number for security DZ8.13.8 O SmtpGreetingMessage=$j Sendmail $v/$Z; $b // j: hostname v&Z: version b: timestamp

3. Max Message Size (byte) O MaxMessageSize=2048000 //2 Mb

4. Max hop Count O MaxHopCount=17 // Max mail server for routing

5. Queue directory for sending and receiving temporarily O QueueDirectory=/var/spool/mqueue

6. Minimum time in queue before retry O MinQueueAge=30m

Step 7 Sendmail Operation

1./etc/mail/local-host-names must contain server's name and aliases

2.# mail -v user view SMTP exchange with local relay

3.# mailq and mailq -Ac view messages queued for future delivery

4.# sendmail –q reprocess the email queue

5.# tail -f /var/log/maillog view log in real-time

Step 8 IMAP and POP3 on Dovecot

1.Dovecot supports POP3, POP3s, IMAP, andIMAPs 2. Installation and startup # yum install dovecot # vi /etc/dovecot.conf protocols = imap imaps pop3 pop3s # service dovecot start 3.Service startup checking # ps –ef | grep dovecot # netstat –nat | grep 110,143 4. Runlevel registration # chkconfig dovecot on # chkconfig –list dovecot 5. Testing on command # telnet localhost 110 //pop3 # telnet localhost 143 //imap

Step 9 MUA Configuration

1.Graphical:

Evolution on Sever system

# yum install evolution

Thunderbird on Client system of Linux

# yum install thunderbird

Outlook 2010 on Client system of Windows 7

2.Text-mode: Mutt and Fetchmail mutt -f pop://user@server

mutt -f pops://user@server

Assignment

1.How to setup Postfix

2.How to setup qmail

3.How to setup Exim

4.Email server security

Mail Server Setup using Sendmail

on CentOS 5.8

Thank you !! See you again on Https, next video

tland12.wordpress.com