sendmail

only for RuBoard - do not distribute or recompile

sendmail

The sendmail system provides the ability to send and receive mail.

Verifying sendmail Installation

To verify that you have sendmail installed, run the rpm query command.

 [root@winbook root]# rpm -q sendmail sendmail-8.9.3-15 

If it does not show information similar to this, you need to install sendmail from the Red Hat CD. Any version of sendmail will work. However, if you want to use your server on the Internet, you need to use version 8.9.3 or greater.

Previous versions have some implementation shortfalls. These versions can allow people to send unwanted email to others, using your machine as a relay. This is true even if you had configured those versions of sendmail not to be a relay.

GEEK SPEAK: A relay is a machine that is given mail to deliver to someone else. The machine requesting delivery of the mail can then disappear from the Internet. This leaves system operators upset at you if the mail delivered to them is Unsolicited Commercial Email, or UCE for short.

GEEK SPEAK: A smart SMTP host is a machine that can deliver mail with no other assistance. The sendmail package turns your Linux machine into a smart SMTP host.

GEEK SPEAK: sendmail is also known as a Mail Transport Agent (MTA).

Y2K stands for Year 2000.

Here is how a relay works: Mail client software is configured such that it knows your server is a smart SMTP host. Many email messages are created, and the client hands off each one to your server. Your sendmail program then delivers each one of the messages to their final destination. This could occur long after the client software has disconnected from your server.

This is the source of the massive amount of UCE being distributed over the Internet. It is the Y2K version of Post Office-delivered advertisements, also known as junk mail. It has been referred to by a well-known canned meat product name , in spite of objections by that company, some in the form of legal actions. Personally, I don't blame them. Regardless of their objections, spam is popularly used to describe junk email.

If your MTA is responsible for sending UCE to servers across the world, you will find your machine blacklisted.

GEEK SPEAK: If your machine is used as a relay too often, you will find that, after awhile, no one will accept any mail from you. This is known as blacklisting. You need to run the latest software and have it properly configured!

If you find yourself blacklisted, you can have an expert fix your installation, and ask that your machine be removed from the black list. One of the most used lists is at http://maps.vix.com. It is called MAPS, or the Real Time Blacklist (RBL).

sendmail Configuration

You must configure your sendmail to accept mail for relay from clients you approve. You also must configure sendmail to receive messages directed to your machine. Let's do that.

First, for the Red Hat install of sendmail in release 6.0 or greater, the two configuration files we will edit are

 /etc/sendmail.cw /etc/mail/access 

In the sendmail.cw file, you need to put the names by which your machine will be known. One name goes on one line.

 lin lin.mydomain.com 

In our case, we are only interested in mail that is delivered to machine lin. We will use our fictitious domain mydomain.com.

If your hostname as reported by the hostname program is not lin.mydomain.com, run linuxconf in the X Window System and set the hostname. Or edit the file /etc/sysconfig/network and change the line that starts with HOSTNAME= to look like this:

HOSTNAME=lin.mydomain.com

This will cause Red Hat to pick up the correct hostname the next time you reboot the machine. You can temporarily set the hostname for your machine by running the following command:

hostname lin.mydomain.com

Now we move on to the /etc/mail/access file. This file governs who can relay through your server. It can also reject email from machines or networks from which you do not want to receive mail. These machines can be sources of UCE, or perhaps you simply don't like the people who send mail from those machines.

Bring up the access file in an editor. Modify it so it is similar to the following printout:

 # Check the /usr/doc/sendmail-8.9.3/README.cf file for a description # of the format of this file. (search for access_db in that file) # The /usr/doc/sendmail-8.9.3/README.cf is part of the sendmail-doc # package. # # by default we allow relaying from localhost... localhost.localdomain         RELAY localhost                     RELAY 127.0.0.1                     RELAY 

You can also add a domain to the relay command. Specific machines, users, or networks can be rejected. In the following example, the user LoansForYou cannot send mail to your machine. That user is rejected. The network 192.168.12.0 is rejected, as well as any messages from the domain badmail .com. The machine mail1.foofoo.com, and the specific address 192.168.22.22 are both rejected.

 LoansForYou@ REJECT mail1.foofoo.com REJECT 192.168.12 REJECT badmail.com REJECT 192.168.22.22 REJECT 

Modify the access file to include your Linux and Windows machine names. If you need to allow other machines on the network as a test, add your network address also. Here is how your access file should look:

 lin.mydomain.com              RELAY win.mydomain.com              RELAY 172.16.13                     RELAY localhost.localdomain         RELAY localhost                     RELAY 127.0.0.1                     RELAY 

After modifying the access file, you must restart sendmail. The process of doing this rebuilds the database file access.db from the information in the access text file. Run the following commands:

[root@lin root]# /etc/rc.d/init.d/sendmail stop

Output

 Shutting down sendmail:                                    [  OK  ]  [root@lin root]# /etc/rc.d/init.d/sendmail start Starting sendmail:                                         [  OK  ] 

If sendmail takes a very long time to start or appears hung, you probably have not entered your IP address and hostname information in the /etc/ hosts file. Also, sendmail needs the information in the sendmail.cw file to be properly presented. Either one of these will prevent its operation.

To verify sendmail is running, use the ps command:

[root@lin root]# ps ax grep sendmail

Output

 883 ?        S      0:00 sendmail: accepting connections on port 25 

If you don't have a printout similar to this, go over the setup again. Verify the name and IP address information in the /etc/hosts file and in the sendmail.cw file.

With non-private Internet domain and IP settings in the files just covered, sendmail can send mail to anyone over the Internet. It can also receive mail for delivery to anyone on your Linux machine. With the UCE rejection measures available to you by editing the access file, you can keep undesired mail to a minimum.

The final part of the configuration is setting the startup scripts so Sendmail will automatically run at boot time. In an Xterm, run the setup command.

This command can be run in any kind of terminal. If you are using a non-graphic terminal, the printout will appear as follows . Graphic or color terminals improve the display, but the point is that you can run this command from any machine, even across the network.

Output

 Text Mode Setup Utility 1.2                      (C) 1999 Red Hat Software           Pick a Tool           Authentication configuration           Keyboard configuration           Mouse configuration           System services           Sound card configuration           Timezone configuration           X configuration           Run Tool      Quit <Tab>/<Alt-Tab> between elements      Use <Enter> to edit a selection 

Use the arrow keys to select the System services line, and press Enter.

Testing sendmail

To test the sendmail installation, telnet to the SMTP port, which is port 25. You should see Sendmail respond with a sign-on banner. Then enter the ehlo mydomain.com greeting and see it respond:

[root@lin root]# telnet lin 25

Output

 Trying 172.16.13.70... Connected to lin. Escape character is '^]'. 220 lin.mydomain.com ESMTP Sendmail 8.9.3/8.9.3; Thu, 9 Mar 2000 07:11:38 -0600 ehlo mydomain.com 250-lin.mydomain.com Hello IDENT:root@lin [172.16.13.70], pleased to meet you 250-EXPN 250-VERB 250-8BITMIME 250-SIZE 250-DSN 250-ONEX 250-ETRN 250-XUSR 250 HELP quit 221 lin.mydomain.com closing connection Connection closed by foreign host. 

The sign-on banner gives you the hostname and the sendmail version number. Verify these are what you expect. The response to the ehlo command gives an indication of what services sendmail can provide. If you see a list similar to the previous one, sendmail is ready.

only for RuBoard - do not distribute or recompile


MySQL and PHP From Scratch
MySQL & PHP From Scratch
ISBN: 0789724405
EAN: 2147483647
Year: 1999
Pages: 93
Authors: Wade Maxfield

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net