1 electronic messaging module - electronic messaging ♦ overview electronic messaging helps you...

18
1 Electronic Messagin Module - Electronic Messaging Overview Electronic messaging helps you exchange messages with other computer users anywhere in the world. This module focuses on this very powerful and useful tool, commonly known as Email. Lessons covered in this module Introduction to Electronic Mail Sendmail Other Mail Utilities

Upload: rosaline-french

Post on 29-Jan-2016

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Electronic Messaging Module - Electronic Messaging ♦ Overview Electronic messaging helps you exchange messages with other computer users anywhere in

1

Electronic Messaging

Module - Electronic Messaging

♦ OverviewElectronic messaging helps you exchange messages with other computer users anywhere in the world. This module focuses on this very powerful and useful tool, commonly known as Email.

♦ Lessons covered in this module► Introduction to Electronic Mail ► Sendmail ► Other Mail Utilities

Page 2: 1 Electronic Messaging Module - Electronic Messaging ♦ Overview Electronic messaging helps you exchange messages with other computer users anywhere in

2

Electronic Messaging

Lesson 1 - Introduction to Electronic Mail

Introduction to Electronic Mail

♦ IntroductionThere are some essential elements, processes and procedures which make email possible. Understanding these will help in managing email communication across networks.

♦ Topics covered in this lesson► The Email Process ► Components and Mail Agents ► Email Protocols

Page 3: 1 Electronic Messaging Module - Electronic Messaging ♦ Overview Electronic messaging helps you exchange messages with other computer users anywhere in

3

Electronic Messaging

Topic 1 – The Email Process

♦ Email uses specifically designed separate programs for mail creation, transmission, and delivery. Any element, like the transmission program can be replaced without affecting the whole system.

♦ The main components essential for email to work properly are the following.► A mail user agent (MUA)► A mall transfer agent (MTA)► A mail delivery agent (MDA)► A mail-notification program (optional)

Page 4: 1 Electronic Messaging Module - Electronic Messaging ♦ Overview Electronic messaging helps you exchange messages with other computer users anywhere in

4

Electronic Messaging

Topic 2 – Components and Mail Agents

♦ The MUA provides an interface for reading and writing email messages. This can have GUI, such as Mozilla Thunderbird or KMail or it can have a CLI, such as Mutt or elm. They serve the purpose of composing an email message and sending it to an MTA.

♦ MTA sends messages across the network without any intervention from the user. It reads the information in the “To:” section and determines the IP address. Then it connects to the recipient's server through a TCP/IP port 25. DNS plays a vital role in mail service.

♦ MDA receives the message. Then it stores the message in the recipient's mailbox file. The mailbox file, called the mail spool, is identified by the username.

Page 5: 1 Electronic Messaging Module - Electronic Messaging ♦ Overview Electronic messaging helps you exchange messages with other computer users anywhere in

5

Electronic Messaging

Topic 3 - Email Protocols

♦ Simple Message Transfer Protocol (SMTP)► The primary purpose of SMTP is to transfer email between mail servers.

The SMTP protocol does not require authentication. So anyone on the Internet can send email to anyone or to large groups of people.

♦ Post Office Protocol (POP)► With a POP server, clients download emails and by default configured to

delete the message on the server after successful transfer. Secure Socket Layer (SSL) encryption for client authentication and data transfer adds security.

Contd…

Page 6: 1 Electronic Messaging Module - Electronic Messaging ♦ Overview Electronic messaging helps you exchange messages with other computer users anywhere in

6

Electronic Messaging

Topic 3 - Email Protocols

♦ Internet Message Access Protocol (IMAP)

► In an IMAP mail server, messages remain on the server where users can read or delete them. IMAP also allows clients to create, rename, or delete mail directories to organize and store email on the server. IMAP is useful for those who use multiple machines to access their email.

► IMAP is compatible with Internet messaging standards, which permit email attachments. SSL encryption for client authentication and data transfer adds security.

Page 7: 1 Electronic Messaging Module - Electronic Messaging ♦ Overview Electronic messaging helps you exchange messages with other computer users anywhere in

7

Electronic Messaging

Lesson 2 – Sendmail

♦ IntroductionSendmail is the default MTA in Red Hat Linux. Sendmail's purpose is to safely transfer email among hosts. It uses the SMTP protocol and is highly configurable.

♦ Topics covered in this lesson► Security and Antispam Features ► Operational Overview of Messaging ► Configuring Sendmail with m4 Macros► Sendmail Client Configuration

Page 8: 1 Electronic Messaging Module - Electronic Messaging ♦ Overview Electronic messaging helps you exchange messages with other computer users anywhere in

8

Electronic Messaging

Topic 1 - Security and Antispam Features

♦ Email spam is unnecessary and unwanted email received by a user who never requested the communication. Sendmail's access control features in the /etc/mail/access file can prevent connections from unwanted hosts.

♦ Using LDAP is a way to find specific information about a particular user from a much larger group. LDAP server can look up a particular email address from a common corporate directory by the user's last name. LDAP stores the hierarchical user information and Sendmail gets the result of LDAP queries.

♦ Sendmail can be used with SpamAssassin to combat spam. SpamAssassin uses header analysis, text analysis, blacklists, and a spam-tracking database to identify and tag spam.

Page 9: 1 Electronic Messaging Module - Electronic Messaging ♦ Overview Electronic messaging helps you exchange messages with other computer users anywhere in

9

Electronic Messaging

Topic 2 - Operational Overview of Messaging

♦ Red Hat Linux uses two MTAs, Sendmail and Postfix. Sendmail is usually configured as the default MTA. You can also switch the default MTA to Postfix.

♦ Sendmail is highly configurable. You have full control over all aspects email handling including the protocol used. Many system administrators use Sendmail due to its power and scalability.

♦ Sendmail also has its limitations. Users may require much more than simple email delivery. They may want use an MUA that uses POP or IMAP, to download their messages.

♦ Sendmail could be configured to do hundreds of different options and rule sets. You can learn about them from different sources.

Page 10: 1 Electronic Messaging Module - Electronic Messaging ♦ Overview Electronic messaging helps you exchange messages with other computer users anywhere in

10

Electronic Messaging Topic 3 - Configuring Sendmail with m4 Macros

♦ The Sendmail executable is /usr/sbin/sendmail. Sendmail configuration file is /etc/mail/sendmail.cf . To make configuration changes to Sendmail, you can edit the /etc/mail/sendmail.mc file. /etc/mail/sendmail.cf is the main configuration file of sendmail.

♦ To make configuration changes to Sendmail, edit the /etc/mail/sendmail.mc file. Then, back up the original /etc/mail/sendmail.cf. Then you should use the m4 macro processor to create a new /etc/mail/sendmail.cf.

♦ You can use the following command:root@ server1~]# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

Page 11: 1 Electronic Messaging Module - Electronic Messaging ♦ Overview Electronic messaging helps you exchange messages with other computer users anywhere in

11

Electronic Messaging

Topic 4 - Sendmail Client Configuration

♦ When you start sendmail it processes all mails waiting in the queue to be transmitted. You should then create a cron table that runs the runq command periodically to service the mail spool.

♦ The mail spool is the /var/spool/inqueue directory. This is where the mail is queued before being transmitted. The mailq command displays a formatted list of all messages in the mail spool and their status. The /usr/bin/mailq command is a symbolic link to the sendmail executable.

♦ If there is a queue, the message ID, size, the time it was placed in the queue, the sender, and its current status will also be displayed.

Page 12: 1 Electronic Messaging Module - Electronic Messaging ♦ Overview Electronic messaging helps you exchange messages with other computer users anywhere in

12

Electronic Messaging

Lesson 3 - Other Mail Utilities

♦ IntroductionPostfix is the other MTA in Red Hat and Linux. It has a modular design, conserves machine resources and is quicker. Procmail is the local delivery agent.

♦ Topics covered in this lesson► Introduction to Postfix ► Using Postfix ► Postfix Configuration ► Procmail Local Delivery

Page 13: 1 Electronic Messaging Module - Electronic Messaging ♦ Overview Electronic messaging helps you exchange messages with other computer users anywhere in

13

Electronic Messaging

Topic 1 - Introduction to Postfix

♦ Postfix is a mail program, which uses a modular design i.e. several smaller programs working together to complete the required tasks. This means that Postfix conserves machine resources is lightning quick.

♦ It has sendmail compatibility with the mailq and newaliases commands, as well as a link to the sendmail binary location /usr/sbin/sendmail. They are not the same as in sendmail but their functionality is the same.

Page 14: 1 Electronic Messaging Module - Electronic Messaging ♦ Overview Electronic messaging helps you exchange messages with other computer users anywhere in

14

Electronic Messaging

Topic 2 - Using Postfix

♦ With Red Hat Linux Postfix RPM is available as part of the distribution. For using postfix you can use the alternatives as follows:

[root@server1 ~]# alternatives – config mta

♦ Then by typing the appropriate selection you can start using Postfix. You can also revert to sendmail in the same way by typing the other option.

Page 15: 1 Electronic Messaging Module - Electronic Messaging ♦ Overview Electronic messaging helps you exchange messages with other computer users anywhere in

15

Electronic Messaging

Topic 3 - Postfix Configuration

♦ For security reasons configure Postfix to run chrooted, which means Postfix processes will only access files in /var/spool/postfix. For instructions on configuring Postfix in a chrooted environment, read the INSTALL document in the Postfix source directory.

♦ You can edit various parameters in /etc/postfix/main.cf. Please look at main.cf and edit these parameters carefully. Some are not found in main.cf, but are defined in main.cf.default. Do not edit them in main.cf.default but insert those lines into main.cf:

Page 16: 1 Electronic Messaging Module - Electronic Messaging ♦ Overview Electronic messaging helps you exchange messages with other computer users anywhere in

16

Electronic Messaging

Topic 4 - Procmail Local Delivery

♦ Procmail processes emails based on instructions from recipes, or rules, which the program matches against the mails. Depending on the recipe, the email will be placed in a certain file, deleted, or otherwise processed.

♦ Procmail reads the email message and separates the body from the header. Next, it reads /etc/procmailrc for default, system-wide, Procmail variables and recipes. Then it reads .procmailrc file in the client’s home directory to find any specific rules.

♦ To use Procmail you have to construct a .procmailrc file with environment variables and rules for different types of messages.

Page 17: 1 Electronic Messaging Module - Electronic Messaging ♦ Overview Electronic messaging helps you exchange messages with other computer users anywhere in

17

Electronic Messaging

Lab Exercises

♦ Verification of MTAs► Starting and verifying sendmail operation ► Starting and verifying Postfix operation

Page 18: 1 Electronic Messaging Module - Electronic Messaging ♦ Overview Electronic messaging helps you exchange messages with other computer users anywhere in

18

Electronic Messaging

Conclusion

♦ Summary► The Sendmail configuration file is /etc/mail/sendmail.cf. To configure

Sendmail use m4 macros to generate a new /etc/mail/sendmail.cf file. ► /etc/postfix/main.cf is the main configuration file for Postfix. There are

many options available to edit this. For security it is better to edit in chroot.

► Procmail reads /etc/procmailrc for default, system-wide, Procmail variables and recipes and then it reads .procmailrc file for specific rules for delivery and acts accordingly.

♦ Question and Answer Session