Email Gateway

From Colwiki.org

Jump to: navigation, search


Outcomes

Upon completion of this module you will be able to:
  • Install and configure MTA’s
  • Implementing Spam and Content Filtering
  • Configuring Virus Filtering with MTA’s
  • Operate and Perform Basic Configuration of Sendmail MTA’s
  • Deploying secure Webmail services



Terminologies

  1. MTA:Mail Transport Agent. This is the mail component with the responsibility of deciding if mail handed to it is for a local account or not. It passes local mail to an MDA or stores it directly in mailstore itself. Remote mail is passed to another MTA.
  2. MUA:Mail User Agent. The client mail component which retrieves mail from mailstore and presents it to the user. It allows the user to create new mail and to send it to a MTA for onward transmission. Often the MUA will be associated with a graphical interface.


Contents

Mail Transfer Agent (MTA)

A mail transfer agent (MTA) (also called a mail transport agent, message transfer agent, or smtpd (short for SMTP daemon), is a computer program or software agent that transfers electronic mail messages from one computer to another. The term mail server is also used to mean a computer acting as an MTA that is running the appropriate software. An MTA receives mail from another MTA (relaying) or from a mail user agent (MUA). The MTA works behind the scenes, while the user usually interacts with the MUA.

For a listing of mail server see http://en.wikipedia.org/wiki/List_of_mail_servers . In this documentation we shall focus on the Sendmail Mail Server

Sendmail Configuration

Make sure that you install the necessary packages from the package manager or from the command line. Ensure also that your Domain Name Server is properly configured. We go into sendmail's main configuration directory /etc/mail. Here we need to do the following:

By default sendmail is configured to listen for connections ONLY for the 127.0.0.1 interface. In order to make sendmail listen to all interfaces we need to comment out the following line in /etc/mail/sendmail.mc using 'dnl' which stands for “do next line”:

dnl  DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

Once this is done run:

m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

Notice: Make sure /etc/sendmail.cf isn't also there, if it is, delete it. Restart sendmail and try the following:

telnet test1.seafront.bar 25

Warning: If you get a connection then sendmail is responding. This doesn't mean that sendmail will deliver mail (relay) for you! To configure sendmail to relay for you you need to add the IP for your machine to the /etc/mail/access file:

192.168.246.12	RELAY

Finally, we also need to tell sendmail to accept mail for @seafront.bar addresses. For this, add the domain name to /etc/mail/local-host-names:

seafront.bar

Restart sendmail and send a mail to an existing user. If you have a user tux on the machine then check the output of the following:

mail -v -s “test seafront domain” tux@seafront.bar < /etc/passwd

We want the server seafront.bar to accept mail for the city.bar domain. For this we follow the following steps.

The DNS entries

We need to add an MX record for the city.bar domain. Here is the whole block for clarity:

seafront.bar.			IN	MX 10	test1.seafront.bar.
city.bar.				IN	MX 10	test1.seafront.bar.
test1.seafront.bar.		IN	A		192.168.246.12

Reload the zone file:

rndc reload

Sendmail Settings

If you want to forward mail onto another account here are example entries for the virtusertable database:

tux@city.bar	mr.tux@otherdomain.org
@city.bar	administrator
list@city.bar	local-list

Here mail for user tux is diverted to mr.tux@otherdomain.org, the user administrator is the catchall account, lists are redirected to local lists (this needs to point to a valid list defined in the aliases


Using Procmail to receive mail

In depth information can be found in the procmail, procmailrc and procmailex manpages. Here are a few examples taken from procmailex(5). Sort all mail coming from the lpi-dev mailing list into the mail folder LPI:

:0:
* ^TO_lpi-dev
LPI

Forward mails between two accounts main.address and the-other.address. This rule is for the procmailrc on the main address account. Notice the X-Loop header used to prevent loops:

:0 c
             * !^X-Loop: yourname@main.address
             | formail -A "X-Loop: yourname@main.address" | \
                $SENDMAIL -oi yourname@the-other.address 

The c option tells procmail to keep a local copy.


Summary

In this module you learned how to set-up your SMTP Server.It is important that you are also able to set-up your mail user agent and implement pop/imap services within your server. This can be done by using an POP/IMAP Server e.g imapd and dovecot.

Configuration of secure email access is one of the areas that Linux is quite strong and is an area where you shall be required to implement and manage time and time again.


Assignment

Follow the instructions on the following two(2) websites and set-up your SMTP Server using postfix. You may also decide to use webmin for the configuration rather than setting up from the command line.

Install the dovecot package from the installation media and test with an appropriate Mail User Agent as to whether you can be able to send and receive email.

Image:somerights20.png This work is licenced under a Creative Commons - By Attribution Licence - Share Alike License.

Personal tools
News & Events